Register forum user name 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 ➜ Bug reports ➜ omit_from_output in trigger not omitting line?

omit_from_output in trigger not omitting line?

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


Posted by George   (9 posts)  Bio
Date Tue 19 Nov 2013 05:26 AM (UTC)
Message
hi, I'm not sure if this is a bug but it's rather puzzling.

I have a trigger that captures prompt variables and sends them to a miniwindow. The full plugin is pasted below. I have omit_from_output on the trigger, but the matched line still echoes to output. Can anyone tell me what I'm doing wrong?

This is with version 4.84.



<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient>

<muclient>
<plugin
   name="Health_Bar_Miniwindow"
   author="Nick Gammon"
   id="48062dcd6b968c590df50f32"
   language="Lua"
   purpose="Shows stats in a mini window"
   date_written="2009-02-24 13:30"
   requires="4.40"
   version="1.0"
   save_state="y"
   >
<description trim="y">
<![CDATA[
Install this plugin to show an info bar with HP, Mana, 
and Movement points shown as a bar.

The window can be dragged to a new location with the mouse.
]]>
</description>

</plugin>

<!--  Triggers  -->

<triggers>
  <trigger
   enabled="y"
   match="^(\d+)\/(\d+)hp fight_timer:(\d+) lag_timer:(\d+) (\d+)qp"
   regexp="y"
   script="do_prompt"
   omit_from_output="y"
   sequence="100"
  >
  </trigger>
</triggers>



<!--  Script  -->


<script>
<![CDATA[


WINDOW_WIDTH = 200
WINDOW_HEIGHT = 100

BACKGROUND_COLOUR = ColourNameToRGB "rosybrown"
FONT_COLOUR = ColourNameToRGB "darkred"
BORDER_COLOUR = ColourNameToRGB "#553333"

function mousedown(flags, hotspot_id)

  -- find where mouse is so we can adjust window relative to mouse
  startx, starty = WindowInfo (win, 14), WindowInfo (win, 15)
  
  -- find where window is in case we drag it offscreen
  origx, origy = WindowInfo (win, 10), WindowInfo (win, 11)
end -- mousedown

function dragmove(flags, hotspot_id)

  -- find where it is now
  local posx, posy = WindowInfo (win, 17),
                     WindowInfo (win, 18)

  -- move the window to the new location
  WindowPosition(win, posx - startx, posy - starty, 0, 2);
  
  -- change the mouse cursor shape appropriately
  if posx < 0 or posx > GetInfo (281) or
     posy < 0 or posy > GetInfo (280) then
    check (SetCursor ( 11))   -- X cursor
  else
    check (SetCursor ( 1))   -- hand cursor
  end -- if
  
end -- dragmove

function dragrelease(flags, hotspot_id)
  local newx, newy = WindowInfo (win, 17), WindowInfo (win, 18)
  
  -- don't let them drag it out of view
  if newx < 0 or newx > GetInfo (281) or
     newy < 0 or newy > GetInfo (280) then
     -- put it back
    WindowPosition(win, origx, origy, 0, 2);
  end -- if out of bounds
  
end -- dragrelease



function do_prompt (name, line, wildcards, styles)

  local hp, max_hp = wildcards [1], wildcards [2]
  hp_line = hp .. "/" .. max_hp .. "hp"

  local ft, lt = wildcards [3], wildcards [4]
  ft_line = "Fight Timer: " .. ft 
  lt_line = "Lag Timer: " .. lt

  local qp = wildcards [5]
  qp_line = qp .. "qp"

  -- fill entire box to clear it
  check (WindowRectOp (win, 2, 0, 0, 0, 0, BACKGROUND_COLOUR))  -- fill entire box
  
  -- Edge around box rectangle
  check (WindowCircleOp (win, 3, 0, 0, 0, 0, BORDER_COLOUR, 0, 2, 0, 1))

  WindowText (win, "fn", hp_line, 5, 7, 0, 0, FONT_COLOUR)
  WindowText (win, "fn", ft_line, 5, 7 + font_height, 0, 0, FONT_COLOUR)
  WindowText (win, "fn", lt_line, 5, 7 + font_height * 2, 0, 0, FONT_COLOUR)
  WindowText (win, "fn", qp_line, 5, 7 + font_height * 3, 0, 0, FONT_COLOUR)



  WindowShow (win, true)
  
end -- do_prompt


function OnPluginInstall ()
  
  win = GetPluginID ()
  font_id = "fn"
  
  font_name = "Fixedsys"    -- the actual font

  local x, y, mode, flags = 
      tonumber (GetVariable ("windowx")) or 0,
      tonumber (GetVariable ("windowy")) or 0,
      tonumber (GetVariable ("windowmode")) or 8, -- bottom right
      tonumber (GetVariable ("windowflags")) or 0
    
  -- make miniwindow so I can grab the font info
  check (WindowCreate (win, 
                 x, y, WINDOW_WIDTH, WINDOW_HEIGHT,  
                 mode,   
                 flags,   
                 BACKGROUND_COLOUR) )

  -- make a hotspot
  WindowAddHotspot(win, "hs1",  
                   0, 0, 0, 0,   -- whole window
                   "",   -- MouseOver
                   "",   -- CancelMouseOver
                   "mousedown",
                   "",   -- CancelMouseDown
                   "",   -- MouseUp
                   "Drag to move",  -- tooltip text
                   1, 0)  -- hand cursor
                   
  WindowDragHandler(win, "hs1", "dragmove", "dragrelease", 0) 
                 
  check (WindowFont (win, font_id, font_name, 9, false, false, false, false, 0, 0))  -- normal
  
  font_height = WindowFontInfo (win, font_id, 1)  -- height
  
  if GetVariable ("enabled") == "false" then
    ColourNote ("yellow", "", "Warning: Plugin " .. GetPluginName ().. " is currently disabled.")
    check (EnablePlugin(GetPluginID (), false))
    return
  end -- they didn't enable us last time
 
end -- OnPluginInstall

function OnPluginDisable ()
  WindowShow (win, false)
end -- OnPluginDisable

function OnPluginSaveState ()
  SetVariable ("enabled", tostring (GetPluginInfo (GetPluginID (), 17)))
  SetVariable ("windowx", tostring (WindowInfo (win, 10)))
  SetVariable ("windowy", tostring (WindowInfo (win, 11)))
  SetVariable ("windowmode", tostring (WindowInfo (win, 7)))
  SetVariable ("windowflags", tostring (WindowInfo (win, 8)))
end -- OnPluginSaveState


]]>
</script>

