Class: Game_Switches
- Defined in:
- scripts/00600 Script_RMXP/00100 Event_Living_Data.rb
Overview
Class describing game switches (events)
Class Method Summary collapse
-
._load(args)
Loading game switches from the save file.
Instance Method Summary collapse
-
#_dump(_level = 0)
Converting game switches to bits.
-
#initialize ⇒ Game_Switches
constructor
Default initialization of game switches.
Constructor Details
#initialize ⇒ Game_Switches
Default initialization of game switches
4 5 6 7 8 9 10 |
# File 'scripts/00600 Script_RMXP/00100 Event_Living_Data.rb', line 4 def initialize if $data_system super($data_system.switches.size, false) else super(200, false) end end |
Class Method Details
._load(args)
Loading game switches from the save file
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'scripts/00600 Script_RMXP/00100 Event_Living_Data.rb', line 32 def self._load(args) var = Game_Switches.new args.size.times do |i| index = i * 8 number = args.getbyte(i) var[index] = (number[0] == 1) var[index + 1] = (number[1] == 1) var[index + 2] = (number[2] == 1) var[index + 3] = (number[3] == 1) var[index + 4] = (number[4] == 1) var[index + 5] = (number[5] == 1) var[index + 6] = (number[6] == 1) var[index + 7] = (number[7] == 1) end return var end |
Instance Method Details
#_dump(_level = 0)
Converting game switches to bits
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'scripts/00600 Script_RMXP/00100 Event_Living_Data.rb', line 13 def _dump(_level = 0) gsize = (size / 8 + 1) str = "\x00" * gsize gsize.times do |i| index = i * 8 number = self[index] ? 1 : 0 number |= 2 if self[index + 1] number |= 4 if self[index + 2] number |= 8 if self[index + 3] number |= 16 if self[index + 4] number |= 32 if self[index + 5] number |= 64 if self[index + 6] number |= 128 if self[index + 7] str.setbyte(i, number) end return str end |