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
➜ Plugins
➜ World Variables
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Fadedparadox
USA (91 posts) Bio
|
Date
| Tue 19 May 2009 10:23 PM (UTC) |
Message
| I have my system in a plugin. I store all my lua variables in a MUSHclient variable. What I'm looking to do is then store that MUSHclient variable in the world, not the plugin. I know a number of ways around it, but all require something to be added to the world itself. Is there any way at all to do it from the plugin itself?
I've tried looking for a function such as SetPluginVariable or SetWorldVariable, but I can't find one. I've tried setting it on the world with setting x as the world and using x:SetVariable. Nothing seems to work. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Wed 20 May 2009 11:38 PM (UTC) |
Message
| This is by design. The whole idea of plugins is that they are supposed to be self-contained, and thus have their own:
- Script space (including script language which can vary from plugin to plugin)
- Script variables
- MUSHclient variables (which are saved and restored if "save state" is specified)
- Triggers
- Aliases
- Timers
If you were able to set a world variable (that is, in the "main world" variables space) then if different plugins chose to set the same variable name (eg. "counter" or "target") then they would interfere with each other, and also interfere with any main-world scripts or triggers/aliases etc.
The question is, why do you want to do this? There are work-arounds by making a plugin send to "execute" some text, which the main world can capture as an alias. Also, the main world can access a plugin's variables. So if you really need to talk to a plugin, the main world script can find out a plugin's variable, rather than the plugin setting the main world's variables. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Fadedparadox
USA (91 posts) Bio
|
Date
| Reply #2 on Sat 23 May 2009 01:28 AM (UTC) |
Message
| I'm just looking for ways to simplify what's in my world file. I'm serializing all mushclient variables from the same scripts into a single variable, and reducing aliases to a single one and parsing them through lua instead.
Currently I use an alias to save plugin variables to the world, but this was something else I was hoping to remove the need for. Not possible then? | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #3 on Sun 24 May 2009 04:58 AM (UTC) |
Message
| Isn't this making things more complicated than they need to be? Plugins already save their variables (if save_state = "y") so all you need to do is serialize script variables into MUSHclient variables in the OnPluginSaveState script callback, and then it all happens automatically. No need to push the variables into the main world and have it save them. |
- 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.
14,113 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top