Module: PFM::Text

Included in:
Battle::Message
Defined in:
docs/4_Systems_000_General_1_PFM.rb

Overview

The text parser of PSDK (retrieve text from Studio::Text)

Author:

  • Nuri Yuri

Constant Summary collapse

PKNICK =

Pokemon Nickname var catcher

Array.new(7) { |i| "[VAR PKNICK(000#{i})]" }
PKNAME =

Pokemon name var catcher

Array.new(7) { |i| "[VAR PKNAME(000#{i})]" }
TRNAME =

Trainer name var catcher

Array.new(7) { |i| "[VAR TRNAME(000#{i})]" }
ITEM2 =

Item var catcher

['[VAR ITEM2(0000)]', '[VAR ITEM2(0001)]', '[VAR ITEM2(0002)]', '[VAR ITEM2(0003)]']
ITEMPLUR1 =

Definite article catcher

['[VAR ITEMPLUR1]']
MOVE =

Move var catcher

['[VAR MOVE(0000)]', '[VAR MOVE(0001)]', '[VAR MOVE(0002)]']
NUMB =

Number var catcher

[nil.to_s, '[VAR NUM1(0000)]', '[VAR NUM1(0001)]']
NUM3 =

Number 3 var catcher

['[VAR NUM3(0000)]', '[VAR NUM3(0001)]', '[VAR NUM3(0002)]']
NUM2 =

Number 2 var catcher

['[VAR NUM2(0000)]', '[VAR NUM2(0001)]', '[VAR NUM2(0002)]', '[VAR NUM2(0003)]']
NUM7R =

Number 7 var catcher regexp

/\[VAR NUM7[^\]]*\]/
NUMXR =

Number x var catcher regexp

/\[VAR NUM.[^\]]*\]/
BERRY =

Berry var catcher

[nil.to_s, nil.to_s, nil.to_s, nil.to_s, nil.to_s, nil.to_s, nil.to_s, '[VAR BERRY(0007)]']
COLOR =

Color var catcher

['[VAR COLOR(0000)]', '[VAR COLOR(0001)]', '[VAR COLOR(0002)]', '[VAR COLOR(0003)]']
LOCATION =

Location var catcher

['[VAR LOCATION(0000)]', '[VAR LOCATION(0001)]', '[VAR LOCATION(0002)]', '[VAR LOCATION(0003)]', '[VAR LOCATION(0004)]']
ABILITY =

Ability var catcher

['[VAR ABILITY(0002)]', '[VAR ABILITY(0001)]', '[VAR ABILITY(0002)]']
KAPHOTICS_Clean =

Kaphotics decoded var clean regexp

/\[VAR [^\]]+\]/
NUMBRNCH_Reg =

/[VAR .[A-Z,()a-z0-9]+]/ Nummeric branch regexp catcher

