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
Alpha-Omega
Newbie


Joined: 23 Jun 2008
Posts: 4

PostPosted: Thu Jul 24, 2008 6:10 am   

Converting characters into numbers.
 
Greetings! I appreciate the help, and apologize before hand for taking your time.

Anyway, i have this prompt

4300h, 5654m, 20400e, 24894w cexkdb-+++++--

And the trigger for the prompt (best i could think of):

^(%d)h, (%d)m, (%d)e, (%d)w [cexkdb-](*)

I want to capture the +++++-- and translate into numbers.

The general idea is that you start without any + or -. When you receive an attack in that mud, you gain "energy" in form of +. Each + represents 20 points, with the max of energy gained is +++++ (100 points), (-- don't matter). So the prompt could be instead:

4300h, 5654m, 20400e, 24894w cexkdb-+--
4300h, 5654m, 20400e, 24894w cexkdb-++--
4300h, 5654m, 20400e, 24894w cexkdb-+++--
4300h, 5654m, 20400e, 24894w cexkdb-++++--
4300h, 5654m, 20400e, 24894w cexkdb-+++++--

I stored the entire thing in a variable. But how would i go about changinn those +'s into numbers? If my pattern is not correct, how could i go about fixing it?

Thank you.
Reply with quote
Qaiia
Wanderer


Joined: 06 Apr 2007
Posts: 59

PostPosted: Thu Jul 24, 2008 12:38 pm   
 
Maybe a #TRIGGER and #SUB for each variation, only using the end of the line...

#TRIG {cexkdb~-~+~-~-} {#SUB {cexkdb~- 20~-}}
#TRIG {cexkdb~-~+~+~-~-} {#SUB {cexkdb~- 40~-}}
#TRIG {cexkdb~-~+~+~+~-~-} {#SUB {cexkdb~- 60~-}}
#TRIG {cexkdb~-~+~+~+~+~-~-} {#SUB {cexkdb~- 80~-}}
#TRIG {cexkdb~-~+~+~+~+~+~-~-} {#SUB {cexkdb~-100~-}}

Haven't tested, but should work. You can edit the #SUB output to format the number however you wish, I left it surrounded by "-" for continuity.
Reply with quote
Qaiia
Wanderer


Joined: 06 Apr 2007
Posts: 59

PostPosted: Thu Jul 24, 2008 12:50 pm   
 
Coincidentally, this should work too, with only one trigger needed:

#TRIG {cexkdb~-%1~-~-} {#SUB {cexkdb~- %eval(%len(%1)*20)~-}}
Reply with quote
Alpha-Omega
Newbie


Joined: 23 Jun 2008
Posts: 4

PostPosted: Thu Jul 24, 2008 8:54 pm   
 
How could i go about gagging that part and storing it to a variable (the numbers) so i can echo it later?
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