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


Joined: 06 Sep 2004
Posts: 30

PostPosted: Fri Nov 10, 2023 5:57 pm   

Trigger to Count Skill Use
 
Could someone help me with a simple trigger to count how many times a skill is used in cMud. I had a trigger in zMud, want to convert it to cMud.

In my mud, your skill raises based on how many times you used it. For example, if I want to practice the "choke" skill, I want to know how many times I have done it successfully.

The message below is the message I get when I succeed at the skill.

"You concentrate and constrict your victim's throat."

And when it raises, this is the message:

"You feel better at using choke."

Anyway to keep an ongoing trigger that keeps count of how many times i've used the skill successfully?

This was how it was done in zMud.

#TRIGGER {^{You concentrate and constrict your victim's throat.|You feel better at using choke.}} {#add skillcount 1}
Reply with quote
shalimar
GURU


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

PostPosted: Fri Nov 10, 2023 11:10 pm   
 
If i am understanding right, that may have thrown off your count.
Do both lines display when your skill improves?

If so you should be using something like:
Code:
#TR {^You concentrate and constrict your victim's throat.} {forceChokeSuccesses=(@forceChokeSuccesses + 1)}

#TR {^You feel better at using choke.} {
  #PRINT {It took @forceChokeSuccesses attempts to improve.}
  forceChokeSuccesses=0
}


#ADD and #MATH have both been depreciated in favor of (parenthesis) always having their contents evaluated
_________________
Discord: Shalimarwildcat
Reply with quote
Cronos
Novice


Joined: 06 Sep 2004
Posts: 30

PostPosted: Sun Nov 12, 2023 7:04 pm   
 
Is there a way to increase the count by 1 if either the 2 messages displays?

The mud gives either options when successfully performing the skill, so I want it to +1 to the skill success.

In Zmud, I was able to use " | " if there was more than 1 outcome that would result in +1 count. In Cmud is there something similar or do I need to create 2 triggers, one for each message?
Reply with quote
shalimar
GURU


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

PostPosted: Tue Nov 21, 2023 2:54 pm   
 
If that is the actual disired result, your original trigger will work with my script body.
It looked like a potential error is why i separated them.
_________________
Discord: Shalimarwildcat
Reply with quote
Cronos
Novice


Joined: 06 Sep 2004
Posts: 30

PostPosted: Sun Dec 03, 2023 4:01 pm   
 
I was trying to recycle an old example from a previous mud, but let me use a different example on the mud I'm actually playing.

I want to have a status skill count to increase by 1 whenever I attempt to use a weapon (wand). My quest is that I have to use it X number of times so I want to track how close I am in reaching that goal.

I was able to figure out how to do it separately as multiple separate triggers but want to edit it so it takes into account the various messages (both success + failures) and add it to the skill count since it doesn't matter if it is successful or not, just that I made the attempt for the quest.

A few variable outcomes:

You nearly rip a bluebottle fly in two with your deadly corrode!! (33)
You nearly rip the annoying cricket in two with your deadly corrode!! (33)
You nearly rip a large green grasshopper in two with your deadly corrode!! (34)
You nearly rip the cute young ladybug in two with your deadly corrode!! (34)
You try to corrode a large green grasshopper, but miss. (0)
You barely corrode the Mist Traveler. (55)
You graze the Mist Traveler as you corrode it. (32)

Whenever "your deadly corrode", "You try to corrode", "You barely corrode", "you corrode it" triggers, it does the following:
#ADD AirWand 1

My status is:
Fire Wand: @FireWand / Acid Wand: @AcidWand / Air Wand: @AirWand / Ice Wand: @IceWand

It more or less works but want to know if there's a better way to streamline the various triggers into a single one that does the same thing.

Thanks for all your input so far, it's allowed me to get this far!
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 167

PostPosted: Wed Dec 06, 2023 5:03 am   
 
Look into #SWITCH You should be able to have a generic 'capture' prompt and eval that capture to the #SW potential results to +1 your wand, and when no match is found do nothing.
Reply with quote
Cronos
Novice


Joined: 06 Sep 2004
Posts: 30

PostPosted: Sun Dec 10, 2023 5:05 am   
 
I read the help file regarding switch. Where would I put the code? So far, I'm used to Alias, Variables, Triggers. This one seems a bit more advanced.
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 167

PostPosted: Thu Dec 14, 2023 4:45 am   
 
the #SW code would go in the body of the trigger that is capturing the attempts.
Code:

#TR {You nearly rip %* in two with (%*)!! ~(%d~)}  {#SW {%1 = your deadly corrode} (AirWand = (@AirWand +1)} (AirWand = (@AirWand +1)}}


**rough example
Reply with quote
Harvey43
Newbie


Joined: 16 Apr 2024
Posts: 1

PostPosted: Tue Apr 16, 2024 10:48 am   
 
Check out #SWITCH. You could implement a generic "capture" prompt and evaluate that capture for the potential results related to #SW, boosting your wand by +1. When no match is found, simply take no action.
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