/\[VAR NUMBRNCH\(....,....\)\][^\[]+/
GENDBR_Reg =

Gender branch regexp catcher

/\[VAR GENDBR\(....,....\)\][^\[]+/
BELL_Reg =

Bell detector

/\[VAR BE05\(([0-9]+)\)\]/
S_Empty =

TODO! Empty string (remove stuff)

nil.to_s
NBSP_B =

Non breaking space '!' detector

/ !/
NBSP_R =

Non breaking space '!' remplacement

' !'
Dot =

Automatic replacement of ... with the correct char

['...', '…']
Money =

Automatic replacement of the $ with a non breaking space $

[' $', ' $']
S_000 =

The \ temporary replacement

"\x00"
GameKeys =

The InGame key name to their key value association

{0 => 'KeyError', 'a' => :A, 'b' => :B, 'x' => :X, 'y' => :Y, 'l' => :L, 'r' => :R, 'l2' => :L2, 'r2' => :R2, 'select' => :SELECT, 'start' => :START, 'l3' => :L3, 'r3' => :R3, 'down' => :DOWN, 'left' => :LEFT, 'right' => :RIGHT, 'up' => :UP, 'home' => :HOME}

Class Method Summary collapse

Class Method Details

.define_const(obj)

Define generic constants adder to an object (Get var catcher easier)

Parameters:

  • obj (Class) —

    the object that will receive constants



60
61
# File 'docs/4_Systems_000_General_1_PFM.rb', line 60

def define_const(obj)
end

.detect_dialog(text)

Detect a dialog text from message and return it instead of text

Parameters:



147
148
# File 'docs/4_Systems_000_General_1_PFM.rb', line 147

def detect_dialog(text)
end

.enemy_pokemon?(pokemon) ⇒ Boolean

Detect if a Pokemon is an enemy Pokemon

Parameters:

Returns:

  • (Boolean)


87
88
# File 'docs/4_Systems_000_General_1_PFM.rb', line 87

def enemy_pokemon?(pokemon)
end

.get_key_name(name) ⇒ String

Return the real keyboard key name

Parameters:

  • name (String) —

    the InGame key name

Returns:

  • (String) —

    the keyboard key name



154
155
# File 'docs/4_Systems_000_General_1_PFM.rb', line 154

def get_key_name(name)
end

.parse(file_id, text_id, additionnal_var = nil) ⇒ String

Parse a text from the text database with specific informations

Parameters:

  • file_id (Integer) —

    ID of the text file

  • text_id (Integer) —

    ID of the text in the file

  • additionnal_var (nil, Hash{String => String}) (defaults to: nil) —

    additional remplacements in the text

Returns:

  • (String) —

    the text parsed and ready to be displayed



67
68
# File 'docs/4_Systems_000_General_1_PFM.rb', line 67

def parse(file_id, text_id, additionnal_var = nil)
end

.parse_additional_variables(text, pokemon, additionnal_var = nil) ⇒ Text

Parse the additional variables from the CSV text

Parameters:

  • text (String) —

    the CSV text to parse

  • pokemon (PFM::Pokemon) —

    pokemon that will introduce an offset on text_id (its name is also used)

  • additionnal_var (nil, Hash{String => String}) (defaults to: nil) —

    additional remplacements in the text

Returns:



82
83
# File 'docs/4_Systems_000_General_1_PFM.rb', line 82

def parse_additional_variables(text, pokemon, additionnal_var = nil)
end

.parse_gendbr(text)

Note:

Sorry for the code, when I did that I wasn't in the "clear" period ^^'

Parse the GENDBR (gender of the player, I didn't see other case)

Parameters:

  • text (String) —

    text that will be parsed



115
116
# File 'docs/4_Systems_000_General_1_PFM.rb', line 115

def parse_gendbr(text)
end

.parse_numbrnch(text)

Note:

Sorry for the code, when I did that I wasn't in the "clear" period ^^'

Parse the NUMBRNCH (pural)

Parameters:

  • text (String) —

    text that will be parsed



110
111
# File 'docs/4_Systems_000_General_1_PFM.rb', line 110

def parse_numbrnch(text)
end

.parse_rest_of_thing(text)

Perform the rest of the automatic parse (factorization)

Parameters:

  • text (String) —

    text that will be parsed



119
120
# File 'docs/4_Systems_000_General_1_PFM.rb', line 119

def parse_rest_of_thing(text)
end

.parse_string_for_messages(text) ⇒ String

Parse a string for a message

Parameters:

  • text (String) —

    the message

Returns:

  • (String) —

    the parsed message



143
144
# File 'docs/4_Systems_000_General_1_PFM.rb', line 143

def parse_string_for_messages(text)
end

.parse_with_2pokemon(file_id, text_id, pokemon1, pokemon2, additionnal_var) ⇒ String

Parse a text from the text database with 2 pokemon & specific information

Parameters:

  • file_id (Integer) —

    ID of the text file

  • text_id (Integer) —

    ID of the text in the file

  • pokemon1 (PFM::Pokemon) —

    pokemon we're talking about

  • pokemon2 (PFM::Pokemon) —

    pokemon who originated the "problem" (eg. bind)

  • additionnal_var (nil, Hash{String => String}) —

    additional remplacements in the text

Returns:

  • (String) —

    the text parsed and ready to be displayed



96
97
# File 'docs/4_Systems_000_General_1_PFM.rb', line 96

def parse_with_2pokemon(file_id, text_id, pokemon1, pokemon2, additionnal_var)
end

.parse_with_pokemon(file_id, text_id, pokemon, additionnal_var = nil) ⇒ String

Parse a text from the text database with specific informations and a pokemon

Parameters:

  • file_id (Integer) —

    ID of the text file

  • text_id (Integer) —

    ID of the text in the file

  • pokemon (PFM::Pokemon) —

    pokemon that will introduce an offset on text_id (its name is also used)

  • additionnal_var (nil, Hash{String => String}) (defaults to: nil) —

    additional remplacements in the text

Returns:

  • (String) —

    the text parsed and ready to be displayed



75
76
# File 'docs/4_Systems_000_General_1_PFM.rb', line 75

def parse_with_pokemon(file_id, text_id, pokemon, additionnal_var = nil)
end

.parse_with_pokemons(file_id, text_id, pokemon, pokemon2, additionnal_var = nil) ⇒ String

Parse a text from the text database with specific informations and two Pokemon

Parameters:

  • file_id (Integer) —

    ID of the text file

  • text_id (Integer) —

    ID of the text in the file

  • pokemon (PFM::Pokemon) —

    pokemon that will introduce an offset on text_id (its name is also used)

  • pokemon2 (PFM::Pokemon) —

    second pokemon that will introduce an offset on text_id (its name is also used)

  • additionnal_var (nil, Hash{String => String}) (defaults to: nil) —

    additional remplacements in the text

Returns:

  • (String) —

    the text parsed and ready to be displayed



105
106
# File 'docs/4_Systems_000_General_1_PFM.rb', line 105

def parse_with_pokemons(file_id, text_id, pokemon, pokemon2, additionnal_var = nil)
end

.reset_variables

Remove every automatic var catcher defined



131
132
# File 'docs/4_Systems_000_General_1_PFM.rb', line 131

def reset_variables
end

.set_ability_name(value, index = 0)

Set the ability name variable

Parameters:

  • value (String, Symbol, Integer, PFM::Pokemon)
  • index (Integer) (defaults to: 0) —

    index of the move variable



179
180
# File 'docs/4_Systems_000_General_1_PFM.rb', line 179

def set_ability_name(value, index = 0)
end

.set_item_name(value, index = 0)

Set the item name variable

Parameters:

  • value (String, Symbol, Integer)
  • index (Integer) (defaults to: 0) —

    index of the item variable



169
170
# File 'docs/4_Systems_000_General_1_PFM.rb', line 169

def set_item_name(value, index = 0)
end

.set_move_name(value, index = 0)

Set the move name variable

Parameters:

  • value (String, Symbol, Integer)
  • index (Integer) (defaults to: 0) —

    index of the move variable



174
175
# File 'docs/4_Systems_000_General_1_PFM.rb', line 174

def set_move_name(value, index = 0)
end

.set_num1(value, index = 1)

Set the number1 variable

Parameters:

  • value (Integer, String)
  • index (Integer) (defaults to: 1) —

    index of the number1 variable



184
185
# File 'docs/4_Systems_000_General_1_PFM.rb', line 184

def set_num1(value, index = 1)
end

.set_num2(value, index = 0)

Set the number2 variable

Parameters:

  • value (Integer, String)
  • index (Integer) (defaults to: 0) —

    index of the number1 variable



189
190
# File 'docs/4_Systems_000_General_1_PFM.rb', line 189

def set_num2(value, index = 0)
end

.set_num3(value, index = 0)

Set the number2 variable

Parameters:

  • value (Integer, String)
  • index (Integer) (defaults to: 0) —

    index of the number1 variable



194
195
# File 'docs/4_Systems_000_General_1_PFM.rb', line 194

def set_num3(value, index = 0)
end

.set_pkname(value, index = 0)

Set the Pokemon Name variable

Parameters:

  • value (String, PFM::Pokemon)
  • index (Integer) (defaults to: 0) —

    index of the pkname variable



159
160
# File 'docs/4_Systems_000_General_1_PFM.rb', line 159

def set_pkname(value, index = 0)
end

.set_pknick(value, index = 0)

Set the Pokemon Nickname variable

Parameters:

  • value (String, PFM::Pokemon)
  • index (Integer) (defaults to: 0) —

    index of the pknick variable



164
165
# File 'docs/4_Systems_000_General_1_PFM.rb', line 164

def set_pknick(value, index = 0)
end

.set_plural(value_or_index = true, value = true)

Set the numbranches to plural state

Parameters:

  • value_or_index (Integer, Boolean) (defaults to: true) —

    the value for all branch or the index you want to set in pural

  • value (Boolean) (defaults to: true) —

    the value when you choosed an index



136
137
# File 'docs/4_Systems_000_General_1_PFM.rb', line 136

def set_plural(value_or_index = true, value = true)
end

.set_variable(expr, value)

Define an automatic var catcher with its value

Parameters:

  • expr (String, Regexp) —

    the var catcher that is replaced by the value

  • value (String) —

    the value that replace the expr



124
125
# File 'docs/4_Systems_000_General_1_PFM.rb', line 124

def set_variable(expr, value)
end

.unset_variable(expr)

Remove an automatic var catcher with its value

Parameters:

  • expr (String, Regexp) —

    the var catcher that is replaced by a value



128
129
# File 'docs/4_Systems_000_General_1_PFM.rb', line 128

def unset_variable(expr)
end