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 ➜ General ➜ Saving Variables in a Plugin

Saving Variables in a Plugin

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


Posted by Tjcheckley   (1 post)  Bio
Date Wed 25 Jan 2012 03:44 AM (UTC)
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
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 25 Jan 2012 05:15 AM (UTC)
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
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.


7,871 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.