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.
 Entire forum ➜ MUSHclient ➜ VBscript ➜ How do I have a multi-line world.DoAfter?

How do I have a multi-line world.DoAfter?

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


Posted by Weston   (28 posts)  Bio
Date Sat 19 Jun 2004 08:58 PM (UTC)
Message
When I create a trigger and try to have it do a multi-line /world.DoAfter I get the following error:

Error number: -2146827255
Event: Execution of line 1 column 27
Description: Unterminated string constant
Line in error:
world.DoAfter 1, "command1
Called by: Immediate execution


I am putting the following into the "Send:" area:

/world.DoAfter 1, "command1
command 2"
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 19 Jun 2004 09:32 PM (UTC)
Message
VBscript doesn't let you have linefeeds inside strings. You could do something like:

/world.DoAfter 1, "command1"
world.DoAfter 1, "command 2"

However the sequence won't necessarily be what you expect. A better way might be:

/world.DoAfter 1, "command 1" & vbCrLf & "command 2"

That puts a linefeed into the string itself.

- Nick Gammon

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

Posted by Weston   (28 posts)  Bio
Date Reply #2 on Mon 21 Jun 2004 06:58 PM (UTC)
Message
Thanks! It works, and very well I might add.


I do have a follow-up question though. Do any of the other scripting languages allow for the linefeeds inside strings?
Top

Posted by Poromenos   Greece  (1,037 posts)  Bio
Date Reply #3 on Mon 21 Jun 2004 08:24 PM (UTC)
Message
I think JScript might, C allows them, I don't know about Java/JScript... Just try it :P

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

Posted by Weston   (28 posts)  Bio
Date Reply #4 on Tue 22 Jun 2004 02:34 AM (UTC)
Message
That sounds pretty interesting.

Well, that's it for me on this topic.
Thanks again, everyone!
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #5 on Tue 22 Jun 2004 03:58 AM (UTC)
Message
You can do it a bit more neatly in Jscript, like this:


DoAfter (1, "laugh\\nsigh");

Normally it would be \n but MUSHclient expands out \n internally (if it is in the "Send" box) so you need two \\ before the "n".

However in a script file it would be:

DoAfter (1, "laugh\nsigh");



- Nick Gammon

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

Posted by Poromenos   Greece  (1,037 posts)  Bio
Date Reply #6 on Tue 22 Jun 2004 07:16 AM (UTC)
Message
By the way, the expanding sequences is a security "hole", since if you have a trigger that matches on "* says '*'" and you send "laugh %1", they could do something like
Poromenos\npassword 123 123\nhe says 'test' and it would cause you to send
laugh Poromenos
password 123 123
he

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

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #7 on Tue 22 Jun 2004 08:10 AM (UTC)
Message
Its things like that which make getting to know regexps and making triggers as specific as possible worth while.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #8 on Wed 23 Jun 2004 06:30 AM (UTC)
Message
The \n is expanded in the trigger send box, not the wildcard expansions. So, if you try what you suggested you would actually see:

laugh Poromenos \n password 123 123



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


23,409 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.