Home > RGSS Script Reference > Game_SelfSwitches
Game_SelfSwitches
Inherits from: None
Description: This class holds the local switches associated with events and methods for setting and getting the values of local switches.
class Game_SelfSwitches
# ------------------------------------
def initialize
@data = {}
end
# ------------------------------------
def [](key)
return @data[key] == true ? true : false
end
# ------------------------------------
def []=(key, value)
@data[key] = value
end
end
|
Data: A hash table of local switches. The keys are arrays of format [A, B, C], where A is the map ID of the event, B is the event ID, and C is the letter of the local switch.
Initialize
Arguments: None
Local Variables: None
How it Works: Initializes the hash table of local switches to an empty hash table.
[]
Arguments:
Key: The hash table key of the local switch to return.
Local Variables: None
How it Works: This method returns the current value associated with the hash table key passed to it if the key exists. If the key doesn't exist, the method returns false.
[]=
Arguments:
Key: The hash table key of the switch to set.
Value: A boolean representing the value to assign to that switch.
Local Variables: None
How it Works: This method set the current value associated with the key passed to it to the value passed to the method.
|
|