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
➜ OnWorldSave()?
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Candido
USA (78 posts) Bio
|
Date
| Sun 26 Jun 2011 10:29 AM (UTC) Amended on Sun 26 Jun 2011 10:30 AM (UTC) by Candido
|
Message
| Does this still exist? I see a few mentions of it from several years ago, and then nothing. Couldn't find anything in release notes to indicate it was deprecated either. Needless to say I can't get it to work.
I have this in my script file.
function OnWorldSave()
Note("okay")
end
Tried save, save as, doing a SetChanged(true) and then saving. Nothing trips it. | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #1 on Sun 26 Jun 2011 10:49 AM (UTC) Amended on Sun 26 Jun 2011 10:50 AM (UTC) by Twisol
|
Message
| There are no OnWorld* callbacks, per se. To set up an event callback from a non-plugin script file, you need to put the function's name into the appropriate field in the Scripting configuration page.
Alternatively you can use SetAlphaOption():
function OnWorldSave()
end
SetAlphaOption("on_world_save", "OnWorldSave")
For plugins, you can use the OnPluginWorldSave or OnPluginSaveState callbacks, depending on what you're trying to do. |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Candido
USA (78 posts) Bio
|
Date
| Reply #2 on Sun 26 Jun 2011 10:57 AM (UTC) |
Message
| Awesome, thanks. There doesn't happen to be a way to get stuff like PacketReceived or TelnetSubnegotation in the main world too, is there? I didn't see any alpha option for them. Always wondered what the design reason for limiting such powerful functions to plugins was. | Top |
|
Posted by
| Worstje
Netherlands (899 posts) Bio
|
Date
| Reply #3 on Sun 26 Jun 2011 08:15 PM (UTC) |
Message
| Well, _technically_ you could change the question and ask why some people limit themselves to world files when you can have such beautiful plugins available to you. :)
The idea with plugins is that they are exchangeable, modular and all that stuff. The idea behind that again is, if I can venture a guess, that Nick wanted to make MUSHclient more accessible for new players; I know of plenty of people who are completely dependant on others for their scripting needs where it is all in a single script file. If the supplier changes something, it all gets wiped, and you are stuck without your changes once again.
Besides that, the world file takes special attention compared to plugins. Everything implemented for plugins needs to be implemented for the world file seperately, due to historical cruft piling up and rewriting the entire thing being simply too much work. Ideally, the world script space would be little more than a 'default' plugin, but at this time it is double work. (A similar comparison goes up for Lua vs other scripting languages.) | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #4 on Sun 26 Jun 2011 08:36 PM (UTC) |
Message
|
Worstje said: Ideally, the world script space would be little more than a 'default' plugin, but at this time it is double work.
Quite a bit more than double, unfortunately. It's been a qualm of mine for some time that the world script is treated differently from plugins, but you can usually work around it pretty well. (Unfortunately, there's no OnWorldBroadcast :( ) |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #5 on Sun 26 Jun 2011 09:56 PM (UTC) |
Message
|
Candido said:
Awesome, thanks. There doesn't happen to be a way to get stuff like PacketReceived or TelnetSubnegotation in the main world too, is there? I didn't see any alpha option for them. Always wondered what the design reason for limiting such powerful functions to plugins was.
I honestly think you are better off making a plugin. The plugin wizard will do that for you in a few seconds, and then you can have the plugin open in a separate editor and tweak it, then just reload it to test. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Candido
USA (78 posts) Bio
|
Date
| Reply #6 on Mon 27 Jun 2011 12:40 AM (UTC) |
Message
| Oh, I made my plugin for it long ago. I was just wondering about it because having it in the world would be easier/faster, and for something like, say, OnPluginLineReceived, it doesn't make much sense to me to have it only modular. Sure, if something changes in your ATCP subnegotiation, you'll be glad to just be able to switch out your plugin. However, if something changes in just straight up lines, you probably have bigger things to worry about. | 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.
22,704 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top