- Joined
- Jan 9, 2022
- Messages
- 809
- Reaction score
- 970
- First Language
- English
- Primarily Uses
- RMMZ
Hello, everyone. I put this in MZ Support because I wasn't sure if this might be engine specific. I don't think it is, but I wasn't positive since I don't know much about Java Script, Scripting, or how the different engines work.
In a variety of threads, I have seen passing references to instances where how you do something with Scripts in Events might not be saved in a Save Game file. But I haven't completely understood how to know when that might be an issue.
I could be completely wrong, but I think I understood that depending on how you make a Variable with a Script will depend on whether that is a "temporary" variable (sorry, don't remember the proper term) that will only last while that script is running or a more "permanent" variable (global?).
I also got the impression that the same might be true with creating arrays and objects.
So, my fear is that I will use a Script to achieve what I want for what I am currently testing, without realizing that if I tested the same Event in an actual game that needs to be saved, it might not do what it does in the simple Play Test of that singular Event.
I also get the impression, perhaps completely incorrectly, that sometimes when suggestions are offered to help, they might not automatically differentiate whether the variable/array/object that is being created needs to be kept for future reference and reuse or it is an Event/script only need.
I know that I never think to clarify that when I am asking questions...mostly because I didn't even know it was an issue until I saw it mentioned somewhere.
I think I have seen things mentioning "let" and "const" as examples. From a quick search, it seemed like both of those are "temporary" and not "global", but I could be wrong.
I'm not sure if I am explaining this correctly.
Am I completely confused about this?
If not, are there any simple rules I can try to remember about using scripts to work with Variables, Arrays, Objects, Switches, or anything else to tell whether those will be stored in a way that is accessible later and will be saved in a Saved Game?
I apologize if this is an ignorant question...meaning uninformed and lacking general awareness...but in many regards...I am very much uninformed about how things work with Java Script and MZ!
Thanks for any help you can provide to assist me in hopefully understanding this better (correctly) and saving it for repeated reference.
In a variety of threads, I have seen passing references to instances where how you do something with Scripts in Events might not be saved in a Save Game file. But I haven't completely understood how to know when that might be an issue.
I could be completely wrong, but I think I understood that depending on how you make a Variable with a Script will depend on whether that is a "temporary" variable (sorry, don't remember the proper term) that will only last while that script is running or a more "permanent" variable (global?).
I also got the impression that the same might be true with creating arrays and objects.
So, my fear is that I will use a Script to achieve what I want for what I am currently testing, without realizing that if I tested the same Event in an actual game that needs to be saved, it might not do what it does in the simple Play Test of that singular Event.
I also get the impression, perhaps completely incorrectly, that sometimes when suggestions are offered to help, they might not automatically differentiate whether the variable/array/object that is being created needs to be kept for future reference and reuse or it is an Event/script only need.
I know that I never think to clarify that when I am asking questions...mostly because I didn't even know it was an issue until I saw it mentioned somewhere.
I think I have seen things mentioning "let" and "const" as examples. From a quick search, it seemed like both of those are "temporary" and not "global", but I could be wrong.
I'm not sure if I am explaining this correctly.
Am I completely confused about this?
If not, are there any simple rules I can try to remember about using scripts to work with Variables, Arrays, Objects, Switches, or anything else to tell whether those will be stored in a way that is accessible later and will be saved in a Saved Game?
I apologize if this is an ignorant question...meaning uninformed and lacking general awareness...but in many regards...I am very much uninformed about how things work with Java Script and MZ!
Thanks for any help you can provide to assist me in hopefully understanding this better (correctly) and saving it for repeated reference.