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

Posted by Weston on Sat 19 Jun 2004 08:58 PM — 9 posts, 32,950 views.

#0
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"
Australia Forum Administrator #1
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.
#2
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?
Greece #3
I think JScript might, C allows them, I don't know about Java/JScript... Just try it :P
#4
That sounds pretty interesting.

Well, that's it for me on this topic.
Thanks again, everyone!
Australia Forum Administrator #5
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");


Greece #6
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
USA #7
Its things like that which make getting to know regexps and making triggers as specific as possible worth while.
Australia Forum Administrator #8
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