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
jtrent
Beginner


Joined: 22 Nov 2001
Posts: 18
Location: USA

PostPosted: Mon Jan 26, 2004 6:12 pm   

Am stuck
 
If someone could help me.

Im trying to count my gains and losses in a battle.
Thats the string for my prompt.
%dhp %dma (*) %xxp

Im not sure how to go about this but what I want to do is have an alias, (bcount for example). when i type that it take the number of hp, ma, and xp. Then when i type endcount it would then take the number of hp, ma, and xp, and then tell me how much I lost of each.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Jan 26, 2004 6:35 pm   
 
The first step is to put parentheses around the parts of the trigger pattern you're trying to save. You could probably use %n for the xp. They will then be available for use in the trigger value as %1, %2, etc.
(%d)hp (%d)ma (*) (%x)xp
.%1.......%2.....%3...%4...

In the trigger value, assign them to appropriate variables. These variables will then be updated every time you receive a prompt. You should also enable the trigger's Prompt option.
#VAR hp %1
#VAR ma %2
#VAR xp %4

Then, your first alias can simply take the value from those variables and store them in another set of variables that won't change at every prompt.
#AL bcount {#VAR bhp @hp;#VAR bma @ma;#VAR bxp @xp}

Your second alias can simply use the current value, from the latest prompt, and compare it to the values recorded by bcount. If desired, these final values can be stored to a third set of variables.
#AL endcount {#SAY You lost %eval( @bhp - @hp)hp, %eval( @bma - @ma)ma, and %eval( @bxp - @xp)xp.}
Reply with quote
jtrent
Beginner


Joined: 22 Nov 2001
Posts: 18
Location: USA

PostPosted: Mon Jan 26, 2004 7:25 pm   
 
Thanks a lot. That did the trick.
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