Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
atraeyu
Novice


Joined: 29 Dec 2006
Posts: 41
Location: Chester, VT

PostPosted: 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"
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: 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!
Reply with quote
atraeyu
Novice


Joined: 29 Dec 2006
Posts: 41
Location: Chester, VT

PostPosted: Mon Jan 01, 2007 10:21 pm   
 
Hmm, that still doesn't work. :(
Reply with quote
atraeyu
Novice


Joined: 29 Dec 2006
Posts: 41
Location: Chester, VT

PostPosted: 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.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4692
Location: Pensacola, FL, USA

PostPosted: Mon Jan 01, 2007 10:35 pm   
 
try putting the pattern inside of curly braces?
_________________
Discord: Shalimarwildcat
Reply with quote
atraeyu
Novice


Joined: 29 Dec 2006
Posts: 41
Location: Chester, VT

PostPosted: 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.
Reply with quote
Ceres
Wanderer


Joined: 25 May 2006
Posts: 88

PostPosted: 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!
}
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: 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!
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: 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.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net