View unanswered posts | View active topics It is currently 16 Jul 2018 10:38

Forum rules


- Use common sense and be respectful towards each other at all times, even when disagreeing.
- Do not reveal sensitive game information. Guild secrets, player seconds are examples of things not allowed.



Reply to topic  [ 11 posts ]  Go to page 1, 2  Next
Torch Auto 
Author Message
Veteran

Joined: 21 Mar 2016 09:17
Posts: 206
Just wondering about something here. Would it be at all possible to automatically light torches with a trigger if it's dark, and extinguish them when there is light again? Cuz let's be honest, everyone occasionally forgets about their torches until they burn out after you've been sitting somewhere idle for three hours.

Think it could be done? Currently I'm using Mudlet.

_________________
Alea iacta est. Serius regredi est.


18 Apr 2018 02:23
Profile
Wanderer

Joined: 12 Nov 2017 19:56
Posts: 69
Kwevin wrote:
Just wondering about something here. Would it be at all possible to automatically light torches with a trigger if it's dark, and extinguish them when there is light again? Cuz let's be honest, everyone occasionally forgets about their torches until they burn out after you've been sitting somewhere idle for three hours.

Think it could be done? Currently I'm using Mudlet.


I haven't used torches in a long time. Do they give a message just before they go out (e.g. "the flame on the excellent torch begins to flicker and fade" or whatever)? If so just make a trigger. But I also think you can light a torch, as long as it's in inventory but not in a pack or anything, even if you're in darkness.


18 Apr 2018 05:50
Profile
Veteran

Joined: 24 Jan 2016 21:27
Posts: 201
Have 2 out, 1 lit. When the message pops, light torches, get torch from pack.


18 Apr 2018 09:36
Profile
Wizard
User avatar

Joined: 03 Mar 2014 13:03
Posts: 135
Location: US West
I like to use the Excellent Torches from Avenir/Sybarus. I usually run through the tunnels underneath the Dark Elves and grab some from the crates/chests. They burn about 30min each and I carry 5 or so. I have this simple trigger in Mudlet for lighting them after one burns out (I usually burn two at once)

PATTERN (perl regex):
Code:
^(?:> )?The excellent torch goes out\.$
TRIGGER CODE:
Code:
sendAll("light torch","light second torch",false)
sendAll("open scrip","get torch from scrip",false)
tempTimer(1,function() send("close all",false) end)



If you wanted to set it up so that it auto-lights when you enter "A dark room." you could use the following. It is dependent on having at least one torch in your inventory when you enter the dark room.

PATTERN (perl regex):
Code:
^A dark room\.$
TRIGGER CODE:
Code:
send("light torches",false)


18 Apr 2018 18:51
Profile
Rising Hero

Joined: 06 Jul 2011 22:24
Posts: 320
Shanoga wrote:

PATTERN (perl regex):
Code:
^(?:> )?The excellent torch goes out\.$

One can also:
TRIGGER CODE:
Code:
send ("drop burnt torch")


18 Apr 2018 21:09
Profile
Wanderer

Joined: 18 Jul 2017 19:31
Posts: 67
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?


18 Apr 2018 21:28
Profile
Wanderer

Joined: 12 Nov 2017 19:56
Posts: 69
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?


I don't see why not. Sounds like you'd want A. a alias that starts (and another that stops) B. a timer and C. a trigger with two patterns, that fires when either one is matched.

This would be easy in Mudlet (so easy that I could do it!), but if you're using something else, including the web client, I've no idea.


18 Apr 2018 22:15
Profile
Rising Hero

Joined: 06 Jul 2011 22:24
Posts: 320
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?

It would interfere with magic map and seeing exits - you can not see them in dark and you would have to move to other room with active light source to be able to. It is easier to have torch on all the time.


18 Apr 2018 22:47
Profile
Wizard
User avatar

Joined: 03 Mar 2014 13:03
Posts: 135
Location: US West
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:
^(\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:
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:
^(\w+) is indoors and naturally dark\.$
^It is dark\, very dark\. What else is there to observe\? Nothing\, you see nothing\.$
TRIGGER CODE:
Code:
selectCurrentLine()
deleteLine()
***Reduces the spam that you'll see in pretty much every room as you enter.


Script "AutoExtinguish":
User Event Handler:
Code:
gmcp.room
SCRIPT CODE:
Code:
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:
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):
Code:
^A dark room\.$
TRIGGER CODE:
Code:
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:
Code:
^light (\w+ )(torch|torches)$
ALIAS CODE:
Code:
send(matches[1])
torchLit = true
**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:
Code:
^appraise light$
ALIAS CODE:
Code:
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.


18 Apr 2018 23:11
Profile
Wanderer

Joined: 18 Jul 2017 19:31
Posts: 67
thanks for posting that Shanoga!!

like I said, I don't know how to do this stuff, but I'd like to learn, so it's really helpful to see all the different parts laid out as you did above.


20 Apr 2018 21:46
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 11 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users and 1 guest


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 post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.