- Joined
- Nov 10, 2020
- Messages
- 22
- Reaction score
- 2
- First Language
- English
- Primarily Uses
- RMXP
Did that, but now the GlobalVar file isn't being created when it should be, and Global Variables aren't read from the file either ... Loading a save resets the variables to whatever they were on the save file.
No Error messages this time.
Code:
module GlobalVar
@@global_variable_data = nil
def self.save
@@global_variable_data = $game_variables.global_variables
file = File.open('GlobalVar.rxdata', 'wb')
Marshal.dump(@@global_variable_data, file)
file.close
end
def self.load
return @@global_variable_data unless @@global_variable_data.nil?
file = File.open('GlobalVar.rxdata', 'rb')
@@global_variable_data = Marshal.load(file)
file.close
@@global_variable_data
end
def self.exist?
File.exist?('GlobalVar.rxdata')
end
end
No Error messages this time.