mikeC130 Apprentice
Joined: 03 Jul 2006 Posts: 110
|
Posted: Sun Mar 26, 2023 3:20 pm |
The following trigger will meet your basic requirements.
Code: |
<trigger priority="220" id="22">
<pattern>* tells you re-connect (%d) hours.</pattern>
<value>$timer = %1
time = $timer * 3600 // 3600 seconds in an hour so this gives alarm in seconds
#DISCONNECT
#ALARM reconnect {+@time} {#CONNECT}
</value>
</trigger>
|
This will match on any name, but will need an integer for the number of hours (1, 2, 6, etc., but not 1.5). Upon a match, it captures the length of time in hours in the local varialbe $timer, and then converts to seconds and saves in a regular variable @time. You can use a local variable for this if you want as well. It then disconnects and creates an alarm called reconnect that will fire after that amount of elapsed time and execute the #connect command. The alarm will be deleted once it executes the command.
You will likely need to make some adjustments, however. First, I expect you will want to modify the trigger pattern to match the specific text your mud sends in case of a tell. You could put a ^ at the start of the pattern to ensure that this only occurs at the start of a line, for instance. Secondly, you may well want to filter the input such that you don't disconnect just because somebody that you've never heard of tells you to disconnect. So you may want to create a stringlist with the names of such characters that you want to allow this and use that in place of the * in the pattern. This could be a stringlist or you could enter it manually into the pattern, such as {Bill|Bob|Frank} tells you... This will match the pattern without capturing it. If you have a variable @names with these names in it, your pattern would be {@names} tells you...
Mike
edit - I just realized that you posted this in the zMUD forum rather than CMUD. For zMUD you'll have to change the local variable $timer to a normal variable, since zmud does not have local variables. In that case eliminate the $ in the first line of the actual script where timer is assigned to the value from %1, and on the next line replace $timer with @timer. I believe that it should work with just those changes - and would work in CMUD as well. |
|