- Joined
- Mar 17, 2012
- Messages
- 1,220
- Reaction score
- 152
- Primarily Uses
If you would still like to discuss the potential merits and disadvantages of using the proposed expansion of $imported, or if you'd like to suggest new key/value pairs one could use, click or tap here.
This topic is in some way a response to estriole's reply about the way Victor Sant handles version storage and script dependencies, which is actually a brilliant way to go about it.
Introduction
The purpose behind $imported[:SCRIPT_LIST] is to enhance the recently proposed expansion of $imported. If this were to be adopted by the community along with the latter, a scripter could have more options at their disposal to check for compatibility with other scripts. Users and scripters alike would also have access to a reliable, robust, and perhaps standard way of looking through the list of community-made scripts in the order in which they were installed into the project.
Scripters would be able to utilize $imported[:SCRIPT_LIST] as a means to check for dependencies, to determine whether certain scripts were installed in what they would consider the correct order, and provide solutions based on the result of those conditions. They may also use the data provided within their or another script's personal $imported key to alert the end-user on any potential conflicts that may arise, perhaps due to methods in certain classes being overwritten. Essentially, this alongside the proposed way of writing $imported could make troubleshooting easier for both the scripter and the average RM user.
Implementation
Here is a quick (and ideal) demonstration of how expanded $imported and $imported[:SCRIPT_LIST] would work.
* Any key/value pairs used in any of the following examples are not final and shouldn't be used in a script yet. You can provide suggestions for that in the Improving $imported thread.
Example
The idea is that if more scripts were to use $imported in this form and and if they pushed their information onto the $imported[:SCRIPT_LIST] array, we can begin to read them in the order they were placed onto the script list.
Here's another example. This time with four other scripts. Try not to mind the barebones information that's being provided here. I'm trying to show a small taste of what one could do with that data.
Multiple scripts + Print example
Script 2
Script 3
Script 4
A quick and dirty result Print.
Result
While the above example is underwhelming, there are a lot of (advanced) things that could be done with this. So what do you guys think? Do you like it? Not like it? Think it needs refining? Have any questions or suggestions? Got a better name we could use than :SCRIPT_LIST? Post your thoughts!
This topic is in some way a response to estriole's reply about the way Victor Sant handles version storage and script dependencies, which is actually a brilliant way to go about it.
Introduction
The purpose behind $imported[:SCRIPT_LIST] is to enhance the recently proposed expansion of $imported. If this were to be adopted by the community along with the latter, a scripter could have more options at their disposal to check for compatibility with other scripts. Users and scripters alike would also have access to a reliable, robust, and perhaps standard way of looking through the list of community-made scripts in the order in which they were installed into the project.
Scripters would be able to utilize $imported[:SCRIPT_LIST] as a means to check for dependencies, to determine whether certain scripts were installed in what they would consider the correct order, and provide solutions based on the result of those conditions. They may also use the data provided within their or another script's personal $imported key to alert the end-user on any potential conflicts that may arise, perhaps due to methods in certain classes being overwritten. Essentially, this alongside the proposed way of writing $imported could make troubleshooting easier for both the scripter and the average RM user.
Implementation
Here is a quick (and ideal) demonstration of how expanded $imported and $imported[:SCRIPT_LIST] would work.
* Any key/value pairs used in any of the following examples are not final and shouldn't be used in a script yet. You can provide suggestions for that in the Improving $imported thread.
Example
# Assign $imported as a hash if it's nil, store information about the script.($imported ||= {})[:username_scriptname] = { :name => 'Script Name', :version => '1.0.1', :author => ['Username'], :date => '2014-07-21', :id => :username_scriptname, :enabled => true, :aliased => ['Scene_Title#create_background', 'Scene_Title#create_foreground', 'Scene_Title#dispose_background', 'Scene_Title#dispose_foreground']}# Assign $imported[:SCRIPT_LIST] as array, push script info($imported[:SCRIPT_LIST] ||= []) << $imported[:username_scriptname]
Here's another example. This time with four other scripts. Try not to mind the barebones information that's being provided here. I'm trying to show a small taste of what one could do with that data.
Multiple scripts + Print example
Script 1
# Assign $imported as a hash if it's nil, store information about the script.($imported ||= {})[:username_hello_world] = { :name => 'Hello World', :version => '1.0.0', :author => ['Username'], :date => '2014-07-21', :id => :username_hello_world, :enabled => true}# Assign $imported[:SCRIPT_LIST] as array if nil, push script info onto it.($imported[:SCRIPT_LIST] ||= []) << $imported[:username_hello_world]
# Assign $imported as a hash if it's nil, store information about the script.($imported ||= {})[:username_hello_world] = { :name => 'Hello World', :version => '1.0.0', :author => ['Username'], :date => '2014-07-21', :id => :username_hello_world, :enabled => true}# Assign $imported[:SCRIPT_LIST] as array if nil, push script info onto it.($imported[:SCRIPT_LIST] ||= []) << $imported[:username_hello_world]
# Assign $imported as a hash if it's nil, store information about the script.($imported ||= {})[:username_pause] = { :name => 'Pause Script', :version => '1.5.0', :author => ['Username'], :date => '2008-12-25', :id => :username_pause, :enabled => true}# Assign $imported[:SCRIPT_LIST] as array if nil, push script info onto it.($imported[:SCRIPT_LIST] ||= []) << $imported[:username_pause]
# Assign $imported as a hash if it's nil, store information about the script.($imported ||= {})[:username_inventory_caps] = { :name => 'Inventory Caps', :version => '1.3.2', :author => ['Username'], :date => '2011-08-23', :id => :username_inventory_caps, :enabled => true}# Assign $imported[:SCRIPT_LIST] as array if nil, push script info onto it.($imported[:SCRIPT_LIST] ||= []) << $imported[:username_inventory_caps]
# Assign $imported as a hash if it's nil, store information about the script.($imported ||= {})[:username_platformer] = { :name => 'Platformer', :version => '1.2.0', :author => ['Username'], :date => '2010-04-12', :id => :username_platformer, :enabled => true}# Assign $imported[:SCRIPT_LIST] as array if nil, push script info onto it.($imported[:SCRIPT_LIST] ||= []) << $imported[:username_platformer]
$imported[:SCRIPT_LIST] ||= []str = ''$imported[:SCRIPT_LIST].each { |i| str += "#{i[:name]} v#{i[:version]} \n"}print str
While the above example is underwhelming, there are a lot of (advanced) things that could be done with this. So what do you guys think? Do you like it? Not like it? Think it needs refining? Have any questions or suggestions? Got a better name we could use than :SCRIPT_LIST? Post your thoughts!
Last edited by a moderator:
