How to work triggers

Post Reply
newbie
Posts: 18
Joined: Thu Jan 26, 2012 10:56 am

How to work triggers

Post by newbie »

Good morning,

I'm from zMud and I try to translate some trigger from that to here, but I don't know how.

#TRIGGER {¡Envuelves a %1 en tu Estallido de fuego!} {#substitute {%ansi(yellow)¡Envuelves a %ansi(bold,magenta)%1%ansi(yellow) en tu Estallido de fuego! %ansi(white).}}

¡Envuelves a Culebra, dos Ciervos de la Llanura y Ardilla en tu Plaga de desdicha!

I want change color to the line, but I want the enemies will be have another color too. There are two possibilities, the spell only affect a one monster or maybe some monsters.

Can someone tell me how it works on mudlet?

Anocher question, can someone explain each option from triggers will be use for: like substring, perl regex, begin of the substring, exact match, Lua function, line spaccer, color trigger.

Thank you


newbie
Posts: 18
Joined: Thu Jan 26, 2012 10:56 am

Re: How to work triggers

Post by newbie »

Sorry, isn't the answer I hope, I'm only waiting for an example to adapt my triggers, it is too complicated?

Well I adapt moreless and have this trigger:

Pattern: Curas algunas de tus heridas más (\w+).

trigger:
deleteLine()
cecho("<magenta> Curas algunas de tus heridas más <snow>" ..matches[2].."<white>.")

Result:
Pronuncias el cántico: 'magius elis curis' Curas algunas de tus heridas más ligeras.

The phrase will be one row down, can someone how can I do it?

Thank you

Darmir
Posts: 226
Joined: Sun May 01, 2011 6:51 pm
Contact:

Re: How to work triggers

Post by Darmir »

newbie wrote:Sorry, isn't the answer I hope, I'm only waiting for an example to adapt my triggers, it is too complicated?

Well I adapt moreless and have this trigger:

Pattern: Curas algunas de tus heridas más (\w+).

trigger:
deleteLine()
cecho("<magenta> Curas algunas de tus heridas más <snow>" ..matches[2].."<white>.")

Result:
Pronuncias el cántico: 'magius elis curis' Curas algunas de tus heridas más ligeras.

The phrase will be one row down, can someone how can I do it?

Thank you
Do no something like this instead.
Code: [show] | [select all] lua
local x = matches[2]
selectString(line,1)
replace("")
cecho("<magenta> Curas algunas de tus heridas más <snow>" ..x.."<white>.")

newbie
Posts: 18
Joined: Thu Jan 26, 2012 10:56 am

Re: How to work triggers

Post by newbie »

Thank you for the answer, that works perfect.

Now I have one new doubt, I have this trigger:

pattern:
(.*) herid? de gravedad.

trigger:
selectString(line,1)
replace("")
cecho(matches[2].."<purple> herido de gravedad<white>.")

The ? on the pattern is because it could be a letter a or o and it deppend from the sex of the npc, on zMud I have to put a ? but what I have to put on Mudlet?

Thank you

Darmir
Posts: 226
Joined: Sun May 01, 2011 6:51 pm
Contact:

Re: How to work triggers

Post by Darmir »

newbie,
I suggest reading up on pattern matching for regex. Here is a link to a cheat sheet.
www.addedbytes.com/cheat-sheets/regular ... eat-sheet/.

But to answer your question do:
(.*) herid(a|o) de gravedad.

User avatar
kevutian
Posts: 217
Joined: Fri Aug 20, 2010 8:18 pm
Location: United Kingdom
Contact:

Re: How to work triggers

Post by kevutian »

Hrm.

Use this instead:

Code: Select all

^(.+) herid[oa]? de gravedad\.$

newbie
Posts: 18
Joined: Thu Jan 26, 2012 10:56 am

Re: How to work triggers

Post by newbie »

Thank you to both, the answer is good.

Well I have a new question.

If I have this trigger:

pattern:
Tu (.*) se rompe en mil pedazos inservibles.

trigger:
selectString(line,1)
replace("")
cecho("<snow>Tu <grey>" ..matches[2].."<snow> se rompe en mil pedazos inservibles<white>.")
echo (" ¡Ohhhh!")

That I want are that some names on the mud have their own colors and I want preserve thats, this only an example, that I want is how can I put ..matches[2].. to get his own color If I put before a color because I have some words before that I want to change the color but not the word I capture from the mud.

Thank you

Post Reply