I am finishing up a script that will automatically check for new versions of a script when it is run. If others may be interested in this, where would something like this live?
Is this the appropriate forum since it isn't particularly useful without some other script to work with?
Thanks
[edit]
To keep the downloadable script in the first post, I'm editing this with the script info.
In order to use this script, do the following steps:
Include the script in your file:
import <ver.ash>
Then, in your file, add two variables. One will designate the current version of the file
and the other will be what post number to look for on the kolmafia site.
For instance, in this script, the versions used look like:
string VER_VERSION = "1.0"; // version of the version script.
string VER_VERSION_PAGE = "1462";
The post number (1462, above) can be found by going to the post with the script on kolmafia.us
and looking at the URL. It should look something like:
http://kolmafia.us/index.php/topic,1462.0.html
Just take the number after "topic".
Then, to use the script, you'll do something like:
boolean current = check_version(VER_VERSION,VER_VERSION_PAGE);
if (!current)
{
print("A newer version of the ver.ash script is available.");
print("For current version go to: " + version_url(VER_VERSION_PAGE));
}
Replace VER_VERSION and VER_VERSION_PAGE with your appropriate variables, and then put
whatever message is appropriate for the version message.
Now, on the post with your script, be sure to add a line that looks something like:
[current version: 1.0]
You're done!
When you change the versions of your script, you'll need to do two things:
Change the version number inside your script (like the VER_VERSION in this script)
Edit the post with the new version to say "[current version: 1.1]" or whatever is appropriate.
Note: because the version numbers are all handled as strings, there's nothing stopping you from
more interesting build numbers like "[current version: 1.2b (the b is for balloon)]". Just be
sure to match it inside your script.
Is this the appropriate forum since it isn't particularly useful without some other script to work with?
Thanks
[edit]
To keep the downloadable script in the first post, I'm editing this with the script info.
In order to use this script, do the following steps:
Include the script in your file:
import <ver.ash>
Then, in your file, add two variables. One will designate the current version of the file
and the other will be what post number to look for on the kolmafia site.
For instance, in this script, the versions used look like:
string VER_VERSION = "1.0"; // version of the version script.
string VER_VERSION_PAGE = "1462";
The post number (1462, above) can be found by going to the post with the script on kolmafia.us
and looking at the URL. It should look something like:
http://kolmafia.us/index.php/topic,1462.0.html
Just take the number after "topic".
Then, to use the script, you'll do something like:
boolean current = check_version(VER_VERSION,VER_VERSION_PAGE);
if (!current)
{
print("A newer version of the ver.ash script is available.");
print("For current version go to: " + version_url(VER_VERSION_PAGE));
}
Replace VER_VERSION and VER_VERSION_PAGE with your appropriate variables, and then put
whatever message is appropriate for the version message.
Now, on the post with your script, be sure to add a line that looks something like:
[current version: 1.0]
You're done!
When you change the versions of your script, you'll need to do two things:
Change the version number inside your script (like the VER_VERSION in this script)
Edit the post with the new version to say "[current version: 1.1]" or whatever is appropriate.
Note: because the version numbers are all handled as strings, there's nothing stopping you from
more interesting build numbers like "[current version: 1.2b (the b is for balloon)]". Just be
sure to match it inside your script.