It is common practice in RM scripting to take advantage of note-tags and event comments as a means of accepting user input, or providing some way to enter this data in the script (as part of the configuration).
An issue I've noticed with several scripts is that they do not support dynamically created objects, for example if you create an event and put it on the map, or you capture an enemy and add it to the party as dynamically created actor.
The problem is due to the way the data is parsed: they assume all data is created on load-time.
For example, many scripts I have seen load object notetags such:
module DataManager alias 😮ld_load_db :load_database def load_database old_load_db $data_weapons.each do |weapon| weapon.load_my_notetags end endendThis method is called only once when the game starts up, so if you were using scripts that created new objects (and not simply re-using existing database objects via referencing), the new objects will not load any note-tags or comments.What are some ways to address this issue?
Some may not see this as an issue at all, but if your script does not support dynamic objects, then you automatically have something to write in your list of compatibility issues.
One solution is to use lazy loading, which initializes the data if necessary whenever it is accessed. This is an effective way to handle the problem because it doesn't matter how many different note-tag loading methods are available, they will always be called if the data has not been initialized.
Problems with this include initialization time: if it takes too long to load the data, players will notice the delay.
If you are working with external database systems, it may be better to query for all data at once rather than making separate queries one at a time.
Another solution is to define a new data parsing interface that provides a `load_notetags` or `load_comments` method.
class RPG::BaseItem # this would be defined in all classes with a note-box. def load_notetags endendOther scripts would alias the load_notetags method and call their own note-tag loading logic.Then in your scripts, you would make sure that anytime an object is created, you call the load_notetags method so that all of the required note-tags are loaded.
This requires more coordination on ALL scripters' parts, and would require all existing scripts to be changed, which is impractical.
An issue I've noticed with several scripts is that they do not support dynamically created objects, for example if you create an event and put it on the map, or you capture an enemy and add it to the party as dynamically created actor.
The problem is due to the way the data is parsed: they assume all data is created on load-time.
For example, many scripts I have seen load object notetags such:
module DataManager alias 😮ld_load_db :load_database def load_database old_load_db $data_weapons.each do |weapon| weapon.load_my_notetags end endendThis method is called only once when the game starts up, so if you were using scripts that created new objects (and not simply re-using existing database objects via referencing), the new objects will not load any note-tags or comments.What are some ways to address this issue?
Some may not see this as an issue at all, but if your script does not support dynamic objects, then you automatically have something to write in your list of compatibility issues.
One solution is to use lazy loading, which initializes the data if necessary whenever it is accessed. This is an effective way to handle the problem because it doesn't matter how many different note-tag loading methods are available, they will always be called if the data has not been initialized.
Problems with this include initialization time: if it takes too long to load the data, players will notice the delay.
If you are working with external database systems, it may be better to query for all data at once rather than making separate queries one at a time.
Another solution is to define a new data parsing interface that provides a `load_notetags` or `load_comments` method.
class RPG::BaseItem # this would be defined in all classes with a note-box. def load_notetags endendOther scripts would alias the load_notetags method and call their own note-tag loading logic.Then in your scripts, you would make sure that anytime an object is created, you call the load_notetags method so that all of the required note-tags are loaded.
This requires more coordination on ALL scripters' parts, and would require all existing scripts to be changed, which is impractical.