Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
gxyzod
Beginner


Joined: 10 May 2012
Posts: 12

PostPosted: Fri Nov 16, 2012 8:17 pm   

Action counter
 
Dear all,

As with the previous topic I have another need: the creation of two counters that will keep track of the number of positive and failed backstabs I've done.
This is needed because to grow in the skill I need to keep a 50:50 ratio.
In case it is positive I get a message like "you have come out of the darkness and hit XXXX on his neck
If negative it says: "you have come out of the darkness and missed XXXX"

Any ideas are welcome,

Sasa
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4692
Location: Pensacola, FL, USA

PostPosted: Fri Nov 16, 2012 10:05 pm   
 
#TR {you have come out of the darkness and missed} {
$fail=(@backstab.fail+1)
#ADDKEY backstab Fail $fail
}

#TR {you have come out of the darkness and hit} {
$succeed=(@backstab.succeed+1)
#ADDKEY backstab Succeed $succeed
}

that should keep track of them in one database variable
_________________
Discord: Shalimarwildcat
Reply with quote
gxyzod
Beginner


Joined: 10 May 2012
Posts: 12

PostPosted: Fri Nov 16, 2012 11:13 pm   
 
Thanks for the prompt reply! It is really appriciated!
I created them as triggers right?

How can I retrieve the data? Thanks once again!

Sasa
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Sat Nov 17, 2012 2:30 am   
 
As you can see in shalimar's code, you can reference them with @backstab.fail and @backstab.succeed. You could use a simple alias like this to display your ratio:
Code:
#alias bsratio {$bsratio = (@backstab.succeed / %float(@backstab.succeed + @backstab.fail) * 100)
#print %format("Backstab success rate: &.2n%%", $bsratio)}
Reply with quote
gxyzod
Beginner


Joined: 10 May 2012
Posts: 12

PostPosted: Sun Nov 18, 2012 8:53 pm   
 
Thanks a million, that really helped!

Can I still take advantage of your patience?
I'd like to set this counter also on the number of hits given and taken, but it becomes problematic when I have other people fighting in the room.

Is it possible to trigger an action when it sees a frase like this:

You hit XXX YYY ZZZ EEE with a LLLL and hurt him!

So basically masking different words in the phrase that could be the name of the victim, the race and the weapon used?

Thanks once again,
Sasa
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4692
Location: Pensacola, FL, USA

PostPosted: Sun Nov 18, 2012 8:58 pm   
 
#TR {You hit (%w) (%w) with (%w) and hurt {him|her}!} {
$race=%1
$victim=%2
$weapon=%3
}

And so on, that assumes race and victim are one word each
_________________
Discord: Shalimarwildcat
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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