Skip to content
Crisol Español

Triggers for Crisol

A trigger is a rule in your client: when a line that matches a pattern arrives, or a piece of data through GMCP, the client plays a sound, reads it aloud or sends a command. You set it up in your client; the game does nothing for you. They are allowed as long as you are at the keyboard (the check question).

With a screen reader, in the middle of a fight, a warning can arrive behind a lot of text. A trigger tells you as soon as it arrives that you have been disarmed, blinded or poisoned, or that your life is low. This page has the lines just as the game writes them and examples to copy. In the game, help triggers.

Before you start

From the text

Each of these lines comes on its own line, also with the combat summary (reader combat). What goes between <> changes. Under each line, the regular expression pattern that matches it; in almost every client you have to mark the pattern as a regular expression.

In reader mode, after a disarm the prompt starts with Unarmed. until you wield again (help prompt).

Through GMCP

If your client gets GMCP (Mudlet does by itself), the game sends it data apart from the text, the same in English and in Spanish:

This is how blindness arrives, for example:

Char.Affects [{"name":"Blindness","key":"blindness","bad":true,"states":["blindness"],"source":"spell","hours":61}]

Every field, in the GMCP help.

In the Crisol packages

The Crisol packages for Mudlet, MUSHclient and genericMud (How to play) already bring these warnings: disarmed, blinded, poisoned, low life, left unarmed, each new ailment with its name, blindness from whatever source and life below the percentage you choose. They come turned off, so you turn on only the ones you want, and they only warn you: they never act for you.

In Mudlet they come as a line of text, or Mudlet's voice speaks them with crisol warnings voice (crisol warnings text puts it back). In MUSHclient they write a line, which MushReader reads. In genericMud its voice speaks them, and you can also turn them on in the Automation Manager (Triggers and MUD data), each in its crisol_aviso_ group. All three remember what you turn on.

In Mudlet

If you don't use the Crisol package, or want to change the warnings to your liking: open the editor (Alt+E), make a new script, paste this and save it. They are separate examples: keep the ones that suit you. It only speaks the warnings; if you also want it to do something, remove the -- from the line that says so. You can save it again without the warnings doubling up.

-- Example triggers for Crisol. They only speak the warnings.
crisolDisp = crisolDisp or {disparadores = {}, eventos = {}}
for _, id in ipairs(crisolDisp.disparadores) do killTrigger(id) end
for _, id in ipairs(crisolDisp.eventos) do killAnonymousEventHandler(id) end
crisolDisp.disparadores, crisolDisp.eventos = {}, {}

local function avisa(texto) ttsSpeak(texto) end

local function disparador(patron, texto)
  table.insert(crisolDisp.disparadores, tempRegexTrigger(patron, function() avisa(texto) end))
end

local function evento(nombre, funcion)
  table.insert(crisolDisp.eventos, registerAnonymousEventHandler(nombre, funcion))
end

-- From the text, in English or in Spanish
disparador([[te DESARMA y tu arma sale volando\.|DISARMS you and sends your weapon flying!]], "Disarmed")
disparador([[¡Te quedas ciego!|¡No ves nada!|You are blinded!|You can't see a thing!]], "Blind")
disparador([[Te sientes muy enfermo\.|Sientes el veneno correr por tus venas\.|Sientes el veneno corriéndote por las venas\.|You feel very sick\.|You feel poison coursing through your veins\.]], "Poisoned")
disparador([[Aviso: te queda menos del 40 % de la vida|Aviso: te queda menos del 10 % de la vida|Warning: less than 40% of your life left|Warning: less than 10% of your life left]], "Low life")

-- Your weapon's word, to pick it up again
local arma = nil
local function miraArma(objeto)
  if objeto and objeto.slot == "wielded" then arma = objeto.kw end
end
evento("gmcp.Char.Items.Equip", function()
  for _, objeto in ipairs(gmcp.Char.Items.Equip) do miraArma(objeto) end
end)
evento("gmcp.Char.Items.Add", function()
  if gmcp.Char.Items.Add.location == "equip" then miraArma(gmcp.Char.Items.Add.item) end
end)

-- Through GMCP: unarmed
local sinArma = false
evento("gmcp.Char.Status", function()
  local ahora = gmcp.Char.Status.unarmed == true
  if ahora and not sinArma then
    avisa("Unarmed")
    -- remove the -- to have it picked up and wielded:
    -- if arma then send("get " .. arma) send("wield " .. arma) end
  end
  sinArma = ahora
end)

-- Through GMCP: each new ailment, with its name in your language
local males = {}
evento("gmcp.Char.Affects", function()
  local ahora = {}
  for _, efecto in ipairs(gmcp.Char.Affects) do
    if efecto.bad then
      ahora[efecto.key] = true
      if not males[efecto.key] then avisa(efecto.name) end
    end
  end
  males = ahora
end)

-- Through GMCP: blindness, whoever puts it on you
local ciego = false
evento("gmcp.Char.Affects", function()
  local ahora = false
  for _, efecto in ipairs(gmcp.Char.Affects) do
    if efecto.key == "blindness" then ahora = true end
    for _, estado in ipairs(efecto.states or {}) do
      if estado == "blindness" then ahora = true end
    end
  end
  if ahora and not ciego then avisa("Blind") end
  ciego = ahora
end)

-- Through GMCP: life below the percentage you choose
local umbral, vidaBaja = 30, false
evento("gmcp.Char.Vitals", function()
  local v = gmcp.Char.Vitals
  if v.maxhp > 0 then
    local tanto = v.hp * 100 / v.maxhp
    if tanto < umbral and not vidaBaja then
      vidaBaja = true
      avisa("Low life")
    elseif tanto >= umbral + 10 then
      vidaBaja = false
    end
  end
end)

In other clients

In MUSHclient and genericMud, the Crisol package already brings them (above). In VIPMud, zMUD or any other, make a trigger for each pattern above and have it play a sound or have your screen reader read it. If your client takes GMCP in its scripts, check in Char.Status whether unarmed turns true and in Char.Affects whether an entry appears with bad set to true, or one with blindness in key or in states.

More help