</muclient>



Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #1 on Tue 19 Nov 2013 08:06 PM (UTC)
Message
I just tested your plugin and the prompt line was omitted.

Template:version Please help us by advising the version of MUSHclient you are using. Use the Help menu -> About MUSHclient.


Do you have other plugins? Maybe one of them is echoing the line.

Template:bug

Please provide a summary of your world configuration:

  • Either use the scripting Immediate window (Ctrl+I) to execute: Debug ("summary")

    or

  • Install the Summary plugin (see "Summary" feature) and type "summary"

Then copy the resulting information from the output window, and paste into a Forum message.

You need version 4.55 onwards of MUSHclient to do this.



Try turning on Game menu -> Trace, and seeing what you see.

- Nick Gammon

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

Posted by George   (9 posts)  Bio
Date Reply #2 on Wed 20 Nov 2013 02:04 AM (UTC)

Amended on Wed 20 Nov 2013 02:18 AM (UTC) by George

Message
I'm on 4.84. A trace and the summary appended below. I am using the chat plugin (based on Aardwolf's I believe) but as far as I can tell that doesn't echo a prompt anywhere.

I just noticed a funny thing which leads me to think the problem is very basic. There is never any prompt in my backscroll; it only ever shows up as the last line in my output.



TRACE: Trace on


TRACE: Matched trigger "^(\d+)\/(\d+)hp fight_timer:(\d+) lag_timer:(\d+) (\d+)qp"
TRACE: Executing trigger script "do_prompt"
look

[....map output....]

TRACE: Matched trigger "^(\d+)\/(\d+)hp fight_timer:(\d+) lag_timer:(\d+) (\d+)qp"
TRACE: Executing trigger script "do_prompt"
TRACE: Matched trigger "[OOC] *"
TRACE: Executing trigger script "chats"

TRACE: Matched trigger "^(\d+)\/(\d+)hp fight_timer:(\d+) lag_timer:(\d+) (\d+)qp"
TRACE: Executing trigger script "do_prompt"
TRACE: Matched trigger "[OOC] *"
TRACE: Executing trigger script "chats"

TRACE: Matched trigger "^(\d+)\/(\d+)hp fight_timer:(\d+) lag_timer:(\d+) (\d+)qp"
TRACE: Executing trigger script "do_prompt"
TRACE: Matched trigger "[OOC] *"
TRACE: Executing trigger script "chats"

TRACE: Matched trigger "^(\d+)\/(\d+)hp fight_timer:(\d+) lag_timer:(\d+) (\d+)qp"
TRACE: Executing trigger script "do_prompt"
TRACE: Executing Plugin Chat_Capture_Miniwindow script "mw_565dae21eb816a2fdb8d50f9_movewindow_info.mouseover"
TRACE: Executing Plugin Chat_Capture_Miniwindow script "mw_565dae21eb816a2fdb8d50f9_movewindow_info.cancelmouseover"
TRACE: Trace off


