Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, 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 ➜ Plugins ➜ Prompt NewLine Plug-in

Prompt NewLine Plug-in

Posting of new messages is disabled at present.

Refresh page


Pages: 1  2 

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #15 on Mon 23 Mar 2009 03:59 AM (UTC)
Message
Quote:

But now I'm totally confused as to how matching the prompt as it's seen is messed up by colour code that's not seen.


The plugin takes the raw packet of data as received by the MUD. Any colour codes need to be considered, because they are there, even if later on they are stripped out and turned into colours.

You can see that a test for "<1000hp" is not going to match:


0;37m<.[1;33m1000hp


My amended function is below. I tested it against the packet you supplied and it worked. :)

Basically I added in this sequence whereever I saw the colour codes:


\027[^m]+m


This is matching on:


  • <esc> (represented by \027)
  • Anything other than "m", one or more times (represented by [^m]+)
  • The "m" that terminates the colour code sequence


Just replace the OnPluginPacketReceived function with below:


function OnPluginPacketReceived (s)
  return (string.gsub (s, "\n\027[^m]+m\027[^m]+m<\027[^m]+m%d+hp \027[^m]+m%d+m \027[^m]+m%d+mv\027[^m]+m> <#%d+> ", "%1\n"))
end -- function OnPluginPacketReceived


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #16 on Mon 23 Mar 2009 04:02 AM (UTC)
Message
Quote:

aka: Hana
Owner in Training of: Fury of the Gods


If you have the power to change the MUD, it might simplify things to give players the ability to put the newline into their prompt, thus saving all this messing about. You could add a new token (eg. where %h is hitpoints) like %n to be a newline.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Hanaisse   Canada  (114 posts)  Bio
Date Reply #17 on Mon 23 Mar 2009 04:29 AM (UTC)
Message
Ahh, success!! :)

Thank you so much for bearing with me.

Yes I have the power but unfortunately my coder has gone AWOL. I will definitely keep this on a to-do list.

Shame the SmaugFUSS guys haven't added this in. Surely I can't be the only one who was annoyed by this, lol.

Many thanks again. Now on to try adding the new Icon Bar plug-in ;)

aka: Hana
Owner in Training of: Fury of the Gods
alm-dev.org:4000
Top

Posted by Samuel Pang   (4 posts)  Bio
Date Reply #18 on Mon 21 Dec 2009 06:30 AM (UTC)
Message
I've got the same very problem which Hanaisse got with the commands/statements continuing after the prompt. I've tried to do the same thing he did, like copy the Prompt_Newline code into the Plugin Wizard, but I got an error when I tried creating the Plugin, saying:

script may not contain the sequence "]]>"

And then I'm stumped. I'm not sure how to amend it because MUSHclient's really new to me. Could someone help me with this?
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #19 on Mon 21 Dec 2009 06:47 AM (UTC)
Message
The wizard automatically puts:


<![CDATA[

... your script here ...

]]>


So, don't copy in the ]]> yourself, assuming that is what you did.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Samuel Pang   (4 posts)  Bio
Date Reply #20 on Tue 22 Dec 2009 08:57 AM (UTC)
Message
Thanks! Ok, so I've copied the script and created a plugin just like Hanaisse, plus added the amendments that were made:

<script>
<![CDATA[

partial = "" -- partial line from last time through


function OnPluginPacketReceived (s)
return (string.gsub (s, "\n\027[^m]+m\027[^m]+m<\027[^m]+m%d+hp \027[^m]+m%d+m \027[^m]+m%d+mv\027[^m]+m> <#%d+> ", "%1\n"))
end -- function OnPluginPacketReceived

]]>
</script>

However, even after reinstalling the plugin, I'm still getting a result as shown below"

H:141 M:1128 E:3330 W:4770 B:100% XP:34% [eb]You bare your teeth and your claws lash out at a tiny pincher.

I wonder what I did wrong.
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #21 on Tue 22 Dec 2009 06:22 PM (UTC)
Message
I would have to see the raw prompt as it arrives from the MUD. Please turn on Edit menu -> Packet Debug, bring up a prompt like you showed, and then copy and paste the packet debug information here (then turn the packet debug off again).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #22 on Wed 23 Dec 2009 04:26 AM (UTC)
Message
OK, so a prompt looks like:


\1b[37mH:0 \1b[32mM:1174 \1b[37m\1b[32mE:3846 \1b[37m\1b[32mW:5249 \1b[37m\1b[1;31mB:100% \1b[0;37mXP:40% [eb]\ff\f9


First thing I notice is the \ff\f9 at the end of the prompt. That is IAC/GA, so you simply need to go to the output window configuration and check "Convert IAC EOR/GA to new line". Then you shouldn't need the plugin at all.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #23 on Wed 23 Dec 2009 04:27 AM (UTC)
Message
My reply doesn't make as much sense as you deleted your message, but my suggestion still stands.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Samuel Pang   (4 posts)  Bio
Date Reply #24 on Wed 23 Dec 2009 01:12 PM (UTC)
Message
So very sorry, I deleted the post because I realized that when I copied the Packet Debug, I deleted the plugin away before copying it to you. But I guess the plugin doesn't effect the debug from what you were saying in the last post.

I've checked the "Convert IAC EOR/GA to new line" in the output configuration, and it worked! Thank you so very much! Thank you for your patience with me as well!
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.


69,603 views.

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

Posting of new messages is disabled at present.

Refresh page

Go to topic:           Search the forum


[Go to top] top

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