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


Joined: 11 Nov 2002
Posts: 2

PostPosted: Mon Nov 11, 2002 8:18 pm   

change in XP script
 
I've got a trigger that reads XP from my prompt. I've got 3 variables: xpcurrent, xplast, and xpgained. What I'd like to do is run a script when the prompt trigger is run.

xpgained = xpcurrent - xplast
xplast = xpcurrent

Once I can get the xpgained into a variable, I can put it on the status line, BUT I'm having trouble figuring out where to put this script and how to script the two statements above.

Sorry, I know this is a basic question, but I'm a new scripter.

Thanks.
Reply with quote
fattony
Apprentice


Joined: 27 Dec 2001
Posts: 105
Location: USA

PostPosted: Mon Nov 11, 2002 8:40 pm   
 
Make a trigger, pattern is your prompt. Something like:

Pattern:
^(%n)Hp (%n)Sp (%n)Xp (%n)Kg>
Value:
xpcurrent = %3
#if (@xplast != %3) {xpgained = %eval(@xpcurrent - @xplast)}
xplast = @xpcurrent

Try that out.

Fat Tony
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Nov 12, 2002 4:24 am   
 
You only need two variables, xpcurrent and xpgained. Assuming %1 is your xp:
#MATH xpgained {%1 - @xpcurrent};#VAR xpcurrent %1

@xpcurrent isn't updated until AFTER xpgained is calculated, so there's no need for xplast.

LightBulb
Senior Member
Reply with quote
Digrat
Newbie


Joined: 11 Nov 2002
Posts: 2

PostPosted: Tue Nov 12, 2002 5:33 pm   
 
Thanks to fattony and Lightbulb. I got it to work using fattony's script; I tried Lightbulb's but it didn't work for me. My settings are:

Trigger pattern: &{hp}/&{hpmax}hp &{gp}/&{gpmax}gp &{xpcurrent}>
Trigger value: #if (@xplast != @xpcurrent) {xpgained = %eval( @xpcurrent - @xplast)}
xplast = @xpcurrent

This feeds my HP/Guild Point meter and puts the amount of XP the last action gave me into the status bar.

Thanks, folks!

-Digrat
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