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
Slugworth83
Newbie


Joined: 08 Nov 2022
Posts: 8

PostPosted: Thu Jun 29, 2023 12:52 am   

Beginner Triggers
 
I'm doing my best, but really struggling with anything beyond a 1 step simple trigger ( x dies --> loot corpse).

There are spell components that load on some mobs, but there are only a handful of these components that are relevant to my character. What I'd like to set up is a trigger that works something like:

Mob Dies --> "examine corpse" ---> if there are a, b, or c components, look those components, otherwise nothing.

I current use 3 triggers to "loot a component", "loot b component", and "loot c component"... but since most mobs have none of those, it causes a ton of extra spam and delay when i'm fighting stuff. Any help?
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 168

PostPosted: Thu Jun 29, 2023 3:01 am   
 
There are several way to go about this, but having some actual in-game descriptions from 'x corpse' or like outputs to refine the options.

personally, I would look at $relevantComponents = "componentA|componentB|componentC" then #IF (%ismember(%i,$relevantComponents)) {get %i}

(I may have commands wrong, it's been a couple months since I've touched cmud for personal enjoyment... but the gist is there and others can chime in on this method.)
Reply with quote
Slugworth83
Newbie


Joined: 08 Nov 2022
Posts: 8

PostPosted: Thu Jun 29, 2023 11:14 am   
 
chaossdragon wrote:
There are several way to go about this, but having some actual in-game descriptions from 'x corpse' or like outputs to refine the options.

personally, I would look at $relevantComponents = "componentA|componentB|componentC" then #IF (%ismember(%i,$relevantComponents)) {get %i}

(I may have commands wrong, it's been a couple months since I've touched cmud for personal enjoyment... but the gist is there and others can chime in on this method.)


Thanks for the idea, that makes sense. The issue I was having earlier i think was that not all mobs would drop something and the trigger would break as soon as it encountered a corpse with nothing to loot. Do I need a way to “turn it off” in those cases so it resets?

I wasn’t using an IF command though, so maybe that would fix it.
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 168

PostPosted: Thu Jun 29, 2023 11:20 am   
 
it shouldn't 'break' but wouldn't fire off as no match would be found. Again without a few samples of in-game prompts it's hard to offer much. Hope the method helps find your solution :)
Reply with quote
Slugworth83
Newbie


Joined: 08 Nov 2022
Posts: 8

PostPosted: Tue Jul 11, 2023 11:28 pm   
 
Okay, made some progress on this while I read through the manuals, etc. Still a long ways off though!

I set up a String List called @Comps which I'm using put in all the components I want to loot. My alias is "loot", like this:

examine 1.corpse;
#IF %ismember(%1,@Comps) {get %i}


The mud output is like:

It's a pretty ghastly sight! Searching through the remains, you find:
corpse (here) :
a tiny acorn
an archaic rune-etched battle staff
a milky potion


In this case, I'd want this particular trigger to look the tiny acorn and nothing else (the acorn is on @comps)
Reply with quote
shalimar
GURU


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

PostPosted: Wed Jul 12, 2023 11:13 am   
 
This one is a bit trickier.
I assume there is a blank line at the end of the display?

Code:
#TRIGGER {corpse ~(here~) :} {} //This trigger is only needed to define your start condition. It is state 0.
#CONDITION {*} {
  $this=%trim(%line)
  #IF (%ismember($this, @comps)) {get $this}
  #IF ($this) {#STATE 1} //This checks to see if we have a blank line (our end condition), and refreshes the trigger state so it will keep running until we get one.
  } {within|param=1} //This tells the condition to only be active for the next X line(s) .
_________________
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