Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Entire forum
➜ MUSHclient
➜ General
➜ Escape Characters in Trigger
Escape Characters in Trigger
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Gesslar
(24 posts) Bio
|
Date
| Sun 12 Feb 2012 07:17 PM (UTC) |
Message
| 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 | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #1 on Sun 12 Feb 2012 08:11 PM (UTC) |
Message
| 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". |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Gesslar
(24 posts) Bio
|
Date
| Reply #2 on Sun 12 Feb 2012 08:20 PM (UTC) |
Message
| Is there any sample code that I might look at that uses this? as lua? | Top |
|
Posted by
| Gesslar
(24 posts) Bio
|
Date
| Reply #3 on Sun 12 Feb 2012 08:24 PM (UTC) |
Message
| I may have found some, don't worry about it. | Top |
|
Posted by
| Twisol
USA (2,257 posts) Bio
|
Date
| Reply #4 on Sun 12 Feb 2012 08:58 PM (UTC) |
Message
| 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 |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | Top |
|
Posted by
| Gesslar
(24 posts) Bio
|
Date
| Reply #5 on Sun 12 Feb 2012 10:22 PM (UTC) |
Message
| 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. | Top |
|
Posted by
| Gesslar
(24 posts) Bio
|
Date
| Reply #6 on Sun 12 Feb 2012 10:43 PM (UTC) |
Message
| I wonder if implementing this on the server-side is going to be a huge pain in the butt. | Top |
|
Posted by
| Nick Gammon
Australia (23,046 posts) Bio
Forum Administrator |
Date
| Reply #7 on Mon 13 Feb 2012 08:15 AM (UTC) Amended on Tue 26 Nov 2013 03:31 AM (UTC) by Nick Gammon
|
Message
| |
Posted by
| Gesslar
(24 posts) Bio
|
Date
| Reply #8 on Wed 15 Feb 2012 04:37 AM (UTC) |
Message
| 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!
| Top |
|
Posted by
| KaVir
Germany (117 posts) Bio
|
Date
| Reply #9 on Wed 15 Feb 2012 12:30 PM (UTC) |
Message
|
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
| 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.
31,429 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top