[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Suggestions
. . -> [Subject]  New trigger option.
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

New trigger option.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Shadowfyr   USA  (1,783 posts)  [Biography] bio
Date Wed 05 Jun 2002 09:31 PM (UTC)
Message
Having gotten myself banned from a channel today as a result of a rogue trigger I went hunting for a solution.. There wasn't one, at least not anyplace in the list of functions. Two things therefore occured to me. One would be:

world.disablerange #

to disable all triggers with a certain sequence number.

Alternatively and possibly more helpful would be an option that disables the trigger after the first time it hits. For testing purposes this would be very helpful, since messing up by doing something like:

[ A new player named (*.) has entered the realm ]

and forgetting the / in front of the [ and ] is not at all a good thing. lol
[Go to top] top

Posted by Nick Gammon   Australia  (21,652 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Wed 05 Jun 2002 11:17 PM (UTC)
Message
The new plugins feature should address most of those concerns.

For a start, if the rogue trigger was in a plugin you could simply uninstall the plugin and it would immediately stop firing (indeed, by doing this you would uninstall every trigger/alias/timer associated with the plugin).

Second, there is now a "plugin enable/disable" so you can effectively enable or disable a group of things (ie., the whole plugin) in a single command.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Shadowfyr   USA  (1,783 posts)  [Biography] bio
Date Reply #2 on Thu 06 Jun 2002 05:03 PM (UTC)
Message
Neither of which does a lot of good. For testing purposes it is better if it only happens the one time, then disables itself. I ended up going into the trigger edit and deleting the offending trigger, but by then it was too late. Just about 'any' method that requires going through the menus or trigger edit or trying to desperately remember a command and trype it to disable the trigger will take more time than you can afford if a trigger goes rogue and spams a communication channel. In retrospect I would rather have an auto-disable option like 'test this once' or something, since other options while useful don't really address this specific problem. It is a lot easier to fix something if you don't get banned for an unspecified time from the channel you where trying to send it to in the first place. ;)
[Go to top] top

Posted by Vaejor   (120 posts)  [Biography] bio
Date Reply #3 on Thu 06 Jun 2002 11:54 PM (UTC)
Message
There's 2 easy ways to get something like this working.

First: you can create a script called disable_self or somesuch. The purpose for the script is to use the name of the trigger it is sent and disable that trigger. Fairly easy to write and insert into any trigger to cause it to disable itself after the first hit. I haven't tested it myself, so I'm not sure how it will work in the end, but it should be something worth testing.

Second: Anytime you are creating a trigger that results in output being put over a medium that could cause annoyances to other people, try to send to 'Output' or world.Note the output while testing it. You can verify how it looks and have everything setup before you fully insert it, and no one will notice any debugging that you might need to do to get it working just right.
[Go to top] top

Posted by Shadowfyr   USA  (1,783 posts)  [Biography] bio
Date Reply #4 on Fri 07 Jun 2002 04:11 PM (UTC)
Message
Both interesting ideas, but you have to remember to use them. An obvious switch would have been less likely for me and possibly others to forget though. In any case I have decided to employ an alias in this case instead, triggers while being slightly more convinient in some respects are at times a little too dangerous. ;) lol
[Go to top] top

