doAfterSpecial Error

Posted by Avian on Sat 13 Jan 2007 09:37 AM — 6 posts, 20,697 views.

#0
What does this error mean...?

Expected ')'
Line in error:
world.doAfterSpecial(4,"setVariable("flagAction","false");",12);

I tried using \ on the setVariable marks, but... no good.
USA #1
Looks like you need to escape the inner quotes, like so:

world.doAfterSpecial(4,"setVariable(\"flagAction\",\"false\");",12);

Is that what you meant about putting a \ in front of the marks? Could you show exactly what you did?
#2
world.setVariable("flagAction","true");
world.send("shatter left arm @x");
world.doAfterSpecial(4,"setVariable(\"flagAction\",\"false\");",12);

That's my exact code. Variables are expanded... and it's a regular expression alias with ^sla$ as the command.

It sends to Script.
#3
I also tried escaping the parentheses and the semicolon... no good either.
Australia Forum Administrator #4
The problem here is that in "send to script", MUSHclient expands out backslashed sequences itself, before passing the text to the script engine. Thus you have to double-escape it. This worked for me:


world.setVariable("flagAction","true");
world.send("shatter left arm @x");
world.doAfterSpecial(4,"setVariable(\\"flagAction\\",\\"false\\");",12);

#5
Oh, awesome, thanks!