|
atraeyu Novice
Joined: 29 Dec 2006 Posts: 41 Location: Chester, VT
|
Posted: Mon Jan 01, 2007 8:36 pm
#IF help |
Trying to do my first if trigger. Any ideas why this wont work?
#trigger ~*~*
{
#IF (@SP > 150) { say high sp! } { say low sp! }
}
I get the message: "ERROR: Trigger ~*~* HP: fired but did not compile" |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Mon Jan 01, 2007 9:49 pm |
CMUD's a bit stricter on scripting now... this is what you need.
Code: |
#trigger ~*~* {
#IF (@SP > 150) {
say high sp!
} {
say low sp!
}
}
|
Notice the curly brace on the same line as the #trigger.
The indents aren't required, but they make easy code reading. |
|
_________________ Asati di tempari! |
|
|
|
atraeyu Novice
Joined: 29 Dec 2006 Posts: 41 Location: Chester, VT
|
Posted: Mon Jan 01, 2007 10:21 pm |
Hmm, that still doesn't work. :(
|
|
|
|
atraeyu Novice
Joined: 29 Dec 2006 Posts: 41 Location: Chester, VT
|
Posted: Mon Jan 01, 2007 10:34 pm |
I've tried it several ways now ... I just can't get it to work. I must be doing something really dumb. I did try copy and pasting your trigger text there, but that didn't work either.
|
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4692 Location: Pensacola, FL, USA
|
Posted: Mon Jan 01, 2007 10:35 pm |
try putting the pattern inside of curly braces?
|
|
_________________ Discord: Shalimarwildcat |
|
|
|
atraeyu Novice
Joined: 29 Dec 2006 Posts: 41 Location: Chester, VT
|
Posted: Mon Jan 01, 2007 11:44 pm |
Curly braces didn't work either.
Right now I've got the following text inside the script field for the trigger:
Code: |
#IF(@SP > 150) {
say High SP!
} {
say Low SP!
} |
Still not working. |
|
|
|
Ceres Wanderer
Joined: 25 May 2006 Posts: 88
|
Posted: Mon Jan 01, 2007 11:48 pm |
You need a space between the #IF and first bracket:
Code: |
#IF (@SP > 150) {
say High SP!
} {
say Low SP!
} |
|
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Tue Jan 02, 2007 12:54 am |
Yeah.. I'm sorry when I edited it the first time I forgot the braces around the pattern.. this will work from the command line too..
Code: |
#trigger {~*~*} {
#IF (@SP > 150) {
say high sp!
} {
say low sp!
}
}
|
|
|
_________________ Asati di tempari! |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Jan 02, 2007 1:55 am |
Though it gets the spacing a bit better if you use
Code: |
#trigger {~*~*} {
#IF (@SP > 150) {
say high sp!
} {
say low sp!
}
} |
Since the parser doesn't eat any of your spaces, including the three that lead up to the #if command. |
|
|
|
|
|