|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Thu Jun 23, 2005 5:54 am
How can I go about setting this? |
This is what I want to do, plain and simple.
I need to set up a random time interval for a simple command: sending a carriage return to the mud. And I need to do this constantly, not just a one time thing. I took a stab at it, and this is what I have. I tested it out, and it seems to work ok, however, is there a better way of doing this?
#TRIGGER {idling} {#ALARM +%random(20,400) {#CR;#SAY idling}}
Also, is there away of gagging just one word instead of the whole line of words? Thanks.
Charneus |
|
|
|
Thinjon100 Apprentice
Joined: 12 Jul 2004 Posts: 190 Location: Canada
|
Posted: Thu Jun 23, 2005 6:30 am |
Code: |
#VAR time {%random(25,800)}
#ALIAS idling {#CR;#VAR time %random(25,800);#ALARM "idletimer" +@time {idling}}
#ALIAS unidle {#UNTRIGGER idletimer} |
I didn't test this, but in theory it should work fine... type 'idling' when you want it to start sending random carriage returns, type unidle when you want it to stop... the time is changed to a new random time every iteration, too.
As far as gagging a singular word, if you capture a word in a trigger you could use #PSUB to remove the word. Example:
Code: |
#TRIGGER {^I want to (capture) a word.$} {#PSUB {} %x1} |
would remove the word "capture" from that line. |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Thu Jun 23, 2005 6:53 am |
Quote: |
Code:
#VAR time {%random(25,800)}
#ALIAS idling {#CR;#VAR time %random(25,800);#ALARM "idletimer" +@time {idling}}
#ALIAS unidle {#UNTRIGGER idletimer}
|
I used this code, but instead of "idletimer" being the trigger, it's saying the "+@time' is the trigger name. Is there a way to fix this? |
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Thu Jun 23, 2005 9:18 am |
Your first question. To gag a word instead of a line I'd suggest using #sub.
#TRIGGER {Test123} {#SUB {}}
Will just remove Test123, but leave anything surrounding it intact
Your other question
You can delete the @time variable as you can set the random time when creating the alarm
The #ALARM syntax seemed a little confused
This should be okay
Code: |
#ALIAS idling {#CR;#alarm idletimer {%random( 25, 800)} {commands} idling} |
In the above then you have an alias called idling which sends a carriage return then creates an alarm called idletimer which fires in a random time and executes 'commands', the alarm belongs to a class called idling.
I think what you might have wanted was a recurring one though that wasn't in a class, which would be
Code: |
#ALIAS idling {#CR;#alarm idletimer {%random( 25, 800)} {idling}} |
Anyways, hope that works
edit: Sorry, I misread something in your post. The reason the trigger is called @time (or %random(25,800) in my example) is because the trigger is created when the alarm is made - it's an alarm trigger so the pattern is the length of time to match... I don't think there's a way to change that. The unidle alias will still remove the alarm though, so it should work fine. |
|
|
|
|
|
|
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
|
|