Raelle wrote:I have no idea how to code, but could one write a script to periodically <appraise light> and then <extinguish torches> if 1) it's light, naturally or otherwise, and 2) nothing is emitting darkness?
Certainly. I'm one who tends to try and reduce spam, so I would create some an additional trigger that gags the typical MUD output from appraise light when it checks. You could check whenever you want - including in every room you enter. You could do some combination of the following things.
Keep in mind, I am writing this here only and not in Mudlet therefore I haven't tested it.
Trigger "Automatically Extinguish Torches":
PATTERNS:
Code: Select all
^(\w+) is in the open air and naturally light\.$
^(\w+) is indoors and lit\, either by a torch\, or by natural sources\.$
TRIGGER CODE:
Code: Select all
selectCurrentLine()
deleteLine()
if torchLit = true then
send("extinguish torches", false)
torchLit = false
end
***Reduces the spam that you'll see in pretty much every room as you enter.
Trigger "Gag Dark Room":
PATTERNS:
Code: Select all
^(\w+) is indoors and naturally dark\.$
^It is dark\, very dark\. What else is there to observe\? Nothing\, you see nothing\.$
TRIGGER CODE:
***Reduces the spam that you'll see in pretty much every room as you enter.
Script "AutoExtinguish":
User Event Handler:
SCRIPT CODE:
Code: Select all
function AutoExtinguish()
if torchLit = true then
enableTrigger("Gag Dark Room")
enableTrigger("Automatically Extinguish Torches")
send("appraise light",false)
end
tempTimer(.5, function()
disableTrigger("Gag Dark Room")
disableTrigger("Automatically Extinguish Torches")
end)
end
***This script will run whenever your client receives a gmcp.room packet, which is every time you enter a room. If torchLit
is enabled(true) then your client will check the light in the room to see if you should extinguish your torch. It gags the appraise light output so your screen doesn't get filled with it. We disabled the trigger on a timer so that if there is up to .5 sec of server lag, the message will still be gagged.
If you don't want to check in every room, you could set this up to check every 5th, 10th, or any interval of rooms that you want. Simply add this to the code just below "function AutoExtinguish()" and change "10" to the interval of rooms that you want to check:
Code: Select all
roomLightCounter = roomLightCounter or 0
roomLightCounter = roomLightCounter + 1
if roomLightCounter ~= 10 then
return
end
roomLightCounter = 0
You would also want to make the following updates to the things I posted above:
PATTERN (perl regex):
TRIGGER CODE:
Code: Select all
send("light torches",false)
torchLit = true
***The only difference here is that we are now setting the torchLit
variable, which basically enables your client to send the <appraise light> command to the MUD so you can auto-extinguish.
I would also recommend an alias like this if you go this route:
ALIAS PATTERN:
ALIAS CODE:
**This allows you to set the torchLit
variable every time you light a torch manually, even if you <light second torch> or <light small torches>.
And just to be safe, if you ever DO want to appraise the light in the room and something has gone weird with your
torchLit variable, we want to make sure we aren't gagging the output:
ALIAS PATTERN:
ALIAS CODE:
Code: Select all
disableTrigger("Gag Dark Room")
disableTrigger("Automatically Extinguish Torches")
send(matches[1])(
What's the point of all this? What does it do?
This allows you to automatically be checking the light status in the room for EVERY room you enter IF you have a torch lit, but it
shouldn't be spamming your screen with all of the checks. As soon as you enter a lit room, you will automatically extinguish your torch and set Mudlet to NOT send the <appraise light> command to the MUD. Your Mudlet will be running the code, but you won't be spamming the Genesis servers this way.
Note: It's kinda hacky. There are probably more elegant ways of doing it. This may have some errors since it's totally untested. and I wrote it in this post instead of in Mudlet. But this will at least get you started and you could potentially add specific cases on top of this.