Souvik said:
I can do the whole thing fine using the trigger dialog. My problem is that I can't do it through scripting.
I was trying to use the AddTriggerEx to send to script engine but something's not right....please correct me:
world.AddTriggerEx("trig1","* says, "*"","world.SetVariable("name","%1");",1,-1,0,"","",12,100);
The part ~~world.SetVariable("name","%1");~~ I think is bound to cause an error (and it did), but that is what I write in the trigger dialog when I send_to script through the dialog box in MUSH.
What I want to do is get this entire process done through a script and not through MUSHClient's dialog boxes.
Thank you.
Oh, I see. The problem is this: the " character is used by JScript (and almost every common language these days) to delimit strings. So what happens if you (try) to put a " inside the string? It thinks the string is cut short, and it parses whatever's after that " thinking it's more code.
You have two options here (again). One, you can escape the quotes inside the string. This would look like:
world.AddTriggerEx("trig1","* says, \"*\"","world.SetVariable(\"name\",\"%1\");",1,-1,0,"","",12,100);
Two, you can use single quotes in opportune places. It's okay to put double quotes in single quotes, or single quotes in double quotes.
world.AddTriggerEx("trig1",'* says, "*"','world.SetVariable("name","%1");',1,-1,0,"","",12,100);
|