[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]  Escape Characters in Trigger
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Escape Characters in Trigger

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


Posted by Gesslar   (18 posts)  [Biography] 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
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] 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
[Go to top] top

Posted by Gesslar   (18 posts)  [Biography] 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?
[Go to top] top

Posted by Gesslar   (18 posts)  [Biography] bio
Date Reply #3 on Sun 12 Feb 2012 08:24 PM (UTC)
Message
I may have found some, don't worry about it.
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] 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
[Go to top] top

Posted by Gesslar   (18 posts)  [Biography] 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.
[Go to top] top

Posted by Gesslar   (18 posts)  [Biography] 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.
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] 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
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

- Nick Gammon

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

Posted by Gesslar   (18 posts)  [Biography] 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!
[Go to top] top

Posted by KaVir   Germany  (117 posts)  [Biography] 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
[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.


7,759 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]