|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Thu Nov 30, 2006 5:44 pm
[1.17] Trigger syntax question |
Code: |
#TRIGGER {^You feel life coming back into your ({right|left}) ({arm|leg}).$} {%1%2 = okay} |
So
"You feel life coming back into your left leg."
would result in
leftleg = okay
It'd compile happily in zMUD, but CMUD is claiming a syntax error
Any suggestions for what to change?
Cheers |
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu Nov 30, 2006 5:49 pm |
It's the %1%2 syntax it doesn't like. You need to change it to this:
#var %concat(%1,%2) okay
EDIT: Also, neat. The ($localvar:wildcard) syntax works with string lists in triggers. So you could change them to ($limb:{arm|leg}) if you wanted. I only mention it because I now have an immense hatred of the %nn syntax and like to get rid of it anywhere I possibly can ^_^ |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu Nov 30, 2006 6:21 pm |
Guinn, you need to remember the big difference between CMUD and zMUD: In zMUD, the %1..%99 were handled as string replacements in the script BEFORE the script was parsed. So in your example, %1 and %2 are replaced with the text, resulting in the script "leftleg = okay" which would then be parsed and executed.
In CMUD, %1..%99 are handled as normal variable references and are replaced during the parsing and compiling. This means that it's the script "%1%2 = okay" that is parsed and compiled, and this is invalid syntax for a variable assignment.
When you need to perform a trick with the pre-substitution of %1..%99 in CMUD, you need to use the #EXEC command. For example:
#EXEC {%1%2 = okay}
would do what you wanted. This creates a string and then executes it, which is essentially what zMUD was doing. |
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Thu Nov 30, 2006 6:49 pm |
Perfect, ta.
Compatibility report - No problems found. |
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
|
|
|