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


Joined: 21 Jul 2002
Posts: 6
Location: USA

PostPosted: Tue Sep 24, 2002 4:29 am   

Math Expressions
 
Can Zmud handle performing AND expressions? If so, how would they be created?

Helpfiles are thus far inneffective.

I am attempting to create a trigger to reload a weapon. Prompt displays current ammunition/maximum ammuntion.

I want to trigger based on two conditions:

maximum ammo + current ammo = 0 (No weapon equipped)
maximum ammo + current ammo = maximum ammo (Out of Ammunition)

In lieu of an AND statement, I have tried using similar expressions.

#if (%1 + %2 = 0) {true} {false}
#if ({%1 + %2} = 0) {true} {false}
#MATH AMMO %1 + %2; #if @AMMO = 0 {true} {false}
@AMMO = %1 + %2; #if @AMMO = 0 {true} {false}

I would appreciate any help.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Tue Sep 24, 2002 4:47 am   
 
quote:

Can Zmud handle performing AND expressions? If so, how would they be created?

Helpfiles are thus far inneffective.

I am attempting to create a trigger to reload a weapon. Prompt displays current ammunition/maximum ammuntion.

I want to trigger based on two conditions:

maximum ammo + current ammo = 0 (No weapon equipped)
maximum ammo + current ammo = maximum ammo (Out of Ammunition)

In lieu of an AND statement, I have tried using similar expressions.

#if (%1 + %2 = 0) {true} {false}
#if ({%1 + %2} = 0) {true} {false}
#MATH AMMO %1 + %2; #if @AMMO = 0 {true} {false}
@AMMO = %1 + %2; #if @AMMO = 0 {true} {false}

I would appreciate any help.



#IF (@ammo.current = @ammo.maximum) {#NOOP weapon is fully loaded} {#weapon is not fully loaded, check for emptiness;#if (@ammo.current) {#noop the weapon still has ammo} {#noop weapon is empty, time to reload}}

Be sure to fill in the code snippets; you didn't say what you wanted to do. As for logical AND statements, if you know how to put one together in a programming language then you can do it the same way in ZMud (ie, (x = 1) AND (y = 25)). You can't combine statements, though, so x=y=1 won't work (this is a typical aspect regarding programming languages).

li'l shmoe of Dragon's Gate MUD
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Sep 24, 2002 6:49 am   
 
#IF ((%1 > 0) AND (%2 = 0)) {reload}
With %1 as maximum ammo and %2 as current ammo, and reload as the reload command. A false statement isn't required.

LightBulb
Senior Member
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