I'm trying to execute a script whose name is known at runtime. So far the only way I know to do this is by saying
but there's a problem. I want to pass some information to this script. So far I've come up with two similar ways to do this, but I'd like to know if anyone knows another method.
The first way is to store this data in some KoLmafia properties. The called script imports the original script, which loads these properties into some global variables, which the called script can use. This works well but spams the CLI quite a bit.
The second way is to use file_to_map() and map_to_file() to do the same thing. However, I am concerned that this might do some harm to users with SSDs, since this script will be called quite a bit. However, if set_property and get_property write to disk as well, I guess this is preferable?
I had thought of using static variables, but apparently they are static only to the scope of the main executing script. If script1 imports script2 with a static variable, script1 gets its own copy of the variable.
I've also tried doing
, but this doesn't work either because paramString contains semicolons which mess up the argument passing.
Does anyone know any other ways?
Code:
cli_execute(filename);
but there's a problem. I want to pass some information to this script. So far I've come up with two similar ways to do this, but I'd like to know if anyone knows another method.
The first way is to store this data in some KoLmafia properties. The called script imports the original script, which loads these properties into some global variables, which the called script can use. This works well but spams the CLI quite a bit.
The second way is to use file_to_map() and map_to_file() to do the same thing. However, I am concerned that this might do some harm to users with SSDs, since this script will be called quite a bit. However, if set_property and get_property write to disk as well, I guess this is preferable?
I had thought of using static variables, but apparently they are static only to the scope of the main executing script. If script1 imports script2 with a static variable, script1 gets its own copy of the variable.
I've also tried doing
Code:
cli_execute(filename + " " + paramString);
Does anyone know any other ways?
Last edited: