Printing or exporting event code.

alphawiz

Veteran
Veteran
Joined
Feb 8, 2017
Messages
67
Reaction score
10
First Language
English
Primarily Uses
RMMV
Here's my situation. I'm using a rather long common event from a posted demo from somewhere as the basis for a minigame I'm putting in my game. (all permitted by the author)

However, like I said, it's quite long, and I need to make a lot of edits, as well as put in my own code where it's needed so that it interacts with certain switches etc. I could go line by line and make those changes, (mostly replacing variables since those var id's are already used elsewhere) but after a while it gets repetitive and easy to lose track of where I am. So I have to reload the original demo, double check myself, then reload my project, scroll down (would love it if there were a search function in a future release of MV that would allow us to locate code or comment in an event--or better yet search and replace) :) Anyway, you get the picture.

Is there a way (or program, I'm not picky) that allows me to copy and paste or export the code to a text file or something so I can have a written copy to refer to, make notes on as to variable names etc? Or am I stuck with doing a line by line change?
 

Hyouryuu-Na

Sapphire Sodium
Veteran
Joined
Jun 15, 2017
Messages
947
Reaction score
2,213
First Language
Not English
Primarily Uses
RMMV
You can make bulk find/replace from the json files in the data folder. Since it's a common event, it should be the CommonEvents.json file. Make sure to keep a backup in case you mess up. You can try the online json beautifier sites to make it easier to read.
 

alphawiz

Veteran
Veteran
Joined
Feb 8, 2017
Messages
67
Reaction score
10
First Language
English
Primarily Uses
RMMV
@Hyouryuu-Na I've actually tried that. The problem is that the json files are primarily just a bunch of numbers and stuff I do not recognize.
code, indent, parameters. Nothing to (obviously, at least) indicate what is an if statement, a variable assignment, values assigned to that variable etc.

I'm willing to give it a shot but that leads to the question of how do I decode what is actually in the JSON file? If it were just a matter of making text edits, I could do that easily. I'm talking about editing the code. and variables.
 

Hyouryuu-Na

Sapphire Sodium
Veteran
Joined
Jun 15, 2017
Messages
947
Reaction score
2,213
First Language
Not English
Primarily Uses
RMMV
I thought you just wanted to change values? It's easy to find and replace values directly in the json file then doing it manually.
I went ahead and did a test.
This is a test common event:
1602957206730.png
This is the json file:
JSON:
[
null,
{"id":1,"list":[{"code":122,"indent":0,"parameters":[2,2,0,0,10]},{"code":121,"indent":0,"parameters":[1,1,0]},{"code":111,"indent":0,"parameters":[0,1,0]},{"code":355,"indent":1,"parameters":["\"I'm a script\""]},{"code":0,"indent":1,"parameters":[]},{"code":412,"indent":0,"parameters":[]},{"code":0,"indent":0,"parameters":[]}],"name":"","switchId":1,"trigger":0}
]
So matching them... code 122 is variable assignment, code 121 is switch assignment, code 111 is conditional branch and code 355 is script call... probably.

I think it would just be better to do it manually than trying to understand these stuff.
 

alphawiz

Veteran
Veteran
Joined
Feb 8, 2017
Messages
67
Reaction score
10
First Language
English
Primarily Uses
RMMV
code":122,"indent":0,"parameters":[2,2,0,0,10]}
Actually, in this instance what I'm trying to do is change which variable itself is called.
In your example, the variable id is 2, but there are 2 2's in the parameters. Any idea which, or both would need changing?

Anybody happen to know if there's a RMMV JSON file reference somewhere?
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,085
Members
137,585
Latest member
Reversinator
Top