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
Loftaris
Adept


Joined: 24 Aug 2004
Posts: 277

PostPosted: Wed Dec 14, 2011 1:51 pm   

I need your help please
 
I would like to know if it is possible to turn off all triggers after there's been no human input for 'x' minutes?

Does anyone know how I could do this? It would need to be able to turn off even if the triggers have been triggering, just no HUMAN interaction...

Please, and Thank you.

Using CMud, newest version, Windows 7
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Dec 14, 2011 8:47 pm   
 
Turn off absolutely all triggers automatically? You probably knwo that you can click the gun icon at the bottom of the Cmud window to turn off all triggers manually. I'm not sure there's a way to do that in script, though...

You can disable an entire class, including all triggers, aliases, etc. inside it, with the #T- command. You can even have a trigger turn off the class that the trigger is inside of. Any triggers currently executing will complete execution, and will not fire again until the class is turned enabled again. If you put all of your triggers into one class, or a small number of classes, you can do something like what you want. You could have a alarm to execute the disable command, and an Oninput trigger which changes the timer on the alarm every time you enter a command at the command line.

You could be even more sophisticated. Have that alarm disable most of your classes, and also enable another trigger that is normally turned off. This trigger would be another Oninput trigger, which would do the reverse: enable the classes ,and disable itself, and start a new alarm when you enter anything at the command line.
Reply with quote
Loftaris
Adept


Joined: 24 Aug 2004
Posts: 277

PostPosted: Wed Dec 14, 2011 11:48 pm   
 
Thanks Rahab for the response.

Yes, I'm aware of all the little tricks to turn on/off triggers, but I want to turn them off when I've been away from the computer for some time.

I want to prevent me from accidentally botting. That's the reason I want to turn them off after 'x' minutes of idleness.

I realize I could set up some sort of alarm, but I don't want them accidentally turning off while i'm at the computer, that could cause me a quick death.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Thu Dec 15, 2011 2:24 am   
 
That's why I said to have an Oninput trigger. This trigger would fire every time you enter something at the keyboard. It would change the timer on the alarm, always setting it to 10 minutes from "now". If you stop typing for ten minutes (or whatever time you set for the alarm), it will go off, but as long as you type something, it will reset.
Reply with quote
Loftaris
Adept


Joined: 24 Aug 2004
Posts: 277

PostPosted: Thu Dec 15, 2011 2:47 am   
 
Ah, thank you. I misunderstood! I'll try that.
Reply with quote
Loftaris
Adept


Joined: 24 Aug 2004
Posts: 277

PostPosted: Thu Dec 15, 2011 2:56 am   
 
Uh.. Ok, well. I've managed to create an infinite loop of triggers using oninput. I'm not sure why it's not working, but it just keeps creating triggers over and over..

I've deleted them all because it kinda killed my cmud. Any ideas how I might code that?
Reply with quote
shalimar
GURU


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

PostPosted: Thu Dec 15, 2011 3:17 am   
 
Use a named alarm so you don't end up with countless instances of the same alarm.

The only way I can think of that might make it possible for CMUD to tell the difference between a user imputed command and one done by other settings is... keystrokes

Is there a way for CMUD to acknowledge any given keystroke event?
Perhaps something that could be referenced via COM scripting.
_________________
Discord: Shalimarwildcat
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Thu Dec 15, 2011 7:32 pm   
 
Hm. I thought Oninput triggers only fire on commands entered at the command line, not commands from scripts.
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Thu Dec 15, 2011 8:51 pm   
 
That can be worked around, though. This trigger should do exactly what you want, Loftaris:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger type="Command Input" priority="34120" copy="yes">
    <pattern>^*$</pattern>
    <value>#IF (%trigger = %lastinput) {#ALARM "idletimer" {+10:00} {#IGNORE}}</value>
  </trigger>
</cmud>

Just change the 10:00 to however long you want to leave your triggers on after you've last typed something.
Reply with quote
Loftaris
Adept


Joined: 24 Aug 2004
Posts: 277

PostPosted: Thu Dec 15, 2011 9:51 pm   
 
I saved that as an xml file and imported it into my triggers, but it doesn't fire.

I tried creating it manually but it ended up as an infinite loop.
Reply with quote
Loftaris
Adept


Joined: 24 Aug 2004
Posts: 277

PostPosted: Thu Dec 15, 2011 9:54 pm   
 
Aha! I fixed it.

I had to remove the " " from the alarm

Thanks a whole bunch! All of you!
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