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


Joined: 10 Jul 2003
Posts: 1
Location: Sweden

PostPosted: Thu Jul 10, 2003 12:39 pm   

Variables help
 
Heyas

Im trying to get a script that calculates the exp i get from killin somethin, and then calculating it to say how many times i have to kill that somethin again to level.
Here is what i did:

#TR Exp: (%1) ] (that captures how much exp i have left to level from my prompt)
#var exptnlold %1

#TR You receive (%1) of (%2) experience points.
#var exp %1
#var maxexp %2
#math exptnlnew {@exptnlold-@exp}
#math numberofftimes {@exptnlnew/@exp}
say I have to kill that mob @numberofftimes again before i level!

It works just fine...but i get like 127,945874857 times...how can i avoid getting all these commas?

Tnx if u have the time to help me
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Jul 10, 2003 5:24 pm   
 
It's not desirable to use %1, %2, etc in the pattern of your triggers. zMUD provides a wide selection of wildcards to allow you to precisely match the type of data expected. %d and %n are the preferred wildcards for numbers.

The comma is your decimal symbol and indicates you are using floating point numbers (this is probably because of the %1, %2). You can avoid getting the commas by limiting your numbers to integers.
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