Escape Characters in Trigger

Posted by Gesslar on Sun 12 Feb 2012 07:17 PM — 10 posts, 45,218 views.

#0
Hi there, I'm an admin for ThresholdRPG and I have a question regarding triggering on escapes.

I want to send data to the client to be caught via trigger and update information on the client side. I would prefer to send the text wrapped in a specific escape sequence, sample to follow, and was wondering how to get it caught.

Second question, in my testing, I set omit_from_output but it doesn't seem to work very well if the line coming in isn't terminated by a \n. Perhaps it's my regex? I'm not sure. Any ideas on that might be helpful as well.

---

Sample Information:
\e|stats:10/10;10/10;10/10\e|

\e = escape character
USA #1
Triggers only run when a newline is reached. If your line lacks a newline, it's considered a partial line, and triggers won't run until a newline is reached.

Have you looked into Telnet subnegotiations? Protocols like GMCP send data as part of a subnegotiation packet, which is automatically not displayed by a decent client. Example:

(Negotiate the GMCP protocol to be enabled
(client) IAC DO GMCP
(server) IAC WILL GMCP

(Send a hello message to begin)
(client) IAC SB GMCP Core.Hello {"client": "MUSHclient", "version": "4.81"} IAC SE

(Enable the char package)
(client) IAC SB GMCP Core.Supports.Add ["Char 1"] IAC SE

(Later, the server may send a stats message)
(server) IAC SB GMCP Char.Stats {"health": [10, 10], "mana": [10, 10], "stamina": [10, 10]} IAC SE



On MUSHclient's side, you'd want a GMCP plugin (Nick and I both provide versions) in order to make the messages available to other code.


If you prefer a trigger-based approach, I'd recommend using something more similar to Aardwolf's tags. (I may get this wrong, I don't play Aard, but I know the concept's the same):

{stats}10/10;10/10;10/10{/stats}


Here, there'd be a newline after the {/stats} tag. The only reason I recommend against using \e as the escape is because that's already used for ANSI color codes, i.e. "\e[35;43mMagenta on Yellow\e[0m".
#2
Is there any sample code that I might look at that uses this? as lua?
#3
I may have found some, don't worry about it.
USA #4
I have a bunch of GMCP-based plugins (as well as the one GMCP plugin that makes the data available) on my website: http://jonathan.com/mushclient-achaea-plugins
#5
Does MUSHclient send (client) IAC DO GMCP or is it the GMCP base plugin send that? Or do I have to put that in all of my plugins?

I'm INCREDIBLY nubbish about this sort of thing (plugin writing) and do really appreciate the help.

If I someone would be available on gtalk (I'm karahd@gmail.com) I would like to pick some brains in real time, if possible.
#6
I wonder if implementing this on the server-side is going to be a huge pain in the butt.
Australia Forum Administrator #7
No, not really.

Playing a MUD game with MUSHclient




Quote:

I want to send data to the client to be caught via trigger and update information on the client side.



I've done a number of posts about that, with supporting code.

http://www.gammon.com.au/forum/?id=10043
Amended on Tue 26 Nov 2013 03:31 AM by Nick Gammon
#8
Good Lord. This was a trial and a half. If ANYBODY EVER ASKS, if you're using MudOS, one of the applies that may be undocumented is:


void telnet_suboption(string mess) {
        // put stuff here to handle it
}


This needs to be in one of your inheritable that gets used for your interactive objects.

I'm probably going to make an inheritable strictly for this communication processing.

Whew!
Germany #9
Gesslar said:
I want to send data to the client to be caught via trigger and update information on the client side. I would prefer to send the text wrapped in a specific escape sequence, sample to follow, and was wondering how to get it caught.

My first post on these forums concerned pretty much exactly the same issue: http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=9560

I documented my experiments on a blog, which may be of interest if you're planning to do something similar: http://godwars2.blogspot.com/2010/11/introduction.html