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 ➜ Opening worlds from plugins.

Opening worlds from plugins.

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


Posted by Poromenos   Greece  (1,037 posts)  Bio
Date Wed 28 May 2003 10:32 PM (UTC)
Message
How can i connect to a world from another world's plugin? I need to find a way for one char to load another when he needs him.

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Thu 29 May 2003 03:25 AM (UTC)
Message
You mean create a new world? Open an existing one (on disk)? Connect to one that is already open?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Poromenos   Greece  (1,037 posts)  Bio
Date Reply #2 on Thu 29 May 2003 02:41 PM (UTC)
Message
Opening one and controlling it would be best, but if that's not possible, connecting to an already open world is fine.

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Thu 29 May 2003 09:21 PM (UTC)
Message
Just open that character's world file, see world.Open. I would now store the world's ID instead of the name and use world.GetWorldById later on in the controlling world to get back the "reference" to the world object. Once you have that you can use it to control it. See the example in world.GetWorldById for how you would do that.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Poromenos   Greece  (1,037 posts)  Bio
Date Reply #4 on Thu 29 May 2003 10:50 PM (UTC)
Message
Oh great, that's exactly what I wanted, thanks!

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
Top

Posted by Meredin   (13 posts)  Bio
Date Reply #5 on Wed 10 May 2006 06:56 PM (UTC)
Message
In regards to this topic, is there also a way to close the world when finished? I can use commands to log off the world, but I don't know how to actually close it.

The problem that comes up is that sometimes I need to send world.open, but sometimes I need to send world.connect. If you do use world.connect, it seems you have to use world.DoAfter instead of just world.send because it sends so fast the world has not yet connected...
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #6 on Wed 10 May 2006 08:47 PM (UTC)
Message
Quote:

In regards to this topic, is there also a way to close the world when finished?



world.DoCommand "close"



Quote:

... it seems you have to use world.DoAfter instead of just world.send because it sends so fast the world has not yet connected


Yes, connecting is asynchronous, that is it takes time and is done in the background while the client does other things, otherwise the client would hang every time you opened a world. You need to build in a delay. Technically the script should wait until it is connected, see:

http://www.gammon.com.au/scripts/doc.php?function=IsConnected

You could make a timer that checks every couple of seconds to see if it is connected yet.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Meredin   (13 posts)  Bio
Date Reply #7 on Wed 10 May 2006 10:02 PM (UTC)
Message
Thanks, that ALMOST solved the problem. :-)

Now, my command sent to world don't have time to execute... I have a trigger that matches and then sends this:

world.activate
world.execute "save"
world.execute "quit"

world.DoCommand "save"
world.DoCommand "close"

For some reason, even if I do world.DoCommand "save", I still get the message asking if I want to save because internal variables have changed, but if I click save then it won't ask me this. Either way, I can turn that off in Global Preferences. The problem is that it doesn't give the mud time to accept "save" and "quit" before closing the world, leaving my character link-dead...

I tried world.DoAfter 3, "world.DoCommand "close""
but that gives end of line expected errors...
Any way around this...
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #8 on Wed 10 May 2006 10:20 PM (UTC)
Message
You want:


world.DoAfterSpecial (3, "world.DoCommand 'close'", 12)


You have to use different quotes (or double or escape the quotes) because you have quotes within quotes.

The 12 says "send to script engine".

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Meredin   (13 posts)  Bio
Date Reply #9 on Wed 10 May 2006 10:44 PM (UTC)
Message
Parenthesis won't work...

Taking the parenthesis completely out gets past that part, but then it says world.doCommand is not a valid arguement...

Error number: -2146827839
Event: Execution of line 1 column 1
Description: Argument not optional: 'world.DoCommand'
Line in error:

Called by: Immediate execution
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #10 on Wed 10 May 2006 10:50 PM (UTC)
Message
OK, this is VBscript I gather. In that case you have to double the quotes:


world.DoAfterSpecial 3, "world.DoCommand ""close""", 12


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


33,316 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.