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


Joined: 23 Jul 2005
Posts: 26

PostPosted: Mon Aug 08, 2005 11:11 pm   

#if question
 
I've been trying to make a trigger calculate exp needed to next level, which is easy, but allso calculate exp for lvl after that again, which i made work.

But my question is, i have stored total exp needed to a certain lvl in different variables for each lvl (@1 = lvl 1, @11 = lvl 11)

the trigger i have made looks like this
#if (@level = 1) {
#var exptnl2 %eval( @2-@1)
#var goldtnl2 %eval( @2/2)
#var ttexptnl %eval( @3-@exptotal)
#var tttexptnl %eval( @4-@exptotal)
}
#if (@level = 2) {
#var exptnl2 %eval( @3-@2)
#var goldtnl2 %eval( @3/2)
#var ttexptnl %eval( @4-@exptotal)
#var tttexptnl %eval( @5-@exptotal)
}

etc.

it works, but i got 35 if commands, one for each lvl, is it possible to make it work same way with only 1 #if command ?
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Tue Aug 09, 2005 8:49 am   
 
Yes, it should be quite simple.
Could you post the formula you use though, I'm not quite sure from the example you posted.

Something similar to

#if (@level = x) {
#var exptnl(x+1) %eval( @(x+1)-@x)
#var goldtnl(x+1) %eval( @(x+1)/2)
#var ttexptnl %eval( @(x+2)-@exptotal)
#var tttexptnl %eval( @(x+3)-@exptotal)
}

So we can see what relates to what at any level.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Aug 09, 2005 9:16 am   
 
#var exptnl2 %eval( @{%eval(@level+1)}-@{@level})
#var goldtnl2 %eval( @{%eval(@level+1)}/2)
#var ttexptnl %eval( @{%eval(@level+2)}-@exptotal)
#var tttexptnl %eval( @{%eval(@level+3)}-@exptotal)
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Aselarin
Beginner


Joined: 23 Jul 2005
Posts: 26

PostPosted: Tue Aug 09, 2005 2:12 pm   
 
@level = current level
@2 = total exp needed to lvl 2
@3 = total exp needed to lvl 3
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Tue Aug 09, 2005 3:37 pm   
 
It looks like Vijilante has cracked it anyway, but if not then what I meant was what is the formula you use to calculate. You've given two examples, but if you ditch the numbers and use variables the whole way through.

So if
experience required for level(x) = y
experience required for level(x+1) = what (in terms of x and y)

though it looks like Vihilante has already got it licked - have you tried that?
Reply with quote
Aselarin
Beginner


Joined: 23 Jul 2005
Posts: 26

PostPosted: Tue Aug 09, 2005 4:46 pm   
 
thx for the help
Vijilante's trigger works perfect
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