[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Add_Newline_To_Prompt Plugin

Add_Newline_To_Prompt Plugin

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


Posted by Mike.mac.kenzie   (13 posts)  [Biography] bio
Date Sat 02 Dec 2023 09:08 AM (UTC)
Message
Hello there MUSHclient users.

I'm currently working on an autosipper, but I have prompt issue where it does not sip automatically and requires me to hit enter or requires another line to happen in the game before the trigger actually fires. I found a plugin that should solve this issue, it's called Add_Newlie_To_Prompt and is supposed to force the autosipper to fire properly by basically faking a newline on prompt

The problem I am having is that when I use the plugin and enable it, my prompt completely disappears. Can anyone help me figure out what I may be doing wrong here?
[Go to top] top

Posted by Nick Gammon   Australia  (23,016 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Mon 04 Dec 2023 08:23 AM (UTC)
Message
Can you give a link to the exact plugin you used?

- Nick Gammon

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

Posted by Mike.mac.kenzie   (13 posts)  [Biography] bio
Date Reply #2 on Tue 05 Dec 2023 06:53 AM (UTC)
Message
https://gammon.com.au/forum/bbshowpost.php?bbsubject_id=5020

There is the link that I got the plugin from.
[Go to top] top

Posted by Nick Gammon   Australia  (23,016 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Tue 05 Dec 2023 07:33 AM (UTC)
Message
There is more than one plugin in that thread. Can you give the "id" of the one you are using? Or just copy/paste it here?

Have you read all of that thread? It appears to be about autosippers.

- Nick Gammon

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

Posted by Mike.mac.kenzie   (13 posts)  [Biography] bio
Date Reply #4 on Wed 06 Dec 2023 08:13 PM (UTC)

Amended on Sun 10 Dec 2023 06:57 AM (UTC) by Nick Gammon

Message
Here is the plugin I used. It appears to be the top plugin posted on the page I posted the URL for. It is definitely about autosippers. I am trying to get my own autosipper working, but it does not fire properly on the prompt. I have to enter a newline after the prompt manually, to get it to fire.


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient[
  <!ENTITY prompt_regexp "^\\x1B\\[0m&lt;.+hp .+m .+mv .+xp&gt; $" > 
]>
<!-- MuClient version 3.59 -->

<!-- Plugin "Add_Newline_To_Prompt" generated by Plugin Wizard -->

<muclient>
<plugin
   name="Add_Newline_To_Prompt"
   author="Nick Gammon"
   id="8316c19c35a9ebdb46055874"
   language="Lua"
   purpose="Adds a newline to prompt lines"
   date_written="2004-12-13 12:08:00"
   requires="3.59"
   version="1.0"
   >
<description trim="y">
Detects prompt lines without a newline, and if found, adds one.

Change ENTITY line on 3rd line of plugin to be a regular expression 
that matches your prompt.

</description>

</plugin>

<!--  Script  -->

<script>

  re = rex.new ("&prompt_regexp;")

<![CDATA[

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

function OnPluginPacketReceived (s)

  -- add packet to what we already have (excluding carriage-returns)
  
  partial = partial .. string.gsub (s, "\r", "")
  
  t = {}  -- table of lines to be returned
  
  -- iterate over each line
  
  partial = string.gsub (partial, "(.-)\n", 
    function (line) 
     table.insert (t, line) 
     return "" -- added for MUSHclient 3.80+
    end)
  
  -- look for prompt

  if (re:match (partial)) then
    table.insert (t, partial)
    partial = ""
  end -- if found prompt

  if table.getn (t) > 0 then
    table.insert (t, "")  -- to get final linefeed
  end -- if
    
  -- return table of lines, concatenated with newlines between each one
  return table.concat (t, "\n")
  
end -- function OnPluginPacketReceived
]]>
</script>

</muclient>
[Go to top] top

Posted by Nick Gammon   Australia  (23,016 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Sun 10 Dec 2023 06:58 AM (UTC)
Message
OK, now what we need you to do is show your exact prompt. Copy/paste from some MUD output into a reply.

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,016 posts)  [Biography] bio   Forum Administrator
Date Reply #6 on Sun 10 Dec 2023 06:59 AM (UTC)
Message
Meanwhile, you could try the second plugin on that page.

- Nick Gammon

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

Posted by Mike.mac.kenzie   (13 posts)  [Biography] bio
Date Reply #7 on Mon 11 Dec 2023 11:39 PM (UTC)
Message
My prompt has 3 options.

920/920h 115/115m >
920/920h 115/115m u>
920/920h 115/115m f>

Here is what I was using for regexp version of my prompt, within the plugin.

^(.*?)\/(.*?)h (.*?)\/(.*?)m(.*?)\>$

I also tried the "small fix" where you posted to copy and paste the following over the old version of the same part of the code.

partial = string.gsub (partial, "(.-)\n",
function (line)
table.insert (t, line)
return ""
end)

I also tried the second simpler version of the plugin but it did not work.
[Go to top] top

Posted by Fiendish   USA  (2,525 posts)  [Biography] bio   Global Moderator
Date Reply #8 on Tue 12 Dec 2023 05:15 PM (UTC)
Message
"\/" and "\>" are not valid pattern components because / and > do not need to be escaped.

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

Posted by Nick Gammon   Australia  (23,016 posts)  [Biography] bio   Forum Administrator
Date Reply #9 on Wed 13 Dec 2023 06:46 AM (UTC)
Message
When matching incoming packets, the match text has to be exact, including any ANSI colour codes that might be there. To find what they are, we need to see an exact packet.

To do that, go to the Edit menu -> Debug Packets, and then grab a couple of prompts. Turn off Debug Packets afterwards.

Another window will open with the packet information in hex.

Copy/paste that into a reply. Thank you.

- Nick Gammon

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

Posted by Mike.mac.kenzie   (13 posts)  [Biography] bio
Date Reply #10 on Sat 23 Dec 2023 02:12 PM (UTC)

Amended on Sun 24 Dec 2023 08:03 AM (UTC) by Nick Gammon

Message

Incoming packet: 4642 (2 bytes) at Saturday, December 23, 2023, 9:10:00 AM

..                 0d 0a

Incoming packet: 4643 (77 bytes) at Saturday, December 23, 2023, 9:10:00 AM

You snore and tu   59 6f 75 20 73 6e 6f 72 65 20 61 6e 64 20 74 75
rn in your sleep   72 6e 20 69 6e 20 79 6f 75 72 20 73 6c 65 65 70
....[0;0m3560.[0   2e 0d 0a 1b 5b 30 3b 30 6d 33 35 36 30 1b 5b 30
;0m/3560h 445.[0   3b 30 6d 2f 33 35 36 30 68 20 34 34 35 1b 5b 30
;0m/445m > ÿù      3b 30 6d 2f 34 34 35 6d 20 3e 20 ff f9

Sent  packet: 3591 (5 bytes) at Saturday, December 23, 2023, 9:10:05 AM

who..              77 68 6f 0d 0a

Incoming packet: 4644 (20 bytes) at Saturday, December 23, 2023, 9:10:05 AM

You are fast asl   59 6f 75 20 61 72 65 20 66 61 73 74 20 61 73 6c
eep.               65 65 70 2e

Incoming packet: 4645 (44 bytes) at Saturday, December 23, 2023, 9:10:05 AM

...[0;0m3560.[0;   0d 0a 1b 5b 30 3b 30 6d 33 35 36 30 1b 5b 30 3b
0m/3560h 445.[0;   30 6d 2f 33 35 36 30 68 20 34 34 35 1b 5b 30 3b
0m/445m > ÿù       30 6d 2f 34 34 35 6d 20 3e 20 ff f9

Sent  packet: 3592 (5 bytes) at Saturday, December 23, 2023, 9:10:06 AM

who..              77 68 6f 0d 0a
[Go to top] top

Posted by Nick Gammon   Australia  (23,016 posts)  [Biography] bio   Forum Administrator
Date Reply #11 on Sun 24 Dec 2023 08:10 AM (UTC)
Message
Your prompts end with IAC GA (0xFF 0xF9).

I suggest you try checking "Convert IAC EOR/GA to newline" in the world configuration -> Appearance -> Output tab.

If that works, throw away the plugin.

- Nick Gammon

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

Posted by Mike.mac.kenzie   (13 posts)  [Biography] bio
Date Reply #12 on Fri 29 Dec 2023 06:10 AM (UTC)
Message
That worked Nick!! Thank you!
[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.


5,049 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 HostDash]