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
pakiv
Newbie


Joined: 28 Oct 2008
Posts: 6

PostPosted: Tue Oct 28, 2008 1:29 am   

unmatched braces
 
sorry about this...but I can't figure it out and I'm getting a bit annoyed. I have two aliases for an auto sipping thing I'm working on. I can't SEE whats wrong with my aliases...but both of the get an unmatched braces error....and repeats untill it virtually freezes cmud and I have to cancel out. any help? here are the aliases.

siph (alias)
#IF (@sipbalance == 1 AND @health < @siphealth){
sip health
#VAR sipbalance 2
}

siphm (alias)
#IF (@sipbalance == 1 AND @mana < @sipmana){
sip mana
#VAR sipbalance 2
}
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Tue Oct 28, 2008 1:51 am   
 
Well, I'm not sure what the unmatched braces is all about, but here is a better way to do your sipbalance:

Code:
#ALIAS siph {
   #IF (@sipbalance AND @health < @siphealth) {
      sip health
      #VAR sipbalance 1
   }
}
#ALIAS siphm {
   #IF (@sipbalance AND @mana < @mana) {
      sip health
      #VAR sipbalance 1
   }
}


Then just do #VAR sipbalance {} or sipbalance="" to clear the variable and make the balance false.

EDIT: Maybe having your left curly for the #IF's smashed into the right paren is causing it, I'm not sure.
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Tue Oct 28, 2008 1:54 am   
 
You have a syntax error - spaces are very important in zScript and you're missing them between the ) of the expression and the { of the true-command on the first line in both cases. You can see how that change works in ralgith's example.

Unfortunately ralgith, your code there will change some of the functionality of the script and perhaps isn't what pakiv was looking for - but it does demonstrate what the problem was, the missing space.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
pakiv
Newbie


Joined: 28 Oct 2008
Posts: 6

PostPosted: Tue Oct 28, 2008 2:20 am   
 
ahhhh...thanks! wow...took me forever to figure that out. Too bad one of my triggers isn't picking up the prompt correctly. It only seems to pick it up at random times...hmmm.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Tue Oct 28, 2008 11:24 am   
 
Probably something to do with the way the MUD is sending prompts - open the script debugger, it's on the window menu, and turn on i messages in the Messages menu. That way you can see the special characters at the end of the MUD prompt. It was a problem for a long time that prompt triggers wouldn't fire on a prompt sent in the middle of the packet, and that was because the MUD would send different characters at the end of the prompt in the middle of a packet. Watch prompts in the script debugger and see if there's any difference.
_________________
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