[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Saving Variables in a Plugin
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Saving Variables in a Plugin

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Tjcheckley   (1 post)  [Biography] bio
Date Wed 25 Jan 2012 03:44 AM (UTC)  quote  ]
Message
Currently I have an autodonater plugin that I wrote. It automatically donates 1k gold to my clan on aardwolf for every clan member's power-up or level-up every 12 hours. It then keeps track of how much gold and how many levels and power-ups (pups) have been donated for. When I made the triggers, aliases, variables, and timers into a plugin I got this for the variables section:

<!-- Variables -->

<variables>
<variable name="mPups">0</variable>
<variable name="tGold">0</variable>
<variable name="tPups">0</variable>
<variable name="dGold">0</variable>
<variable name="mLevels">0</variable>
<variable name="tLevels">0</variable>
<variable name="modLevel">1000</variable>
<variable name="modPup">1000</variable>
</variables>

Everything works fine but when I quit out of the client and come back everything is back to zero for total gold donated, etc. Is there a way to fix this? Should the variables be left out of the plugin altogether?

Thanks,
Visible
[Go to top] top

Posted by Nick Gammon   Australia  (19,168 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Wed 25 Jan 2012 05:15 AM (UTC)  quote  ]
Message
Yes. You can use variables in a plugin, and write to them with SetVariable. They are saved if you have "saving state" enabled, and loaded again next time.

But if you actually put them in the plugin file like that, they overwrite whatever saved variables you might have had.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] 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.


781 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]