|
Saving Variables in a Plugin
|
Reply to this subject
Start a new subject
 
Refresh page
| Posted by |
Tjcheckley
(1 post) 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 | top |
|
| Posted by |
Nick Gammon
Australia (18,770 posts) 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 | 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.
564 views.
Reply to this subject
Start a new subject
 
Refresh page
top
Comments to:
Gammon Software support
Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )