Class: WolfRpg::Command
- Inherits:
-
Object
- Object
- WolfRpg::Command
- Defined in:
- lib/wolfrpg/command.rb
Direct Known Subclasses
AutoInput, BanInput, Blank, BranchEnd, BreakEvent, BreakLoop, CancelCase, ChangeColor, Checkpoint, Chip, ChipOverwrite, ChipSet, ChoiceCase, Choices, ClearDebugText, Comment, CommonEvent, CommonEventByName, CommonEventReserve, Database, DebugMessage, Effect, ElseCase, EndGame, EraseEvent, ExecuteTransition, ForceStopMessage, ImportDatabase, InputKey, JumpLabel, LoadGame, LoopEnd, LoopTimes, LoopToStart, MapEffect, Message, Move, MoveDuringEventOff, MoveDuringEventOn, Party, Picture, PrepareTransition, ResumeNonPic, ReturnToTitle, SaveGame, SaveLoad, ScrollScreen, SetLabel, SetString, SetTransition, SetVariable, SetVariableEx, Sound, SpecialChoiceCase, StartLoop, StopNonPic, StringCondition, Teleport, VariableCondition, Wait, WaitForMove
Defined Under Namespace
Classes: AutoInput, BanInput, Blank, BranchEnd, BreakEvent, BreakLoop, CancelCase, ChangeColor, Checkpoint, Chip, ChipOverwrite, ChipSet, ChoiceCase, Choices, ClearDebugText, Comment, CommonEvent, CommonEventByName, CommonEventReserve, Database, DebugMessage, Effect, ElseCase, EndGame, EraseEvent, ExecuteTransition, ForceStopMessage, ImportDatabase, InputKey, JumpLabel, LoadGame, LoopEnd, LoopTimes, LoopToStart, MapEffect, Message, Move, MoveDuringEventOff, MoveDuringEventOn, Party, Picture, PrepareTransition, ResumeNonPic, ReturnToTitle, SaveGame, SaveLoad, ScrollScreen, SetLabel, SetString, SetTransition, SetVariable, SetVariableEx, Sound, SpecialChoiceCase, StartLoop, StopNonPic, StringCondition, Teleport, VariableCondition, Wait, WaitForMove
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#cid ⇒ Object
readonly
Returns the value of attribute cid.
-
#indent ⇒ Object
readonly
Returns the value of attribute indent.
-
#string_args ⇒ Object
readonly
Returns the value of attribute string_args.
Class Method Summary collapse
-
.create(coder) ⇒ Object
Load from the file and create the appropriate class object.
Instance Method Summary collapse
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
8 9 10 |
# File 'lib/wolfrpg/command.rb', line 8 def args @args end |
#cid ⇒ Object (readonly)
Returns the value of attribute cid.
7 8 9 |
# File 'lib/wolfrpg/command.rb', line 7 def cid @cid end |
#indent ⇒ Object (readonly)
Returns the value of attribute indent.
10 11 12 |
# File 'lib/wolfrpg/command.rb', line 10 def indent @indent end |
#string_args ⇒ Object (readonly)
Returns the value of attribute string_args.
9 10 11 |
# File 'lib/wolfrpg/command.rb', line 9 def string_args @string_args end |
Class Method Details
.create(coder) ⇒ Object
Load from the file and create the appropriate class object
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 |
# File 'lib/wolfrpg/command.rb', line 376 def self.create(coder) # Read all data for this command from file args = Array.new(coder.read_byte - 1) cid = coder.read_int args.each_index do |i| args[i] = coder.read_int end indent = coder.read_byte string_args = Array.new(coder.read_byte) string_args.each_index do |i| string_args[i] = coder.read_string end # Read the move list if necessary terminator = coder.read_byte if terminator == 0x01 return Command::Move.new(cid, args, string_args, indent, coder) elsif terminator != 0x00 raise "command terminator is an unexpected value (#{terminator})" end # Create command return CID_TO_CLASS[cid].new(cid, args, string_args, indent) end |
Instance Method Details
#dump(coder) ⇒ Object
401 402 403 404 405 406 407 408 409 410 411 412 413 414 |
# File 'lib/wolfrpg/command.rb', line 401 def dump(coder) coder.write_byte(@args.size + 1) coder.write_int(@cid) @args.each do |arg| coder.write_int(arg) end coder.write_byte(indent) coder.write_byte(@string_args.size) @string_args.each do |arg| coder.write_string(arg) end dump_terminator(coder) end |