Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Suggestions ➜ Plugins: Plugin versions and State Files, add "requires".

Plugins: Plugin versions and State Files, add "requires".

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Magnum   Canada  (580 posts)  Bio
Date Wed 05 Nov 2003 11:34 AM (UTC)
Message
Currently in Plugin State file:

<variables
   muclient_version="3.42"
   world_file_version="15"
   date_saved="2003-11-05 07:14:06"
  >

Currently in Plugin file:

<plugin
	name=""
	date_written = "2003-01-16"
	date_modified = "2003-01-16"
	version="1.0"
	requires="3.25"
	author="Magnum"
	id=""										<!-- /world.note world.getuniqueid -->
	purpose=""
	language="VBscript"
	save_state="y"
	>

Suggestion, put in Plugin State File:

<variables
   muclient_version="3.42"
   plugin_version-"1.0"
   world_file_version="15"
   date_saved="2003-11-05 07:14:06"
  >

and in main plugin file, put:

        ...
	version="2.0"
	save_state="y"
        state_requires="1.5"

Then, as you may have guessed by now, when the plugin is loaded, if the state file was created by a previous version of the plugin, and that version does not exceed the value of state_requires, then the state file is automatically deleted. If save_state does not equal "y", then the state_requires line is ignored if it exists.

In summary, this would allow a new version of a plugin to initialize as though it were a brand new plugin, in cases where it would be undesirable to work with a state file from a previous version.

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
Top

Posted by Shadowfyr   USA  (1,791 posts)  Bio
Date Reply #1 on Wed 05 Nov 2003 05:58 PM (UTC)
Message
Hmm. For a moment I thought this might be a good idea, then I remembered that in each of the cases where I have used something like this, I require that some variables remain intact and that only the 'changed' or 'added' ones need to be adjusted. As long as you store all permanent data in a database or the like it would work though. Good idea.
Top

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #2 on Thu 06 Nov 2003 12:44 AM (UTC)
Message
The new tags would be backwards compatible. Only in the circumstance where the plugin author decided to use the 'state_requires' tag would old state files ever be deleted.

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #3 on Thu 06 Nov 2003 09:49 PM (UTC)
Message
Can't you just have a variable you add to the plugin, which is its version number? For that matter, GetPluginInfo already returns a version number (selector 19). You could move that to a variable.

Then in the OnPluginInstall you can check the version number in the variable, and if it is lower then your pre-set level, just delete or re-initialise what variables you want. That is a very general approach. This is backwards compatible too, because if the variable doesn't exist, you know you have a state file that is before you first added this variable to it.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #4 on Fri 07 Nov 2003 04:39 AM (UTC)
Message
Sure, could go about it that way.

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


16,783 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.