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
➜ Lua
➜ Switching worlds from command line MultiWorld
Switching worlds from command line MultiWorld
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Cyote
(9 posts) Bio
|
Date
| Tue 20 Oct 2015 05:38 PM (UTC) |
Message
| Hi,
Is there a way to send commands directly from commandline or switching worlds with commands without using accelerator keys like zmud/cmud/tintin style??
Thank you. | Top |
|
Posted by
| Fiendish
USA (2,537 posts) Bio
Global Moderator |
Date
| Reply #1 on Tue 20 Oct 2015 07:07 PM (UTC) |
Message
|
Quote: without using accelerator keys
Why without? |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #2 on Tue 20 Oct 2015 07:55 PM (UTC) Amended on Tue 20 Oct 2015 07:58 PM (UTC) by Nick Gammon
|
Message
| You need a "world reference" which you can get by name or world ID code. Safer is the ID string, because that won't change if you rename the world. With scripting enabled, and "/" as the "script" character, type:
(Or use the Immediate Window (Ctrl+I) and leave out the slash.
You should see something like this in your output window:
That is the "world ID" (in my case, for my test world).
Now you can, in the command window (and again, assuming scripting is active and you have "/" as the scripting prefix) type:
/GetWorldById ("f52a5090c219b0efebe1b521"):Activate ()
That gets a "world reference" to that particular ID, and then calls the Activate function for that world, bringing that world to the front.
To switch back, you need the ID of the other word, eg.
/GetWorldById ("8c1e6fc91017ec9408ced4c0"):Activate ()
Now you can make an alias, if wanted, to save all that typing, eg.
<aliases>
<alias
match="world3"
enabled="y"
send_to="12"
sequence="100"
>
<send>GetWorldById ("f52a5090c219b0efebe1b521"):Activate ()</send>
</alias>
</aliases>
 |
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.
|
This simple approach will give an error message if the wanted world is not open. You could make the alias "smarter" and test if GetWorldById returns nil or not:
<aliases>
<alias
match="world3"
enabled="y"
send_to="12"
sequence="100"
>
<send>
local w = GetWorldById ("f52a5090c219b0efebe1b521")
if w then
w:Activate ()
else
ColourNote ("red", "", "Requested world is not available")
end
</send>
</alias>
</aliases>
 |
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.
|
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #3 on Tue 20 Oct 2015 08:05 PM (UTC) |
Message
| If you have short and easily-remembered world names (in the configuration dialog -> General -> IP address part) then you could use the name, like this:
/GetWorld ("smaug2"):Activate ()
Then you could make a single alias that takes a wildcard, and substitute that into the GetWorld part, and have it switch to any world. |
- 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.
15,239 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top