DICE2000 / rvdata2json

interconvert rvdata/rvdata2 and json
26 stars 9 forks source link

RPG::MoveCommand Problem #3

Closed Shisaye closed 9 months ago

Shisaye commented 1 year ago

Even after making no changes to the json at all, "to_rvdata2.rb" seems to be unable to write Move Route events correctly. Starting with a an entry that looks like this in the Ace editor:

@>Set Move Route: Player (Wait)
:               :$>Change Speed: 4

After using "to_json2.rb" and then "to_rvdata2.rb" it is now being displayed as:

@>Set Move Route: Player
:               :$>Change Speed: 4

If I try to edit it in the editor, the field below Player is empty, not showing the Change Speed event, and if I try to add the "Wait for Completion" flag again it throws this error:

Internal error.
Script '(eval)' line 1: NoMethodError occurred.

undefined method 'wait=' for#<Hash:0xa6903c0>

The entire section in the Json after converting the Commonevents.rvdata2 with "to_json2.rb", including two other Set Move Route entries that become broken, looks like this:

{"json_class":"RPG::CommonEvent","@trigger":0,"@name":"歩行速度チェック","@switch_id":1,"@list":[{"json_class":"RPG::EventCommand","@indent":0,"@code":111,"@parameters":[1,91,0,1,0]},{"json_class":"RPG::EventCommand","@indent":1,"@code":205,"@parameters":[-1,{"json_class":"RPG::MoveRoute","@repeat":false,"@skippable":false,"@wait":true,"@list":[{"json_class":"RPG::MoveCommand","@code":29,"@parameters":[4]},{"json_class":"RPG::MoveCommand","@code":0,"@parameters":[]}]}]},{"json_class":"RPG::EventCommand","@indent":1,"@code":505,"@parameters":[{"json_class":"RPG::MoveCommand","@code":29,"@parameters":[4]}]},{"json_class":"RPG::EventCommand","@indent":1,"@code":121,"@parameters":[28,28,1]},{"json_class":"RPG::EventCommand","@indent":1,"@code":355,"@parameters":["$game_variables[92]  = \"normal\""]},{"json_class":"RPG::EventCommand","@indent":1,"@code":122,"@parameters":[91,91,0,0,1]},{"json_class":"RPG::EventCommand","@indent":1,"@code":0,"@parameters":[]},{"json_class":"RPG::EventCommand","@indent":0,"@code":412,"@parameters":[]},{"json_class":"RPG::EventCommand","@indent":0,"@code":111,"@parameters":[1,91,0,2,0]},{"json_class":"RPG::EventCommand","@indent":1,"@code":205,"@parameters":[-1,{"json_class":"RPG::MoveRoute","@repeat":false,"@skippable":false,"@wait":true,"@list":[{"json_class":"RPG::MoveCommand","@code":29,"@parameters":[5]},{"json_class":"RPG::MoveCommand","@code":0,"@parameters":[]}]}]},{"json_class":"RPG::EventCommand","@indent":1,"@code":505,"@parameters":[{"json_class":"RPG::MoveCommand","@code":29,"@parameters":[5]}]},{"json_class":"RPG::EventCommand","@indent":1,"@code":121,"@parameters":[28,28,1]},{"json_class":"RPG::EventCommand","@indent":1,"@code":355,"@parameters":["$game_variables[92]  = \"dash\""]},{"json_class":"RPG::EventCommand","@indent":1,"@code":122,"@parameters":[91,91,0,0,2]},{"json_class":"RPG::EventCommand","@indent":1,"@code":0,"@parameters":[]},{"json_class":"RPG::EventCommand","@indent":0,"@code":412,"@parameters":[]},{"json_class":"RPG::EventCommand","@indent":0,"@code":111,"@parameters":[1,91,0,3,0]},{"json_class":"RPG::EventCommand","@indent":1,"@code":205,"@parameters":[-1,{"json_class":"RPG::MoveRoute","@repeat":false,"@skippable":false,"@wait":true,"@list":[{"json_class":"RPG::MoveCommand","@code":29,"@parameters":[6]},{"json_class":"RPG::MoveCommand","@code":0,"@parameters":[]}]}]},{"json_class":"RPG::EventCommand","@indent":1,"@code":505,"@parameters":[{"json_class":"RPG::MoveCommand","@code":29,"@parameters":[6]}]},{"json_class":"RPG::EventCommand","@indent":1,"@code":121,"@parameters":[28,28,0]},{"json_class":"RPG::EventCommand","@indent":1,"@code":355,"@parameters":["$game_variables[92]  = \"spurt\""]},{"json_class":"RPG::EventCommand","@indent":1,"@code":122,"@parameters":[91,91,0,0,3]},{"json_class":"RPG::EventCommand","@indent":1,"@code":0,"@parameters":[]},{"json_class":"RPG::EventCommand","@indent":0,"@code":412,"@parameters":[]},{"json_class":"RPG::EventCommand","@indent":0,"@code":0,"@parameters":[]}],"@id":142},
DICE2000 commented 9 months ago

mix5003 who may have reported the same bug sent me a pull request, so I have merged it. Please check it out.

Shisaye commented 9 months ago

I've tested it again and that seems to have resolved the issue completely. Thank you.