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


Joined: 27 May 2002
Posts: 13

PostPosted: Tue Oct 13, 2009 3:34 pm   

Help me trigger!
 
Hello everyone of you!
I have this, for me, rather complex trigger to do..

It is supposed to #ECHO a experience difference for me..

When it says Needed: 123123 it is supposed to remember those numbers.
and next time it says "You receive your share of experience."
It is supposed to first trigger a command
'stat' and then compare the old experience to the new Needed: 123124 (for example) then it should #ECHO like
"Exp Gained: 1"
"Exp Gained this session: 255"
"Needed: 123124"

The Exp Gained this session should be another variable that will save every gained exp until I type 'reset'

Hmm not sure I got that alright but I think so!

Woah this felt really complex but please somebody help me!

Regards!
_________________
towel
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Tue Oct 13, 2009 8:18 pm   
 
#trigger {^You receive your share of experience.$} {stat}

#trigger {Needed: (%d)} {expgained = %eval(@needed - %1);needed = %1;#add gainedthissession @expgained;#say %concat(%cr,"You gained ",@expgained, "experience for this action.",%cr,"You gained ",@gainedthissession, " experience since you logged in.",%cr,"You need ",@needed," experience towards your next level.")}

I changed the output messaging to avoid making an infinite loop on the Needed: ### part.
_________________
EDIT: I didn't like my old signature
Reply with quote
towel
Beginner


Joined: 27 May 2002
Posts: 13

PostPosted: Wed Oct 14, 2009 3:47 pm   
 
Thanks alot! :)
It dont work flawless yet though..

this is what it echoes after each kill

You gained 0experience for this action.
You gained -83 experience since you logged in.
You need 83 experience towards your next level.

Oh btw.. my zmud version is 7.21 if that matters
_________________
towel
Reply with quote
towel
Beginner


Joined: 27 May 2002
Posts: 13

PostPosted: Thu Oct 15, 2009 2:49 pm   
 
Needed: 54,094 xp, 243 tp. Gold: 11. Alert: normal.

You gained 1experience for this action.
You gained -54 experience since you logged in.
You need 54 experience towards your next level.

and after next mob killed:

Needed: 52,712 xp, 243 tp. Gold: 11. Alert: normal.

You gained 2experience for this action.
You gained -52 experience since you logged in.
You need 52 experience towards your next level.

anyone know what is wrong?
_________________
towel
Reply with quote
Erasmus
Wanderer


Joined: 04 Aug 2004
Posts: 82
Location: Philadelphia

PostPosted: Thu Oct 15, 2009 4:01 pm   
 
Couple of things:

1) Change {Needed: (%d)} to {Needed: (%n)}
The %d only picks up digits. The comma in the number is throwing it off.

2) The negative amount has me stumped. I can't think of a reason why @expgained, and @gainedthissession would be different on the first kill of the session. Reset the @gainedthissssion value is 0 on login. See if that has an effect.
_________________
Erasmus
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Thu Oct 15, 2009 7:49 pm   
 
The negative amount for expgained and gained this session is likely negative because @needed is 0 (default value) when the session is started. Since this makes expGained negative, @gainedthissession which uses expgained would also be negative.
_________________
Asati di tempari!
Reply with quote
Erasmus
Wanderer


Joined: 04 Aug 2004
Posts: 82
Location: Philadelphia

PostPosted: Thu Oct 15, 2009 8:31 pm   
 
I thought about that, but if @needed is 0 to start the session than the first kill should be negative and not 1 per Towel's example. Of course I could be incorrectly assuming it's the first kill of the session.
_________________
Erasmus
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