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
Phanku
Novice


Joined: 09 Oct 2003
Posts: 40

PostPosted: Wed Mar 31, 2004 7:18 am   

Putting decimals into varables
 
Okay guys,

I need help.

Here is what my hp bar looks like.

Hp:[349/349] Sp:[258/258] S:[100%] H:[0%] C/M:[1/0/15%] G:15.975

that is while i'm not fighting.

My hp bar looks like this when i am fighting.

Hp:[349/349] Sp:[258/258] S:[100%] H:[1%] C/M:[1/0/26%] G:16.000 E:Scra

Okay so now here is my problem. I would like to put the number that is behind the G: into a varable as one number. But i can't seem to get zmud to do it.

So i would like the varable gxp to say 15.975.

What i'm working for is.. The number behind the G: is a percentage of how far along in my level is so it goes up to 100% (actually it can go above 100, but at 100 i can level). Each round of battle i will gain like 0.0127 (and this number will change each round of battle)percent of my level. What i'm trying to do is make a trigger that would esitmate the number of rounds i have to go yet.

so i would like it to look something like

RTL: 3230 <--- that would be the number of rounds based on the last number it got from the last round of battle tell i level.

If you guys could help me out on this i would be so happy thanks.

Phanku
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Wed Mar 31, 2004 7:47 am   
 
I Belive %x (matches all except spaces)would do to capture it to a variable G:(%x)

as for the math part thats all you its late and math hates me :P but I think this is it

roundstogo=%int(%eval(%eval(100-%float(@gxp))/0.0127))

gimmie a min and I might have a complete script for ya (just remember math could be wrong so someone correct me if im wrong :P
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Wed Mar 31, 2004 8:05 am   
 
Here goes should give you a general idea and also place it in your prompt for something simple using 0.127 always

PATTERN:
^Hp:~[%d/%d~] Sp:~[%d/%d~] S:~[%d~%~] H:~[%d~%~] C/M:~[%d/%d/%d~%~] G:(%x)

VALUE:
gxp=%1
roundstogo=%int(%eval(%eval(100-%float(%1))/0.0127))
#PSUB {%1 R:@roundstogo} %x1

I think my math is correct then again it is late too :P
Reply with quote
Phanku
Novice


Joined: 09 Oct 2003
Posts: 40

PostPosted: Wed Mar 31, 2004 4:13 pm   
 
OH god. How could i be so stupid. Thanks.
The math part i'm not to worried about. My problem was what paramater to use to get it to take a decimal as a varable.

But hey thanks! It's so awesome. THANKS FOR HELPING. You are the best! =)

Phanku
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