
Impariamo a conoscere gli Script di default
Nome Script: Game_Switch
Descrizione:
Questa classe contiene gli switch di gioco e i metodi per l'assegnazione 'data' di questi 'interruttori'
#============================================================================== # ** Game_Switches #------------------------------------------------------------------------------ # This class handles switches. It's a wrapper for the built-in class "Array." # Refer to "$game_switches" for the instance of this class. #============================================================================== class Game_Switches #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize @data = [] end #-------------------------------------------------------------------------- # * Get Switch # switch_id : switch ID #-------------------------------------------------------------------------- def [](switch_id) if switch_id <= 5000 and @data[switch_id] != nil return @data[switch_id] else return false end end #-------------------------------------------------------------------------- # * Set Switch # switch_id : switch ID # value : ON (true) / OFF (false) #-------------------------------------------------------------------------- def []=(switch_id, value) if switch_id <= 5000 @data[switch_id] = value end end end
Proprietà:
Data
L'Array delle switch di gioco.
Contiene 5000 variabili booleane *_*
Metodi:
Initialize
Come funziona:
Inizializza un array switch da 'mandare' ad un array vuoto.
[]
Switch_ID: L'indice array dello switch da restituire.
[]=
Switch_ID: L'indice array dello switch da impostare
Valore: Valore booleano che rappresenta il valore da assegnare a questa switch
Come funziona:
Questo metodo imposta il valore corrente associata agli Switch ID.
Se il valore è 5000 o meno,la switch è settata su questo valore.
In caso contrario,il metodo non fa nulla perchè la Switch_ID non è valida.













