13 days ago

Here is a tutorial on how to make your own settings in the Game.ini file and calling them in an event with script calls in VXAce.


tutorial.png

The Game.ini file contains configuration stuff that the rpg maker engine uses. You can see in this screenshot I already put two settings of my own here.

The first one, SkipCutscene, returns a number.
The second one, Codename, returns some text.

tutorial2.png

Here is what to do if you want to call a number:

First open the Game.ini file and write in the SkipCutscene=1 line of the screenshot, or whatever else you want your setting to be called.

next open the script editor in your game project.

Paste GAME_INI_ENTRY = /^SkipCutscene=(.+)$/ anywhere as long as it isnt under a class. This will be the name of the setting you want to check. The funny symbols around it are regex, which tell the game how to read this text. This is often used in other scripts to read code in notes or comments.

tutorial2.png

Now go to Game_Interpreter and paste in this:

def skip_cutscene

saved_num = nil

File.open('Game.ini') { |f|

f.each_line { |l|

next unless l.valid_encoding?

GAME_INI_ENTRY.match(l) { |m|

saved_num = m[1].to_i

break

}

}

}

return saved_num rescue 0

end

This opens the Game.ini file and looks through each line, skips any it can't properly read, (like text with ä, ö or ü letters),
and looks for any matches with the GAME_INI_ENTRY text.

If it does find a match, it saves it in the saved_num variable and turns it into an Integer. (basically a number with no decimals.)

Then it saves the number in the saved_num variable. If it gets nothing, it simply returns a 0.

Considering this tutorial is about how to make all of this happen through a script call, this code has to be put in the Game_Interpreter class, so that one can simply call the method name.

Like this:

tutorial2.png

Here in $game_variables[1] = skip_cutscene the returned number of the skip_cutscene method gets saved in a variable.

Then a conditional branch checks if the variable is 0. If not, it will skip that inside the conditional branch entirely.

If you want to make it get text instead, do this:

Paste GAME_INI_NAME = /^Codename=(.+)$/ just like in the previous example.

Open the Game.ini file and write in
Codename=Deleted Donut or whatever else you want it to be called.

Next inside the Game_Interpreter class:

def get_codename

saved_name = nil

File.open('Game.ini') { |f|

f.each_line { |l|

next unless l.valid_encoding?

GAME_INI_NAME.match(l) { |m|

saved_name = m[1].to_s

break

}

}

}

return saved_name rescue ""

end

This pretty much does the same thing as the number code, except turning the end result into a string.

An example for using this method is this:

tutorial2.png
unnamedteext.png

And now an event read text out of the game.ini file.

#rpgmaker #rpgmakervxace #scripting #ruby #rgss3 #rgss



4 comments

Loading...

Next up

Okay, here's some gameplay and the love interest prepared for Y/N.

Walking through the streets.

Battle background, this time of a cave

#pixelart #rpgmaker

Winged wolf.

Sorry about being quiet all week. I pulled the trigger on working on the card minigame for Somewhen. It's a nice break from working on the main scenario and battle/town-building system(s).

Fullversion released on itch.io. Costs 9.99€. Will be released on gamejolt too once my marketplace account gets approved. (which could take a really long time)

https://ninjachicle.itch.io/animalistic-worlds

i got an idea

Updated demo to have some more features of the fullversion.