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
twillsinc
Beginner


Joined: 02 Jul 2018
Posts: 12

PostPosted: Wed Jul 04, 2018 11:41 pm   

old trigggers...
 
Morning mudders,

finally got to downloading cmud after using zmud years ago (windows 10 now) must have had zmud installed on this PC as when I create new triggers what looks like old triggers appear. I used to colour words based on the amount of damage they do

pattern : massacre
output : #CW red

in cmud I did...

pattern : You %1 in the %2 with your %3.
output :
#CW massacre red
#cw devastating red
#cw bonecrunching red
#cw solidly red
#cw gouge yellow
#cw stab yellow
#cw slash yellow

a little neater.

however, the old way I used to do it keeps appearing. Any idea where they might be stored so I can remove them please? or is my new trigger style creating them?

thanks in advance
Reply with quote
shalimar
GURU


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

PostPosted: Thu Jul 05, 2018 2:00 am   
 
Ah, I see a few issues really... zMUD allow some rather sloppy syntax, and you will have to retrain yourself out of bad habits.

First off is that %1 is not a wildcard to be used in the pattern. (There is a list of pattern matching symbols linked to in #HELP #TRIGGER)
It should be used in the output section, as a variable to refer back on the captured segment of the pattern.
#TRIGGER {You hit (*) in the (*) with your (*).} {$target=%1;$spot=%2;$weapon=%3}

The second is that this trigger effectively ignored the would be captured sections of its pattern, and just defines several other triggers instead.

#CW slash yellow
is the same as:
#TRIGGER {slash} {#CW yellow}

As it is written there is no need for it to ever fire more than once.

As for old code mysteriously reappearing, that could be a corruption issue.
You could be well served by renaming/moving (with CMUD closed) your current .pkg file and start fresh.

My guess is that they are being stored in this trigger., and others like it.
Each time you delete all the one-word triggers that add color, this fires and recreates them.
Or are you talking about other reappearing settings?
_________________
Discord: Shalimarwildcat
Reply with quote
shalimar
GURU


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

PostPosted: Thu Jul 05, 2018 3:36 pm   
 
If you want to have a list of items all colored the same, you would want to store them in a variable, and match any member of the variable, like so:

yellowStuff=cheese|earwax|urine|sun|submarine
#TRIGGER {{@yellowStuff}} {#CW yellow}

If you have a set pattern, like in your example, and you want to test one of your local variables and do different things based on its value, you would do it more like:
Code:
#SWITCH (%match($testVar, "{massacre|devastating|bonecrunching|solidly}")) {#CW red}
        (%match($testVar, "{gouge|slash|stab}")) {#CW yellow}


Sidenote, the former example above will leave individual words colored, the latter example will end up leaving the whole line colored if used in a full line trigger like your original example.

It all depends on what you actually want to do in your setup.
_________________
Discord: Shalimarwildcat
Reply with quote
twillsinc
Beginner


Joined: 02 Jul 2018
Posts: 12

PostPosted: Thu Jul 05, 2018 8:45 pm   
 
Thanks for the info Shalimar,

I think my current triggers are re-creating the single words as they do not appear until I first enter combat. I will look at changing around around to your text and see if that helps :) will report back in a day or so.

Thanks again
Reply with quote
twillsinc
Beginner


Joined: 02 Jul 2018
Posts: 12

PostPosted: Fri Jul 06, 2018 12:13 am   
 
So i had a look at your suggestion. I dont want every copy of the word "massacre" to appear red just on the combat line so that takes the variable out of the question. Setting up the specific line in cmud. I am guessing I need to swap:

You %1 in the %2 with your %3.

with

You hit (*) in the (*) with your (*).

Would I then put the following under the pattern?

$target=%1;$spot=%2;$weapon=%3

I am not fully understanding what goes what and where. The line is always the same, just the weapon, enemy and strength of hit changes.

Thanks! :)
Reply with quote
shalimar
GURU


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

PostPosted: Fri Jul 06, 2018 2:36 am   
 
My bad, i added in the hit there my mistake, to combine what i said together you would want:

Pattern: You (%w) * in the * with your *.

Script:
Code:
#SWITCH (%match(%1, "{massacre|devastating|bonecrunching|solidly}")) {#CO red}
        (%match(%1, "{gouge|slash|stab}")) {#CO yellow}


I am assuming based on sentence structure where the various parts actually are, you may need to move the wildcards around to match.
You may notice there are less parenthesis and no variable declarations in this.
Based on what we are doing, there was no need to actually save the extra data that wasn't being used, the only relevant bit of information is the one word or %w.
_________________
Discord: Shalimarwildcat
Reply with quote
twillsinc
Beginner


Joined: 02 Jul 2018
Posts: 12

PostPosted: Sun Jul 08, 2018 5:18 pm   
 
So I have the followign based on what you've said :

Pattern :
You fire your (*) at (*), (*)

Script :
#SWITCH (%match(%1, "{massacring|devastating|bonecrunching|solidly}")) {#CO red}
(%match(%1, "{gouge|slash|stab}")) {#CO yellow}
#AD arrow -1

arrow is a variable containing how many arrows I have left so ignore that.

The words to colour appear in the final section but they do not highlight with the above text as is. Am I doing something wrong?
Reply with quote
twillsinc
Beginner


Joined: 02 Jul 2018
Posts: 12

PostPosted: Sun Jul 08, 2018 8:09 pm   
 
Update :

When it sees the word in %match it colours the line not the word?
Reply with quote
shalimar
GURU


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

PostPosted: Sun Jul 08, 2018 10:29 pm   
 
Well, #CO colours the whole line, #CW colours just the matched pattern, which in this case would still be the whole line.
_________________
Discord: Shalimarwildcat
Reply with quote
twillsinc
Beginner


Joined: 02 Jul 2018
Posts: 12

PostPosted: Mon Jul 09, 2018 10:08 am   
 
Oh, im back to square one on that one then :D Im happy to create 9 seperate triggers for each damage type if thats what is required but I do not want a trigger just looking for 1 word as then it appears everywhere. can I not just colour the 1 word?
Reply with quote
shalimar
GURU


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

PostPosted: Mon Jul 09, 2018 3:02 pm   
 
You can, the command #PCOL would do it.

Instead of: #CO red
try: #PCOL red %x1
_________________
Discord: Shalimarwildcat
Reply with quote
twillsinc
Beginner


Joined: 02 Jul 2018
Posts: 12

PostPosted: Mon Jul 09, 2018 8:36 pm   
 
So of the line eg.

You hit demon solidly in the head with your sword

"demon solidly in the head" is coloured, im guessing because it associate all that with the first (*). Im actually OK with this! it highlights the damage and who im hitting if a group is involved so thank you. The random extra triggers no longer appear so I would consider this matter resolved. Thanks Shalimar - your time is appreciated.
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