Posted by Nick Gammon   Australia  (21,652 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Fri 07 Jun 2002 10:47 PM (UTC)
Message
I can add an "auto-disable when fired" option, but you are still going to have to remember to click on it.

Vaejor's suggestion was good, I was going to suggest something similar. A "disable_self" script in your script file could always be used in those situations.

Make a nice short name like "DS" and typing that into the "script" window isn't much more effort than clicking a check box, both of which you have to remember to do.

In your case you could have saved some heartache my making a non-regular expression trigger, namely:

[ A new player named * has entered the realm ]

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Shadowfyr   USA  (1,783 posts)  [Biography] bio
Date Reply #6 on Fri 07 Jun 2002 11:50 PM (UTC)
Message
Actually not really. The mud has some odd quirks and I often need to add ^([ ]*) to every thing to deal with a leading space that happens if the prompt ends up on the same line as the incoming text. Basically I tell it to add a linefeed to the prompt and it automaically adds an extra space as though the prompt was still 'Date, Time>' without the linefeed. Bugs the heck out of me and without this glitch a lot of stuff would be easier. However if I don't use regular expressions then I am forced to test like '*[ whatever ]' and that means any matches in tells, channels, etc. will also hit. I suggested some attempt bo made to fix this, but it is a non-critical thing and thus may never get fixed. In any case you are right that you would still need to remember, so it is not a major issue. I changed it to an alias anyway.
[Go to top] top

Posted by Magnum   Canada  (580 posts)  [Biography] bio
Date Reply #7 on Sat 08 Jun 2002 11:49 AM (UTC)
Message
If your prompt is simply a ">", as mine is, then:

Make the trigger without regular expressions.
Click the button "Convert to regular expression".
Instead of the ^ at the beginning of the expression, replace it with:

^(> )*

You are done. If you have a fancy prompt, create a regular expression that checks for the prompt, and debug it to make sure it's working, then use that instead of what I provided. You triggers should be foolproof.

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
[Go to top] top

Posted by Shadowfyr   USA  (1,783 posts)  [Biography] bio
Date Reply #8 on Sat 08 Jun 2002 06:26 PM (UTC)
Message
Well it is:

Date, Time Ex = 'free experience'>'cr-lf'

but the mud stupidly adds a space to the following line so new information after a prompt arrives as ' new-stuff' (note the leading space), instead of on a real new line. I consider this a bug, but it is not one that will likely be fixed anytime soon. As to adding junk to a regular expression to deal with the entire sequence... You would need two triggers for every event, one with and one without, or an extremely complicated one that deals with both situations. If I did the second the amount of extra junk I would likely need to add to them would shove most of the stuff I am really checking for off into limbo and it would be very hard to tell what each trigger actually did from the edit window. What I am using works fine, since all I need to look for is a single extra space, but if the prompt with a line-feed at the end worked as expected on AoD then I wouldn't need to even look for that. It is just a little annoying, but not a major problem. In any case most of mine have already been fool-proofed where I need it.
[Go to top] top

Posted by Magnum   Canada  (580 posts)  [Biography] bio
Date Reply #9 on Sun 09 Jun 2002 08:26 AM (UTC)

Amended on Sun 09 Jun 2002 08:27 AM (UTC) by Magnum

Message

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
                     Topic: prompt
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

You can change your prompt from > to anything you want 
with:  set prompt what_ever_you_want

The string you enter after "prompt" will be printed 
whenever the driver is waiting for command input. 
There are a few replaceable parameters:

$D  --  replaced by your current directory name
\\n --  replaced by "\n" (a newline)
$N  --  replaced by the mud name (lowercase)
$T  --  replaced by the current time
$C  --  replaced by the command number 
        (from your history file)

More useful for players:

$HP      -- your hitpoints
$MAXHP   -- your maximum hitpoints
$CP      -- your concentration points
$MAXCP   -- your maximum concentration points
$EXP     -- your current free exp

If you want to return your prompt to the default, type:

set prompt >

(the "set prompt" returns your prompt for this session to 
normal and the "unset prompt" returns your next session 
prompt to the default)

Related topics: set, unset.

What about using "\\n"? Would that help?

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
[Go to top] top

Posted by Shadowfyr   USA  (1,783 posts)  [Biography] bio
Date Reply #10 on Sun 09 Jun 2002 05:41 PM (UTC)
Message
Sorry Magnum, that is what I am using. As I said the mud incorrectly adds a trailing space to the prompt even when terminated with a \\n, though I believe I found that the docs are also wrong there and you must use \n instead. The \\n didn't work. In any case the code for displaying the prompt 'assumes' that you will be using a string of characters, the newline correctly drops the command to a new line, but still adds the extra space as though it was a normal line. This is the bug I think they need to fix. I have also already posted about it, but... It may be extremely low priority problem, especially since I seem to be the only one that has complained about it.

Just another one of those cases like the auto-wrap you can't turn off for channels, tells and other similar things that the mud does 'for your convenience', but some of us wish it didn't. lol One gets seriously tired of creating cludge code to get around these conveniences. :p
[Go to top] top

Posted by Krenath   USA  (76 posts)  [Biography] bio
Date Reply #11 on Tue 11 Jun 2002 07:16 PM (UTC)
Message
The following code (should) do precisely what you asked for in the first post, Shadowfyr.

I say "should" because I just typed it into Notepad, rather than testing it in MUSHclient. If there are any problems, I'm sure you're as capable of debugging it as I am :)

Quote:

Sub DeleteRange(nSequence)
  dim aTriggers,sTriggerName
  aTriggers= World.GetTriggerList
  If Not IsEmpty (aTriggers) then
    For Each sTriggerName In aTriggers
      If World.GetTriggerInfo(sTriggerName,13)=nSequence Then
        World.DeleteTrigger sTriggerName
      End IF
    Next
  End If
End Sub

DeleteRange(87)


With just a minor change, you can pass the trigger info type number and delete all triggers that match any criteria.

- Krenath from
bDv TrekMUSH
ATS TrekMUSH
TNG TrekMUSE
TOS TrekMUSE
[Go to top] top

Posted by Magnum   Canada  (580 posts)  [Biography] bio
Date Reply #12 on Wed 12 Jun 2002 01:24 AM (UTC)
Message
I know ShadowFyr has already read this at the mud, but I'll repost it here for completeness:

Note  14  Ave          (Tue Jun 11)  Re: Prompt \n

On Tue Jun 11, Magnum wrote:
> The prompt option \n to add a CR\LF to your prompt is bugged, IMO.
> 
> That option actually adds CR\LF, and then a SPACE character.
> 
> It would be preferable that the SPACE character not be added.

There is an unofficial way to do that. Just add $_ as the
last characters of your prompt and it won't add the
trailing space.

//// Ave

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


6,386 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]