You will see, I want to create a file type ".rvdata2" with RPG Game Maker VX Ace (it has been said that for security reasons that type of file is better) in which you can write and save data in that file by order of events in the game so that later this information can be requested and read when I go it is required through a Script call.
Through the forums I researched and was manipulating the File Class: I know how to create the file but the question is how to know if something printed on the file to be consulted at any point of the game, for example: a variable. how to write a variable (and its value) in that file and then consult it.
I tried to do something for me and I ended up getting confused on how to configure the script correctly.
I appreciate your help advice, thanks.
this is my code.
Code:
module CreateFile
File.open("MyNumber.rvdata2", "w+") do |file|
Marshal.dump("Test", file)
end
end
module MyVariable
Variables = [1]
end
class Game_Variables
alias initialize_defvars initialize
def initialize(*a,&bl)
initialize_defvars(*a,&bl)
File.foreach("MyNumber.rvdata2") do |vardata|
MyVariable::Variables.each do |id| @data[id] = vardata.to_i
end
end
end
end