|
Alpha-Omega Newbie
Joined: 23 Jun 2008 Posts: 4
|
Posted: 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. |
|
|
|
Qaiia Wanderer
Joined: 06 Apr 2007 Posts: 59
|
Posted: 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. |
|
|
|
Qaiia Wanderer
Joined: 06 Apr 2007 Posts: 59
|
Posted: 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)~-}} |
|
|
|
Alpha-Omega Newbie
Joined: 23 Jun 2008 Posts: 4
|
Posted: 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?
|
|
|
|
|
|
|
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
|
|