[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  VBscript
. . -> [Subject]  How do I have a multi-line world.DoAfter?
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

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

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


Posted by Weston   (28 posts)  [Biography] 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"
[Go to top] top

Posted by Nick Gammon   Australia  (21,607 posts)  [Biography] 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
[Go to top] top

Posted by Weston   (28 posts)  [Biography] 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?
[Go to top] top

Posted by Poromenos   Greece  (1,037 posts)  [Biography] 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!
[Go to top] top

Posted by Weston   (28 posts)  [Biography] 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!
[Go to top] top

Posted by Nick Gammon   Australia  (21,607 posts)  [Biography] 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
[Go to top] top

Posted by Poromenos   Greece  (1,037 posts)  [Biography] 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!
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] 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.
[Go to top] top

Posted by Nick Gammon   Australia  (21,607 posts)  [Biography] 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
[Go to top] 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.


5,515 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]