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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Zene
Beginner


Joined: 10 Jul 2002
Posts: 26
Location: Canada

PostPosted: Sun Aug 11, 2002 4:47 am   

Syntax error with nested #IFs :<
 
Hi...I'm working on a CLASS that captures the prompt and grabs the HP information
then analyzes it is within two ranges..and if so to execute the according spell.
Also, when it executes (this part works BTW :) the spell it alternates between
casting and invoking the spells (ih and ch are alias' for casting heal).
Anyhow this is what it looks like, but zmud won't let me do it because of syntax
errors in the checkhealth and checkhealth2 alias's :<...If anyone can help me try to
fix it..thanks.. (i tried breaking it down as much as possible..but still it doesn't
seem to work).


#CLASS SelfHeal
#VAR hp 0;#VAR maxhp 0;#VAR mn 0;#VAR maxmn 0
#TR {~[H:(%d)/(%d)~] ~[M:(%d)/(%d)~] ~[S:(%d)/(%d)~] ~[E:(%d)/(%d)~] ->} {#var hp %1;#var maxhp %2;#var mn %3;#var maxmn %4;#var spr %5;#var maxspr %6;#var end %7;#var maxend %8;checkhealth}
#TR {~[H:(%d)~] ~[M:(%d)~] ~[S:(%d)~] ~[E:(%d)~] ->} {#var hp %1;#var mn %2;#var spr %3;#var end %4;checkhealth}
#CLASS 0
#AL checkhealth {#IF @heal {#IF (@hp < 300) {#IF (@castinv=0) {ih2 %1;#var castinv 1} {ch2 %1;#var castinv 0};checkhealth2}
#AL cheackhealth2 {#IF ( (@hp > 300) & (@hp < 650) ) {#IF (@castinv=0) {ih %1;#var castinv 1} {ch %1;#var castinv 0};#T- SelfHeal;#ALARM +2 {#T+ SelfHeal}}

Reply with quote
EdwinDroom
Wanderer


Joined: 25 Jan 2002
Posts: 77
Location: Ireland

PostPosted: Sun Aug 11, 2002 5:02 am   
 
You arent closing all the {'s

There should be as many }'s as {'s

Not sure which parts should be inside which if, but as a guide

#AL checkhealth {#IF @heal {#IF (@hp < 300) {#IF (@castinv=0) {ih2 %1;#var castinv 1} {ch2 %1;#var castinv 0};checkhealth2}}}

Just move the 2 new }'s to where the if's should close

"I've got an allergy to Perrier, daylight and responsibility" - Marillion

Check out Moral Decay on 131.247.113.1 3003
Reply with quote
Zene
Beginner


Joined: 10 Jul 2002
Posts: 26
Location: Canada

PostPosted: Sun Aug 11, 2002 5:31 am   
 
Umm..thanks hehe..i went over it once again (i must have gone over it tens of times..
anyhow..in both aliasses i just had to add an extra } to the end...
very sad ..i apologize hehe
Reply with quote
EdwinDroom
Wanderer


Joined: 25 Jan 2002
Posts: 77
Location: Ireland

PostPosted: Sun Aug 11, 2002 3:46 pm   
 
No need to apologize - I'm a programmer and if i had a dollar for every time i forgot to close a nested loop or if statement, i could buy Microsoft :)

"I've got an allergy to Perrier, daylight and responsibility" - Marillion

Check out Moral Decay on 131.247.113.1 3003
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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