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


Joined: 04 Feb 2014
Posts: 1

PostPosted: Fri Feb 07, 2014 5:28 pm   

Zmud #IF Statement Including < not working as thought?
 
Hi, having issues with a script that types: reroll to get a new series of character stats/

#CLASS {TAREROLL}
#VAR Kno {22}
#VAR Phy {17}
#VAR Sta {19}
#VAR Agi {18}
#VAR Cha {14}
#TRIGGER {Intellect: %s &Int} {}
#TRIGGER {Knowledge: %s &Kno} {}
#TRIGGER {Physique: %s &Phy} {}
#TRIGGER {Stamina: %s &Sta} {}
#TRIGGER {Agility: %s &Agi} {}
#TRIGGER {Charisma: %s &Cha} {}
#TRIGGER {Encumberance: *} {#IF ((@Int>19)AND(@Kno>20)AND(@Phy>19)AND(@Sta>21)AND(@Agi>2)AND(@Cha>16) {
#BEEP
#ECHO DONE!
#T- TAREROLL
} {}
}
#CLASS 0

Is how the script was designed, however, it considers conditions satisfied on stats such as:

Intellect: 20
Knowledge: 21
Physique: 20
Stamina: 24
Agility: 17
Charisma: 5

Assuming it has something to do with my > statements in the #IF condition, I wrote this to verify my suspicious.

#CLASS {TEST}
#TRIGGER {Mana: *} {#IF (@Int>2) {#ECHO Int Gr} {#ECHO Int Le}}
#TRIGGER {Vitality: *} {#IF (@Kno>2) {#ECHO Kno Gr} {#ECHO Kno Le}}
#TRIGGER {Status: *} {#IF (@Phy>2) {#ECHO Phy Gr} {#ECHO Phy Le}}
#TRIGGER {Armor *} {#IF (@Sta>2) {#ECHO Sta Gr} {#ECHO Sta Le}}
#TRIGGER {Weapon: *} {#IF (@Agi>2) {#ECHO Agi Gr} {#ECHO Agi Le}}
#TRIGGER {Charisma: *} {#IF (@Cha>2) {#ECHO Cha Gr} {#ECHO Cha Le}}
#CLASS 0

With these results:

Intellect: 20
Knowledge: 21
Physique: 20
Stamina: 24
Agility: 17
Charisma: 5

It calculated:
-Intellect Greater Than
-Knowledge Greater Than
-Physique Greater Than
-Stamina Greater Than
-Agility Less Than
-Charisma Greater Than

On another account, same test triggers

Intellect: 19
Knowledge: 20
Physique: 15
Stamina: 5
Agility: 17
Charisma: 14

-Intellect Less Than
-Knowledge Greater Than
-Physique Less Than
-Stamina Greater Than
-Agility Less Than
-Charisma Less Than

So I altered the original script to:

#CLASS {TAREROLLOLD}
#VAR Kno {22}
#VAR Phy {17}
#VAR Sta {19}
#VAR Agi {18}
#VAR Cha {14}
#TRIGGER {Intellect: %s &Int} {}
#TRIGGER {Knowledge: %s &Kno} {}
#TRIGGER {Physique: %s &Phy} {}
#TRIGGER {Stamina: %s &Sta} {}
#TRIGGER {Agility: %s &Agi} {}
#TRIGGER {Charisma: %s &Cha} {}
#TRIGGER {Armor *} {#IF ((@Int>=5)AND(@Kno>=5)AND(@Phy=3)) {#VAR Sum1 1} {}}
#TRIGGER {Magical *} {#IF ((@Sta>=4)AND(@Agi>=5)AND(@Cha>=2)) {#VAR Sum2 1} {}}
#TRIGGER {Encumberance: *} {
#IF (#IF ((@Sum1=1)AND(@Sum2=1)) {
#BEEP
#ECHO DONE!
#T- TAREROLL
} {
reroll
}
}
#CLASS 0

This kept rerolling without stopping, taking no set of conditions as satisfactory.

I have also switched the > symbol to = symbol and to >= to satisfy the same mathmatical amounts I was/am looking for. Yet neither series of changes changes the symptoms. Am I missing something, or is there something bigger at play?

Thanks for the help.

EDIT: Using Zmud 7.21
Reply with quote
Llohr
Apprentice


Joined: 17 May 2005
Posts: 107

PostPosted: Tue Feb 25, 2014 8:30 am   
 
Well, one reason the new one would keep rolling forever is that you changed the name of the class, but the #T- still attempts to turn off the original class name. You've also got a pair of #ifs in a sort of odd configuration where one #if would do.

Also, do you know precisely how many spaces show up between the stat name and the number? I only ask because you include a white space before and after the %s, which, would, if memory serves, match 3 or more white spaces, since the two to either side are explicit.

I don't recall having used the &var syntax in zMud, though I am familiar with it in cMud, but because of my uncertainty, I'll try to give you a script example in the zMud syntax I'm familiar with.

Not knowing what your mud's output actually is here, I'll give it my best guess based on what you have, and I'll base it off your original trigger.

Code:
#class {TAREROLL}
#Trigger {Intellect~:%s(%n)} {#var Int {%1} {} {TAREROLL}}
#Trigger {Knowledge~:%s(%n)} {#var Kno {%1} {} {TAREROLL}}
#Trigger {Physique~:%s(%n)} {#var Phy {%1} {} {TAREROLL}}
#Trigger {Stamina~:%s(%n)} {#var Sta {%1} {} {TAREROLL}}
#Trigger {Agility~:%s(%n)} {#var Agi {%1} {} {TAREROLL}}
#Trigger {Charisma~:%s(%n)} {#var Cha {%1} {} {TAREROLL}}
#TRIGGER {Encumberance~:} {#IF (@Int>19 AND @Kno>20 AND @Phy>19 AND @Sta>21 AND @Agi>2 AND @Cha>16) {
#BEEP
#ECHO DONE!
#T- TAREROLL } {reroll}}
#CLASS 0
_________________
Finally disabled automatic updates in Windows, entirely to prevent corruption caused by Windows killing CMUD.

Priorities: Straight as an arrow.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Tue Feb 25, 2014 8:13 pm   
 
SpacesmatterinZMud,becausethat'showZMud'sparserfiguresoutwhatiswhat.
_________________
EDIT: I didn't like my old signature
Reply with quote
Llohr
Apprentice


Joined: 17 May 2005
Posts: 107

PostPosted: Tue Feb 25, 2014 10:21 pm   
 
My mistake, it's been quite some time.
_________________
Finally disabled automatic updates in Windows, entirely to prevent corruption caused by Windows killing CMUD.

Priorities: Straight as an arrow.
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