[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]  General
. . -> [Subject]  Help with Triggers, Is This Possible?...
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Help with Triggers, Is This Possible?...

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


Pages: 1 2  3  

Posted by Onoitsu2   USA  (248 posts)  [Biography] bio
Date Sat 25 Feb 2006 07:13 AM (UTC)
Message
I am attempting to "Omit from Output" only 1 "word" in the same mannar that you would do to color it, and am having no luck. I have looked over all the MC documentation and have not seen a specific limitation spelled out, nor have I seen it put in to example of how to do such a thing ...

for the time being I have used it to color the "word" as black on black so I do not see it. I want this as I have a magical vision that shows things like:

(Magical) (Blue Aura) (Glowing) (Humming) <ItemNameHere>[1]

The glowing and humming I want there but the magical and blue aura i do not wish to see ... and sometimes an item will not have all, or not all items will have the magical at the front, it may be in any position for that matter ... just depending on the order of spells cast on the item.

I hope that someone is able to assist me on this matter ...

Thanks,
Onoitsu2
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Sat 25 Feb 2006 06:57 PM (UTC)
Message
One of the characteristics of MUSHclient is that triggers cannot actually change lines, one of the reasons being they have already been written to the screen before the trigger fires.

What you can do however, is call a script, which mangles up the original line (eg. omitting parts, changing others) and output that using the world.Note function.

Combine that with omitting the original line, and you effectively can do what you want.

- 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 Sat 25 Feb 2006 10:37 PM (UTC)
Message
Isn't there also now something that allows you to send a line back to Mushclient, so its treated as though it came from the mud? So, you could use the packet capture functions to get the line, change it, then send it back to Mushclient to be processed normally. It would mean making your own matching functions, instead of using Mushclient's exiting trigger system, but it should now be possible, as of the last few version.

Or was I just imagining things? ;) lol
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Sat 25 Feb 2006 11:33 PM (UTC)
Message
The "simulate input" function was really intended for debugging. Potentially your suggestion could either cause MUSHclient to go into a loop, reprocessing the same line, or simply process things out of sequence.

I think my suggestion will work fairly well.

- Nick Gammon

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

Posted by Shadowfyr   USA  (1,783 posts)  [Biography] bio
Date Reply #4 on Sun 26 Feb 2006 04:56 PM (UTC)
Message
Hmm. Yeah, in some cases it might loop. Depends on how you design the code for it. Your idea unfortunately is a) more complicated to make work right, b) won't correctly match on any triggers after the one that omits it, especially if the trigger matches the "final" version that removes/adds a word {though this could be considered bad trigger design anyway} and c) gets damned complicated when you need to preserve colors. Using simulate might not have been intended for doing it, but it does solve all three issues with trying to use omit, when you are significantly changing a lines contents. Since you would most likely need to use OnPluginPacketRecieved to do it correctly, does Simulate fee dthrough that anyway? If it does, then there may still be solutions, like dropping ESCESCESCm at the start. This is invalid ANSI, but is unlikely to come from a mud, shouldn't effect how the line gets processed and would be easilly detectable in the packet testing stage, thus showing that the line had already been altered. You just look for it, and return True, without any other testing or alterations.
[Go to top] top

Posted by Horsey   (2 posts)  [Biography] bio
Date Reply #5 on Fri 24 Mar 2006 12:49 PM (UTC)
Message
hi hi.

just a heads up, but I am a complete noob. :)

I want to omit my 'send' info for a trigger. If I click the omit from output box it omits both the send info and the actual trigger. I just want to omit the send info. Anyone?
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #6 on Fri 24 Mar 2006 09:45 PM (UTC)
Message
Change the send text to:

SendNoEcho "whatever you want to send"

Change "send to" to "Script".

Make sure scripting is enabled. I would recommend Lua as the language, however this example will also work with VBscript.

The quotes are required. Here is my test that will "sigh" whenever it sees the word "naga":


<triggers>
  <trigger
   enabled="y"
   match="naga"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>
SendNoEcho "sigh"</send>
  </trigger>
</triggers>


- Nick Gammon

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

Posted by Horsey   (2 posts)  [Biography] bio
Date Reply #7 on Fri 24 Mar 2006 11:52 PM (UTC)
Message
Thank you Mr. Gammon ^_^
[Go to top] top

Posted by Fiendish   USA  (1,641 posts)  [Biography] bio   Global Moderator
Date Reply #8 on Tue 03 May 2011 06:11 PM (UTC)
Message
Nick Gammon said:

One of the characteristics of MUSHclient is that triggers cannot actually change lines, one of the reasons being they have already been written to the screen before the trigger fires.

I've often wondered about that. Why aren't triggers processed before writing to the screen?

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #9 on Tue 03 May 2011 09:33 PM (UTC)
Message
Fiendish said:

Nick Gammon said:

One of the characteristics of MUSHclient is that triggers cannot actually change lines, one of the reasons being they have already been written to the screen before the trigger fires.

I've often wondered about that. Why aren't triggers processed before writing to the screen?

In a similar vein, I'e always been a little curious why the (after omit) send-to isn't the default behavior.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #10 on Wed 04 May 2011 12:13 AM (UTC)
Message
Fiendish said:

I've often wondered about that. Why aren't triggers processed before writing to the screen?


I have to write to the screen as text arrives. Version 0.64 of MUSHclient added this feature:

http://www.gammon.com.au/scripts/showrelnote.php?version=0.64&productid=0

Without it, whilst MUSH games (which it was originally written for, hence the name) worked fine. Whole lines always arrived.

But the first thing a Diku MUD does is say:


Enter your character's name, or type new: 


So without writing to the screen, you didn't see that. And you sat and waited. Then you wrote to Nick Gammon and complained that his client "doesn't work".

So, text is processed (eg, for colours) and then written to the screen immediately. So you see login prompts, and "press <return> to continue" etc. And command prompts for MUDs that have them.

- Nick Gammon

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

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #11 on Wed 04 May 2011 12:14 AM (UTC)
Message
Twisol said:

In a similar vein, I'e always been a little curious why the (after omit) send-to isn't the default behavior.


Backwards compatibility. There are always better ways of doing things if you don't mind breaking existing scripts / configurations.

- Nick Gammon

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

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #12 on Wed 04 May 2011 12:28 AM (UTC)
Message
Nick Gammon said:

Twisol said:

In a similar vein, I'e always been a little curious why the (after omit) send-to isn't the default behavior.


Backwards compatibility. There are always better ways of doing things if you don't mind breaking existing scripts / configurations.

I understand that, I'm just missing what (after omit) would break.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #13 on Wed 04 May 2011 12:37 AM (UTC)
Message
Read here:

http://www.gammon.com.au/forum/?id=6554

From about point 12 downwards ...

The sequence is completely different. For example "normal" send still has the text in the output window. It might want to capture the last 10 lines from the output buffer, say, including the matching line(s).

It isn't yet logged.

OnPluginScreendraw has not yet been called.

Output from (other) triggers that "send to output" hasn't been done yet.

- Nick Gammon

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

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #14 on Wed 04 May 2011 12:41 AM (UTC)
Message
Ahh. Thanks.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[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.


26,758 views.

This is page 1, subject is 3 pages long: 1 2  3  [Next page]

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]