And here's my summary:


------------- MUSHclient summary --------------

MUSHclient version: 4.84
Compiled: Sep 30 2012.
Time now: Tuesday, November 19, 2013, 5:59 PM
Client running for:  6d 22h 53m 29s
World opened for:    1d 18h 15m 04s
World connected for: 0d 00h 01m 52s
Operating system: Windows XP
Libraries: Lua 5.1.4, PCRE 8.31, PNG 1.5.12, SQLite3 3.7.14, Zlib 1.2.5
World name: 'ASSAULT', ID: cd42a568a29e03d21c31cdfc
-- Scripting --
Script language: Lua, enabled: yes
Scripting active: yes
Lua sandbox is 127 characters, DLL loading allowed: yes
Scripting prefix: ''. External editor in use: NO.
Scripting for: 41.336172 seconds.
-- Triggers, aliases, timers, variables --
** Triggers: 0 in world file, triggers enabled: yes.
   0 enabled, 0 regexp, 0 attempts, 0 matched, 0.000000 seconds.
** Aliases: 1 in world file, aliases enabled: yes. [Aliases]
   1 enabled, 0 regexp, 7771 attempts, 0 matched, 0.067873 seconds.
** Timers: 0 in world file, timers enabled: yes.
   0 enabled, 0 fired.
   Timers checked every 0.1 seconds.
** Variables: 0.
-- MCCP --
MCCP active, took 0.647312 seconds to decompress
MCCP received 863725 compressed bytes, decompressed to 26739208 bytes.
MCCP compression ratio was:    3.2% (lower is better)
-- Plugins (Processing order) --
ID: 48062dcd6b968c590df50f32, 'Health_Bar_Miniwindow', (Lua, 5.928 s) Enabled [Tr Va Cb]
ID: 565dae21eb816a2fdb8d50f9, 'Chat_Capture_Miniwindow', (Lua, 20.226 s) Enabled [Tr Al Va Cb]
** Plugins: 2 loaded, 2 enabled.
-- Comms --
Connect phase: 8 (Open). NAWS wanted: NO
Received: 876317 bytes (855 Kb)
Sent: 135758 bytes (132 Kb)
Received 31 packets, sent 11 packets.
Total lines received: 182247
This connection: Sent 9 lines, received 240 lines.
Telnet (IAC) received: DO: 0, DONT: 0, WILL: 16, WONT: 4, SB: 12 [Telnet]
-- MXP --
MXP active: yes, Pueblo mode: NO, Activated: On command
MXP tags received: 24
MXP entities received: 0
MXP errors: 0
-- Commands --
Commands in command history: 1000
Speed walking enabled: NO. Speed walking prefix: #
Command stacking enabled: yes. Command stack character: ';'
Accelerators defined: 0
-- Miniwindows --
Window: '48062dcd6b968c590df50f32', at (1044,804,1244,904), shown: yes
        width: 200, height: 100, position: 0, hotspots: 1, fonts: 1, images: 0
Window: '565dae21eb816a2fdb8d50f9', at (7,0,909,146), shown: yes
        width: 902, height: 146, position: 0, hotspots: 6, fonts: 2, images: 0
** Miniwindows: 2 loaded, 2 shown.
-- Output window --
Output pixels: width 1255, height: 881, font width: 10, font height: 18
               can show 125 characters, wrapping at column 110, height 48 lines.
Output buffer: 4969 of 5000 lines.
-- Miscellaneous --
Logging: NO, tracing: NO
** SQLite3 databases: 0
Sound buffers in use: 0

---------------------- End summary ----------------------


Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #3 on Wed 20 Nov 2013 10:40 AM (UTC)
Message
George said:

I just noticed a funny thing which leads me to think the problem is very basic. There is never any prompt in my backscroll; it only ever shows up as the last line in my output.


So it is being omitted then?

Template:faq=11 Please read the MUSHclient FAQ - point 11.


- Nick Gammon

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

Posted by George   (9 posts)  Bio
Date Reply #4 on Thu 21 Nov 2013 03:14 AM (UTC)
Message
Thank you Nick, that pointer is what I needed! I turned on Telnet GA on the mud and the option in mushclient to convert GA to a newline.

So if I understand this correctly, the mud was sending a prompt without a newline, so it would sit at the bottom of my output and wait for a newline. When that came in, mushclient would match on the trigger and omit it, but the next prompt would be sitting waiting for the newline, so it looked like I was getting the prompt (but not in the backscroll).

Thanks very much for your help.
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #5 on Thu 21 Nov 2013 07:26 PM (UTC)
Message
That's right.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


18,151 views.

It is now over 60 days since the last post. This thread is closed.     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.