Aardwolf Consider all miniwindow.

Posted by Blainer on Mon 17 Aug 2009 01:33 AM — 79 posts, 341,636 views.

#0

TIP: Later version

A more up-to-date version is further down this thread, see:

http://www.gammon.com.au/forum/?id=9681&reply=78#reply78


-Fixed a problem where MUSH variables don't get set causing the plugin to stop working.

This plugin displays the output of the 'consider all' command for Aardwolf in a miniwindow.

Features
-Reference Mobiles in the list by number from the command line.
-Set a default command to execute on click or from command line.
-Shows Nick's consider colours and levels.
-Toggle auto updating the window.
-Mouse click mobile's name to run default command / alias on that mobile.

Commands
conw - update window with consider all command.
<num> <word> - Execute <word> with keyword from line <num> on consider window.
<num> - Execute with default word.
conw <word> - set default command.
conw chng - swop keyword from beginning of name to end of name or vice-versa.
conw auto - toggle auto update consider window on room entry and after combat.
conw ? - show this help.


The way I see it being used is to like this.
You create an alias in MUSH that you use when you attack a mobile.
You then set the default command with 'conw <word>' to that alias.
Now you can just enter a number to pass the keyword to the alias.

For example I have this alias I use to start combat

<aliases>
    <alias
        match="ninja *"
        enabled="y"
        sequence="100"
    >
    <send>
        stab "%1"
        bash "%1"</send>
    </alias>
</aliases>

If I type 'ninja ogre' the alias will stab and then bash the ogre.
Now if I use the command 'conw ninja' the plugin will set the default command to 'ninja'.
When I enter a room the consider all window will update with line numbers next to all the mobs
in the room.
Example:
1. Ogre (-19 and below)
2. Goblin (+2 to +4)

To attack the Ogre with the ninja alias I simply enter '1' at the command line and hit enter.
This executes 'ninja Ogre'.
If I enter '2' and hit enter 'ninja Goblin' is executed.

I can create multiple aliases to do different things to a mobile and switch between them using 'conw <word>'
to change the default or I can enter '1 <command>', (command being any alias or MUD command) and then
'<command> Ogre' is sent to the MUD.

To make a macro or an aliase to switch on and off updating window automaticly use:
Note: In a macro you will need to precede this with your script prefix.

Execute ("conw auto")


Template:saveplugin=Aardwolf_Consider_Window
To save and install the Aardwolf_Consider_Window plugin do this:
  1. Copy the code below (in the code box) to the Clipboard
  2. Open a text editor (such as Notepad) and paste the plugin code into it
  3. Save to disk on your PC, preferably in your plugins directory, as Aardwolf_Consider_Window.xml
    • The "plugins" directory is usually under the "worlds" directory inside where you installed MUSHclient.
  4. Go to the MUSHclient File menu -> Plugins
  5. Click "Add"
  6. Choose the file Aardwolf_Consider_Window.xml (which you just saved in step 3) as a plugin
  7. Click "Close"
  8. Save your world file, so that the plugin loads next time you open it.


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Friday, August 14, 2009, 6:13 AM -->
<!-- MuClient version 4.43 -->

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

<muclient>
<plugin
   name="Aardwolf_Consider_Window"
   author="Blainer"
   id="584807a32cf46af04a1bece3"
   language="Lua"
   purpose="Display clickable consider command output."
   save_state="y"
   date_written="2009-08-14 06:12:14"
   requires="4.43"
   version="1.0"
   >
<description trim="y">
<![CDATA[
Put consider info in a miniwindow with commands.
Mostly copied from: http://www.gammon.com.au/forum/bbshowpost.php?id=8847
And: http://www.gammon.com.au/forum/?id=9664
]]>
</description>
</plugin>

<!--  Get our standard constants -->

<include name="constants.lua"/>
<!--  Triggers  -->

<triggers>
  <trigger
   enabled="n"
   group="consider"
   match="* looks a little worried about the idea."
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="* says 'BEGONE FROM MY SIGHT unworthy!'"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="* should be a fair fight!"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="* snickers nervously."
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="* would be easy, but is it even worth the work out?"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="* would crush you like a bug!"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="* would dance on your grave!"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="Best run away from * while you can!"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="Challenging * would be either very brave or very stupid."
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="No Problem! * is weak compared to you."
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="You would be completely annihilated by *!"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="You would stomp * into the ground."
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="^(.*?) chuckles at the thought of you fighting (him|her|it)\.$"
   omit_from_output="y"
   regexp="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="^You see no one here but yourself\!$"
   keep_evaluating="y"
   omit_from_output="y"
   regexp="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
    <trigger
   enabled="n"
   group="consider"
   match="^nhm$"
   omit_from_output="y"
   keep_evaluating="n"
   regexp="y"
   script="Show_Window"
   send_to="12"
   sequence="1"
  >
  </trigger>
    <trigger
   enabled="n"
   group="auto_consider"
   match="^You receive .+ experience points\.$"
   omit_from_output="n"
   keep_evaluating="y"
   regexp="y"
   script="send_consider"
   send_to="12"
   sequence="1"
  >
  </trigger>
   <trigger
   enabled="n"
   group="auto_consider"
   match="\[Exits\:.+$"
   omit_from_output="n"
   keep_evaluating="y"
   regexp="y"
   script="send_consider"
   send_to="12"
   sequence="1"
  >
  </trigger>
   <trigger
   enabled="n"
   group="auto_consider"
   match="^A (.+) has fled\!$"
   omit_from_output="n"
   keep_evaluating="y"
   regexp="y"
   script="send_consider"
   send_to="12"
   sequence="1"
  >
  </trigger>

</triggers>
<!-- Aliases -->
<aliases>
  <alias
   script="conw"
   match="^conw\s(.*)$"
   keep_evaluating="y"
   enabled="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  </alias>
    <alias
   script="send_consider"
   match="^conw$"
   keep_evaluating="y"
   enabled="y"
   regexp="y"
   send_to="12"
   sequence="99"
  >
  </alias>
  <alias
   script="command_line"
   match="^(\d+)\s?(\w*)$"
   enabled="y"
   regexp="y"
   send_to="12"
   keep_evaluating="y"
   sequence="1"
  >
  </alias>
</aliases>
<!--  Script  -->
<script>
<![CDATA[
-- Options -----------------------------------------------
local BACKGROUND_COLOUR     = ColourNameToRGB "black"
local BORDER_COLOUR         = ColourNameToRGB "dimgray"
local DEFAULT_TEXT_COLOUR   = ColourNameToRGB "white"
local TEXT_OFFSET           = "4"
local BORDER_WIDTH          = "1"
local LINE_SPACING          = "1"
local FONT_NAME             = "Dina"
local FONT_SIZE             = 8
local WIN_STACK             = "aa"  -- Windows are stacked alphabetically, so a win named "aa" will sit on top of a win named "zz".
                                    -- Adjust this setting to get the window to sit in front or behind other windows.
local SHOW_WELCOME          = true
local TITLE                 = "consider all"
local ECHO_CONSIDER         = false -- show consider in command window
local SHOW_NO_MOB           = false -- show warning when considering an empty room

require "movewindow"

consider_messages = {
    ["You would stomp (.+) into the ground%."] =
      { range = "-19 and below", colour = "gray", },
    ["(.+) would be easy, but is it even worth the work out%?"] =
      { range = "-10 to -19", colour = "darkgreen", },
    ["No Problem%! (.+) is weak compared to you%."] =
      { range = "-6 to -9", colour = "forestgreen", },
    ["(.+) looks a little worried about the idea%."] =
      { range = "-2 to -6", colour = "chartreuse", },
    ["(.+) should be a fair fight%!"] =
      { range = "-2 to +2", colour = "springgreen", },
    ["(.+) snickers nervously%."] =
      { range = "+2 to +3", colour = "darkgoldenrod", },
    ["(.+) chuckles at the thought of you fighting .+%."] =
      { range = "+3 to +8", colour = "gold", },
    ["Best run away from (.+) while you can%!"] =
      { range = "+8 to +16", colour = "tomato", },
    ["Challenging (.+) would be either very brave or very stupid%."] =
      { range = "+16 to +21", colour = "crimson", },
    ["(.+) would crush you like a bug%!"] =
      { range = "+21 to +32", colour = "lightpink", },
    ["(.+) would dance on your grave%!"] =
      { range = "+32 to +41", colour = "darkmagenta", },
    ["(.+) says 'BEGONE FROM MY SIGHT unworthy%!'"] =
      { range = "+41 to +50", colour = "darkviolet", },
    ["You would be completely annihilated by (.+)%!"] =
      { range = "+50 and above", colour = "magenta", },

      } -- end of consider_messages

replaceT =  { -- words to remove from Mobile's names to get the keyword
            ["a"] = "",
            ["A"] = "",
            ["an"] = "",
            ["An"] = "",
            ["the"] = "",
            ["The"] = "",
            ["of"] = "",
            ["Of"] = "",
            ["captured"] = "",
            ["damned"] = "",
            ["yummy"] = "",
            ["looking"] = "",
            ["wanders"] = "",
            ["beef"] = "",
            ["pot"] = "",
            ["scrumptious"] = "",
            ["tortured"] = "",
            ["Hell"] = "",
            ["largest"] = "",
            ["older"] = "",
            ["slithering"] = "",
            ["tiny"] = "",
            ["huge"] = ""
            }

targT = {}

function keyword_change (name, line, wildcards)

    if keyword_position == "end" then
        SetVariable ("keyword_position", "beginning")
    else
        SetVariable ("keyword_position", "end")
    end
    keyword_position = GetVariable ("keyword_position")

    ColourTell ("white", "blue", "Keywords will now be taken from the " .. keyword_position .. " of Mobile names. ")
    ColourNote ("", "black", " ")

end -- keyword_position

function conw (name, line, wildcards)

    --show help <conw ?>
    if wildcards[1] == "?" then
            a = {
                "conw - update window with consider all command.",
                "<num> <word> - Execute <word> with keyword from line <num> on consider window.",
                "<num> - Execute with default word.",
                "conw <word> - set default command.",
                "conw chng - swop keyword from beginning of name to end of name or vice-versa.",
                "conw auto - toggle auto update consider window on room entry and after combat.",
                "conw ? - show this help."
                }
        for i,v in ipairs (a) do
            sSpa = string.rep (" ", 20 - v:sub(1,v:find("-") - 1):len() )
            ColourTell ("yellow", GetInfo(271), v:sub(1,v:find("-") - 1) .. sSpa )
            ColourNote ("white", GetInfo(271), v:sub(v:find("-"), v:len() ))
        end
        return
    end

    if wildcards[1] == "auto" then
        if tonumber (GetVariable ("auto_conw")) == 1 then
            SetVariable ("auto_conw", 0)
            EnableTriggerGroup ("auto_consider", 0)
            ColourTell ("white", "blue", "Auto consider off.")
            ColourNote ("", "black", " ")
        else
            SetVariable ("auto_conw", 1)
            EnableTriggerGroup ("auto_consider", 1)
            ColourTell ("white", "blue", "Auto consider on.")
            ColourNote ("", "black", " ")
        end
        return
    end

    if wildcards[1] == "chng" then
        keyword_change ()
        return
    end

    if wildcards[1] and wildcards[1]:match ("^%w+$") then
        SetVariable ("default_command", wildcards[1])
        default_command = GetVariable ("default_command")
        ColourTell ("white", "blue", "Default command: " .. wildcards[1])
        ColourNote ("", "black", " ")
    end


end -- send_consider

function send_consider ()

    if GetVariable ("doing_consider") == "true" then
        return
    else
        SetVariable ("doing_consider", "true")
        EnableTriggerGroup ("consider", true)
        SendNoEcho ("consider all")
        Send ("echo nhm")
        targT = {}
    end

end -- send_consider

function execute_command (id, s)

    if not s then
        return
    end

    s = s:match ("^(%w+)%:%d+$")
    Execute (default_command .. " " .. s)
    ColourTell ("white", "blue", default_command .. " " .. s)
    ColourNote ("", "black", " ")

end -- execute_command

function command_line (name, line, wildcards)

    iNum = tonumber (wildcards[1])
    if iNum > #targT then
        return
    end

    if wildcards[2] == "" then
        sKey = default_command
    else
        sKey = tostring (wildcards[2])
    end

    if targT[iNum] then
        Execute (sKey .. " " .. targT[iNum].keyword)
        ColourTell ("white", "blue", sKey .. " " .. targT[iNum].keyword .. " ")
        ColourNote ("", "black", " ")
    else
        ColourTell ("white", "blue", "no target in targT ")
        ColourNote ("", "black", " ")
    end

end -- command_line

function adapt_consider (name, line, wildcards)

    mob = nil
    for k,  v in pairs (consider_messages) do
        mob = string.match (line, k)
        if keyword_position == "end" then
            sPat = "[%w\-]+$"
        else
            sPat = "^[%w\-]+"
        end
        if mob then
            t = {
                keyword = mob:gsub ("%w+", function (str) return replaceT [str] end ):gsub("^%s+", ""):gsub("%s+$", ""):match(sPat),
                name    = mob,
                line    = line,
                colour  = v.colour,
                range   = "(" .. v.range .. ")",
                message = line
                }
            if ECHO_CONSIDER then
                ColourNote (v.colour, "", line .. " (" .. v.range .. ")" )
            end
            table.insert (targT, t)
            break
        end -- if

    end -- for

    if not mob and SHOW_NO_MOB then
        ColourTell ("white", "blue", "Could not find anything: " .. line)
        ColourNote ("", "black", " ")
    end -- not  found in table

end -- adapt_consider

function Draw_Title ()

    --draw the title and add drag hotspot
    top     = BORDER_WIDTH + LINE_SPACING
    bottom  = top + font_height
    left    = BORDER_WIDTH + TEXT_OFFSET
    right   = WindowInfo (win, 3)
    movewindow.add_drag_handler (win, 0, top, right, bottom, 1)
    WindowText (win, font_id, TITLE .. " (" .. default_command .. ")", left, top, right, bottom, BORDER_COLOUR)

    -- draw drag bar rectangle
    WindowRectOp (win, 1, 0, 0, WindowInfo (win, 3) , WindowInfo (win, 4), BORDER_COLOUR)

    banner_height = bottom + LINE_SPACING + BORDER_WIDTH

end -- MakeTitle

function Show_Window ()

    -- get width and height and draw the window
    if #targT > 0 then
        for i,v in ipairs (targT) do
            window_width = math.max (WindowTextWidth (win, font_id, tostring (i) .. ". " .. v.name .. " " .. v.range) + TEXT_OFFSET * 2 + BORDER_WIDTH * 2, banner_width, window_width)
        end
    else
        window_width = banner_width
    end
    window_height = banner_height * 1.2 + #targT * (font_height + LINE_SPACING)

    WindowCreate (win,
         windowinfo.window_left,
         windowinfo.window_top,
         window_width,     -- width
         window_height,  -- height
         windowinfo.window_mode,
         windowinfo.window_flags,
         BACKGROUND_COLOUR)

    -- draw each line
    top     = banner_height + LINE_SPACING
    left    = TEXT_OFFSET + BORDER_WIDTH
    bottom  = top + font_height

    for i,v in ipairs (targT) do
        sLine = tostring (i) .. ". " .. v.name .. " " .. v.range
        right   = WindowTextWidth (win, font_id, sLine) + left
        WindowText (win, font_id, sLine, left, top, right, bottom, ColourNameToRGB (v.colour))
        sBalloon = v.line .. " " .. v.range .. "\n\n" .. "Click to Execute: '" .. default_command .. " " ..  v.keyword .. "'"
        WindowAddHotspot (win, v.keyword .. ":" .. tostring (i), left, top, right, bottom,
            "", -- MouseOver
            "", -- CancelMouseOver
            "", -- MouseDown
            "", -- CancelMouseDown
            "execute_command", -- MouseUp
            sBalloon,
            1, -- Cursor
            0) --  Flag
        top     = bottom + LINE_SPACING
        bottom  = top + font_height
    end

    --draw the title
    Draw_Title()

    WindowShow (win, true)
    SetVariable ("doing_consider", "false")
    EnableTriggerGroup ("consider", false)

end -- Show_Consider

function Show_Banner ()

    window_width = title_width + BORDER_WIDTH * 2 + TEXT_OFFSET * 2
    window_height = font_height + LINE_SPACING * 2 + descent

    WindowCreate (win,
         windowinfo.window_left,
         windowinfo.window_top,
         window_width,     -- width
         window_height,  -- height
         windowinfo.window_mode,
         windowinfo.window_flags,
         BACKGROUND_COLOUR)

    Draw_Title ()

    WindowShow (win, true)

end -- ShowBanner

function OnPluginInstall ()

    if SHOW_WELCOME then
        Note("Consider_Window.xml installed")
    end

    win = WIN_STACK .. GetPluginID ()

    local fonts = utils.getfontfamilies ()
    if fonts[FONT_NAME] then
        font_size = FONT_SIZE
        font_name = FONT_NAME
    elseif fonts.Dina then
        font_size = 8
        font_name = "Dina"    -- the actual font
    else
        font_size = 10
        font_name = "Courier"
    end -- if

    font_id = "consider_font"

    windowinfo = movewindow.install (win, 6)

    check (WindowCreate (win,
        windowinfo.window_left,
        windowinfo.window_top,
        1, 1,
        windowinfo.window_mode,
        windowinfo.window_flags,
        BACKGROUND_COLOUR) )

    WindowFont (win, font_id, font_name, font_size, false, false, false, false, 0, 0)  -- normal
    font_height = WindowFontInfo (win, font_id, 1)  -- height
    ascent = WindowFontInfo (win, font_id, 2)
    descent = WindowFontInfo (win, font_id, 3)

    default_command = GetVariable ("default_command") or "kill"
    keyword_position = GetVariable ("keyword_position") or "end"

    SetVariable ("doing_consider", "false")

    auto_conw = GetVariable ("auto_conw") or 1

    EnableTriggerGroup ("auto_consider", auto_conw)

    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

    OnPluginEnable ()

end -- OnPluginInstall

function OnPluginEnable ()

    title_width = WindowTextWidth (win, font_id, TITLE .. " (" .. default_command .. ")")
    banner_width = title_width + BORDER_WIDTH * 2 + TEXT_OFFSET * 2
    Show_Banner ()

end -- OnPluginEnable

function OnPluginDisable ()

  WindowShow (win, false)

end -- OnPluginDisable

function OnPluginSaveState ()

  SetVariable ("enabled", tostring (GetPluginInfo (GetPluginID (), 17)))
  SetVariable ("doing_consider", "false")
  movewindow.save_state (win)

end -- OnPluginSaveState

]]>
</script>
</muclient>
Amended on Mon 01 Jan 2018 05:26 AM by Nick Gammon
Australia Forum Administrator #1

This is great! It is exactly what I was hoping someone would do. ;)

Your notes don't seem to mention it, but clicking on a mob's name attacks it. Plus, it seems to auto-refresh as you move around. Very nice.

#2
Clicking on a mob executes the default command set with "conw <command>".
Amended on Mon 17 Aug 2009 06:28 AM by Blainer
#3
hello, great plugin, i love it.

was working great for me, then when i go to use it today.
it wont do anything. it shows the bar the just says consider all. but doesnt refresh. i tried inputting conw, it does nothing. ive tried reinstalling, still no luck.

thanks
#4
This has to be a MUSH variable the plugin is not reseting properly.

-Remove the plugin from the Plugins Dialog.
-Find the plugins state file:
the name will contain "584807a32cf46af04a1bece3" and is usually in the MUSH\Worlds\plugins\state
the path on my install is "C:\Program Files\MUSHclient\worlds\plugins\state\777af83cdf336b8bb5207967-584807a32cf46af04a1bece3-state.xml"
-Delete this file.
-Install the plugin again.
-Do "conw ?" see if you get the help.
-Do "conw auto" see if the window updates automatically.

You may want to look at the state file before you delete it and see what the variable "doing_consider" is set to, it should be "false", if not this is the problem.

Let me know how it goes.
#5
k, it worked, but i opened up the state file, and it does say
<variable name="doing_consider">false</variable>
#6
I can't reproduce this on my computer but I have added a couple of lines to set the variable back to what it should be.

If the window stops updating again open the plugins dialog select Aardwolf_Consider_Window and click reinstall.

However I don't think it should happen anymore.
Amended on Fri 28 Aug 2009 07:16 AM by Blainer
#7
thanks a bunch for the help.
#8
This is one of my favorite plugins for aardwolf, But I always get this error in Land of Oz in the area "midway up a tornado" It is a Pk Area if that matters, Can anyone help? I'm not good with these things, Thanks.


Run-time error
Plugin: Aardwolf_Consider_Window (called from world: Aardwolf)
Function/Sub: Show_Window called by trigger
Reason: processing trigger ""
[string "Plugin"]:426: attempt to concatenate field 'keyword' (a nil value)
stack traceback:
        [string "Plugin"]:426: in function <[string "Plugin"]:396>
Error context in script:
 422 :     for i,v in ipairs (targT) do
 423 :         sLine = tostring (i) .. ". " .. v.name .. " " .. v.range
 424 :         right   = WindowTextWidth (win, font_id, sLine) + left
 425 :         WindowText (win, font_id, sLine, left, top, right, bottom, ColourNameToRGB (v.colour))
 426*:         sBalloon = v.line .. " " .. v.range .. "\n\n" .. "Click to Execute: '" .. default_command .. " " ..  v.keyword .. "'"
 427 :         WindowAddHotspot (win, v.keyword .. ":" .. tostring (i), left, top, right, bottom,
 428 :             "", -- MouseOver
 429 :             "", -- CancelMouseOver
 430 :             "", -- MouseDown
Australia Forum Administrator #9
As a work-around, edit the plugin file and between lines 425 and 426 (just before the line starting "sBalloon = v.line ...") add this:


v.keyword = v.keyword or ""


#10
Wow fast response, Thanks Nick that fixed it =)
#11
I have installed several plugins before but this one isn't working for some reason.Is there anything I need to do before I install the plugin for it to work?

I start off by copypasting the code into xml and installing the plugin

I type "conw ?" (works)
I type "conw auto" (says on , works)

The miniwindow shows "consider all(kill)" and never changes

I move once and it considers all on the main mud screen (miniwindow still shows "consider all(kill)") , and the 2nd line says nhm.

After that moving around does nothing. Miniwindow never shows anything.

I've tried completely deleting mushclient and reinstalling everything from scratch and the plugin still doesn't work. Any help is appreciated
Australia Forum Administrator #12
I wouldn't delete MUSHclient just because a plugin doesn't work.

I tried it (I presume you are on Aardwolf, right?) - and indeed I saw "consider all (kill)" if there were no mobs around.

However after running to Verume, it updated with the mobs in the local room.

I'm not sure about the "echo nhm" stuff, but try editing the plugin and change:


Send ("echo nhm")


to:



SendNoEcho ("echo nhm")

#13
Nick Gammon said:

I wouldn't delete MUSHclient just because a plugin doesn't work.

I tried it (I presume you are on Aardwolf, right?) - and indeed I saw "consider all (kill)" if there were no mobs around.

However after running to Verume, it updated with the mobs in the local room.

I'm not sure about the "echo nhm" stuff, but try editing the plugin and change:


Send ("echo nhm")


to:



SendNoEcho ("echo nhm")




I tried the adjustment to SendNoEcho ("echo nhm")
and the miniwindow still doesn't work.

Yeah I am using fresh installs of the Aardwolf mud client, I don't know if this effects the usage.

Here is the state file I have ,

Quote:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Tuesday, January 04, 2011, 3:22 PM -->
<!-- MuClient version 4.71 -->
<!-- Written by Nick Gammon -->
<!-- Home Page: http://www.mushclient.com/ -->

<!-- Plugin state saved. Plugin: "Aardwolf_Consider_Window". World: "Aardwolf". -->

<muclient>

<!-- variables -->

<variables
muclient_version="4.71"
world_file_version="15"
date_saved="2011-01-04 15:22:39"
>
<variable name="auto_conw">1</variable>
<variable name="doing_consider">false</variable>
<variable name="enabled">true</variable>
<variable name="mw_aa584807a32cf46af04a1bece3_windowflags">0</variable>
<variable name="mw_aa584807a32cf46af04a1bece3_windowmode">6</variable>
<variable name="mw_aa584807a32cf46af04a1bece3_windowx">0</variable>
<variable name="mw_aa584807a32cf46af04a1bece3_windowy">0</variable>
</variables>
</muclient>

Amended on Tue 04 Jan 2011 11:25 PM by Snakesfordivine
Australia Forum Administrator #14
I just downloaded the latest Aard client to see if that made a difference. Once installed, and once I loaded the "consider" plugin it worked - provided I typed "conw auto" to enable the triggers in the plugin - which match lines like:


A mosquito flies about in a very annoying way.


Also you need to see those lines, so there need to be mobs in the room. So, you should have seen:


Auto consider on. 


You need to be in a room with mobs. Try typing "look" to force the auto-consider.
#15
Nick Gammon said:

I just downloaded the latest Aard client to see if that made a difference. Once installed, and once I loaded the "consider" plugin it worked - provided I typed "conw auto" to enable the triggers in the plugin - which match lines like:


A mosquito flies about in a very annoying way.


Also you need to see those lines, so there need to be mobs in the room. So, you should have seen:


Auto consider on. 


You need to be in a room with mobs. Try typing "look" to force the auto-consider.


It indeed does say that auto consider is on , and I am in the forest of li with mobs. The look command doesn't seem to force an auto-consider btw.

Here is a sample of how it looks ,

[img]http://img440.imageshack.us/img440/5844/considerall2.jpg[/img]
[img]http://img715.imageshack.us/img715/1507/considerall.jpg[/img]
Amended on Wed 05 Jan 2011 12:00 AM by Snakesfordivine
Australia Forum Administrator #16
Hmmm.


Template:summary

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.

#17
Nick Gammon said:

Hmmm.


(summary)


Heres the debug

Quote:

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

MUSHclient version: 4.71
Compiled: Dec 13 2010.
Time now: Tuesday, January 04, 2011, 4:24 PM
Operating system: Windows XP
Libraries: Lua 5.1.4, PCRE 8.10, PNG 1.4.3, SQLite3 3.7.3, Zlib 1.2.5
World name: 'Aardwolf', ID: e0eb198d8d5698e3b2f61483
-- 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: 3.330274 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: 0 in world file, aliases enabled: yes.
0 enabled, 0 regexp, 0 attempts, 0 matched, 0.000000 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.000618 seconds to decompress
MCCP received 6145 compressed bytes, decompressed to 51431 bytes.
MCCP compression ratio was: 11.9% (lower is better)
-- Plugins (Processing order) --
ID: 3e7dedbe37e44942dd46d264, 'GMCP_handler', (Lua, 0.807 s) Enabled [Al Cb]
ID: c293f9e7f04dde889f65cb90, 'Aardwolf_Main_Layout', (Lua, 0.018 s) Enabled [Al
Va Cb]
ID: b11c1b7fe961558d6f6aba5e, 'Aardwolf_Helper_Aliases', (Lua, 0.000 s) Enabled [Al]
ID: ef4a86dbc9cd4dd6f4c69386, 'Aardwolf_Statmon', (Lua, 0.075 s) Enabled [Va Cb]
ID: ef4a86dbc9cd4dd6f4c69385, 'Aardwolf_Health_Bars', (Lua, 0.034 s) Enabled [Va
Cb]
ID: b6eae87ccedd84f510b74714, 'Aardwolf_GMCP_Mapper', (Lua, 1.594 s) Enabled [Tr
Al Va Cb]
ID: 04d9e64f835452b045b427a7, 'Copy_Colour_Output', (Lua, 0.028 s) Enabled [Al]
ID: b555825a4a5700c35fa80780, 'Aardwolf_Chat_Capture_Miniwindow', (Lua, 0.190 s) Enabled [Tr Al Va Cb]
ID: 3f498d929793c12cb70fb59e, 'Aardwolf_Ascii_Mapper', (Lua, 0.156 s) Enabled [Tr
Va Cb]
ID: abc1a0944ae4af7586ce88dc, 'Repaint_Buffer', (Lua, 0.400 s) Enabled [Cb]
ID: 9f796334ab9ed476ef44f1dc, 'Aardwolf_New_Connection', (Lua, 0.025 s) Enabled [Va Cb]
ID: 584807a32cf46af04a1bece3, 'Aardwolf_Consider_Window', (Lua, 0.003 s) Enabled [Tr Al Va Cb]
** Plugins: 12 loaded, 12 enabled.
-- Comms --
Connect phase: 8 (Open). NAWS wanted: NO
Received: 7942 bytes (7 Kb)
Sent: 760 bytes (0 Kb)
Received 36 packets, sent 36 packets.
Total lines received: 251
This connection: Sent 8 lines, received 681 lines.
Telnet (IAC) received: DO: 3, DONT: 0, WILL: 6, WONT: 1, SB: 67 [Telnet]
-- MXP --
MXP active: NO, Pueblo mode: NO, Activated: On command
MXP tags received: 0
MXP entities received: 0
MXP errors: 0
-- Commands --
Commands in command history: 3
Speed walking enabled: NO. Speed walking prefix: #
Command stacking enabled: yes. Command stack character: ';'
Accelerators defined: 1 [Accelerators]
-- Miniwindows --
Window: ' c293f9e7f04dde889f65cb90txtdragger', at (259,141,830,151), shown: yes
width: 571, height: 10, position: 12, hotspots: 1, fonts: 0, images: 0
Window: ' c293f9e7f04dde889f65cb90txtresize', at (815,591,830,606), shown: yes
width: 15, height: 15, position: 12, hotspots: 1, fonts: 0, images: 0
Window: '3f498d929793c12cb70fb59e', at (0,1,254,272), shown: yes
width: 254, height: 271, position: 0, hotspots: 3, fonts: 2, images: 0
Window: 'aa584807a32cf46af04a1bece3', at (864,0,1007,18), shown: yes
width: 143, height: 18, position: 6, hotspots: 1, fonts: 1, images: 0
Window: 'b555825a4a5700c35fa80780', at (250,0,834,135), shown: yes
width: 584, height: 135, position: 0, hotspots: 6, fonts: 2, images: 0
Window: 'b6eae87ccedd84f510b74714_mapper', at (0,275,255,607), shown: yes
width: 255, height: 332, position: 0, hotspots: 45, fonts: 2, images: 6
Window: 'b6eae87ccedd84f510b74714_z_config_win', at (0,0,0,0), shown: NO
width: 0, height: 0, position: 0, hotspots: 0, fonts: 2, images: 0
Window: 'ef4a86dbc9cd4dd6f4c69385', at (835,330,1230,430), shown: yes
width: 395, height: 100, position: 0, hotspots: 7, fonts: 1, images: 0
Window: 'ef4a86dbc9cd4dd6f4c69386', at (835,139,1230,327), shown: yes
width: 395, height: 188, position: 0, hotspots: 2, fonts: 1, images: 0
Window: 'text_background', at (262,144,828,604), shown: yes
width: 566, height: 460, position: 12, hotspots: 0, fonts: 0, images: 1
Window: 'zzzzz_9f796334ab9ed476ef44f1dc', at (160,96,843,501), shown: NO
width: 683, height: 405, position: 12, hotspots: 3, fonts: 3, images: 0
Window: '~~~~~~3f498d929793c12cb70fb59e:info', at (0,0,0,0), shown: NO
width: 1, height: 1, position: 0, hotspots: 0, fonts: 2, images: 0
** Miniwindows: 12 loaded, 9 shown.
-- Output window --
Output pixels: width 1007, height: 600, font width: 7, font height: 12
can show 143 characters, wrapping at column 79, height 50 lines.
Output buffer: 295 of 9999 lines.
-- Miscellaneous --
Logging: NO, tracing: NO
** SQLite3 databases: 0
Sound buffers in use: 0

---------------------- End summary ----------------------
Australia Forum Administrator #18
A bit more testing shows that the triggers are disabled until it sees the "exits" line. You may have auto exits turned off.

Try typing:


autoexit on


Then see if it works better.
#19
After turning on autoexit , it is still the same.

Australia Forum Administrator #20
Oh well, let's try to work it out ...

  • Open world configuration, triggers section, and uncheck "Enable Triggers".
  • Click OK to close the configuration dialog
  • Type "look" and "cons all" on separate lines.
  • Paste the output you get here.
  • Re-enable triggers or things won't work properly afterwards.


I got:


look

Jungles of Verume
  Walking inside the Jungles of Verume, you have found a ledge leading from
the giant rock.  Directly to your east there is a small swing bridge for a
safer way to cross.  This would probably be the best method to choose since
there is no way to reach the other side.  

[Exits: north east south]
A lizardman is here hunting through the jungle.
A lizardman is here hunting through the jungle.
A gorilla is here swatting at the relentless mosquitos.

The earth trembles and shivers.

cons all

You would stomp Lizardman hunter into the ground.
You would stomp Lizardman hunter into the ground.
You would stomp An angry gorilla into the ground.


You should see something similar.

My miniwindow looked like this:

Amended on Wed 05 Jan 2011 01:16 AM by Nick Gammon
#21
I got the same once disabling triggers.

Quote:

look
Standing Under a Large Tree
Dominating this clearing is the largest tree you've seen in this forest.
It appears that by climbing the rocks next to the tree, you can just reach
the lowest branches. Clinging to the bark are some unusually loud frogs,
croaking in a symphony of bizarre barking noises. Not far on, the foliage
grows denser and you can tell the going won't be quite as easy.

[Exits: north east south west up]
A large pile of rocks rests against the tree.
A regal butterfly flutters in lazy circles.
A bright green treefrog bellows oddly.

[320/320hp 364/364mn 686/686mv 0qt 1049tnl] >
cons all
No Problem! A monarch butterfly is weak compared to you.
No Problem! A barking treefrog is weak compared to you.


miniwindow however has never changed. It just stays static at "consider all (kill)"

Also when the triggers are enabled , the consider all command doesn't do anything.
Amended on Wed 05 Jan 2011 01:22 AM by Snakesfordivine
Australia Forum Administrator #22
OK. Please use File -> Plugins to disable the plugin "Repaint_Buffer" (otherwise you will see a lot of spam).

Then choose Game -> Trace to turn tracing on.

Then move to a room with mobs in it, and observe the output. With triggers enabled, type "look" and you should see something like this. Please paste your results. Then turn tracing off, and re-enable the Repaint_Buffer plugin.

I put the more important lines into bold:


look

A worn pathway (G)
  Moving along a worn pathway, you find yourself just south of what looks
like the entrance to the jungle.  There are a few fallen trees where a huge
creature has walked through, and some scary noises that echo from within. 
Trying to listen, you discover it sounds like a bird, but then again it
could be a gorilla.  Perhaps it's a good time to head towards the beach to
safety.  
TRACE: Executing Plugin GMCP_handler script "OnPluginTelnetSubnegotiation"
TRACE: Executing Plugin Aardwolf_Statmon script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Health_Bars script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_GMCP_Mapper script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Statmon script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Health_Bars script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Chat_Capture_Miniwindow script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Ascii_Mapper script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Chat_Capture_Miniwindow script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Ascii_Mapper script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Statmon script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Health_Bars script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_GMCP_Mapper script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Chat_Capture_Miniwindow script "OnPluginBroadcast"

[Exits: north west]
TRACE: Matched trigger "\[Exits\:.+$"
TRACE: Executing trigger script "send_consider"
TRACE: Executing Plugin Aardwolf_GMCP_Mapper script "OnPluginSent"
TRACE: Executing Plugin Aardwolf_GMCP_Mapper script "OnPluginSent"
A mosquito flies about in a very annoying way.
A mosquito flies about in a very annoying way.
TRACE: Matched trigger "You would stomp * into the ground."
TRACE: Executing trigger script "adapt_consider"
TRACE: Matched trigger "You would stomp * into the ground."
TRACE: Executing trigger script "adapt_consider"
TRACE: Matched trigger "^nhm$"
TRACE: Executing trigger script "Show_Window"


Basically, once it gets the Exits line it calls the plugin script send_consider (which should send "consider all").

You then see the results below (it matched "You would stomp A tiny mosquito into the ground.").

Then it gets back "nhm" which was previously echoed (with "echo nhm") - this forces it to do Show_Window which updates the miniwindow with the new information.
#23
alright it says ,

Quote:
l
Deep in the Forest
Off to the north, you hear the yipping of young animals. The scent of
wildflowers is very strong here and bees flit around gathering pollen for
the hive. To your east, you notice a large log has fallen across the brook.
It looks steady enough for you to walk on.
TRACE: Executing Plugin GMCP_handler script "OnPluginTelnetSubnegotiation"
TRACE: Executing Plugin Aardwolf_Statmon script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Health_Bars script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_GMCP_Mapper script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Statmon script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Health_Bars script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Chat_Capture_Miniwindow script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Ascii_Mapper script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Chat_Capture_Miniwindow script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Ascii_Mapper script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Statmon script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Health_Bars script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_GMCP_Mapper script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Chat_Capture_Miniwindow script "OnPluginBroadcast"

[Exits: north east south west]
TRACE: Matched trigger "[Exits\:.+$"
TRACE: Executing trigger script "send_consider"
A lively swarm of bees harvest pollen from these wildflowers.
A bull moose with wide antlers lurches through the forest.
A brown-furred hare panics and lopes for the bushes.
A tiny dormouse twitches its tail nervously.
A perky-nosed skunk raises its tail in alarm.
A golden honeybee buzzes from flower to flower.
A golden honeybee buzzes from flower to flower.
A golden honeybee buzzes from flower to flower.

[320/320hp 364/364mn 686/686mv 0qt 1049tnl] >




Also whenever I re-login and did the same trace process , it shows something different only once.

Quote:
look
A Well-Used Path Through the Forest
The path continues to the west and heads back south where the woods are
less thick. Standing out amongst the foliage to the southwest is a rather
large outcropping of trees. The sounds of birds seems quite strong in that
direction.
TRACE: Executing Plugin GMCP_handler script "OnPluginTelnetSubnegotiation"
TRACE: Executing Plugin Aardwolf_Statmon script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Health_Bars script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_GMCP_Mapper script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Statmon script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Health_Bars script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Chat_Capture_Miniwindow script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Ascii_Mapper script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Chat_Capture_Miniwindow script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Ascii_Mapper script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Statmon script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Health_Bars script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_GMCP_Mapper script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Chat_Capture_Miniwindow script "OnPluginBroadcast"

[Exits: north east south west]
TRACE: Matched trigger "[Exits\:.+$"
TRACE: Executing trigger script "send_consider"
TRACE: Executing Plugin Aardwolf_GMCP_Mapper script "OnPluginSent"
TRACE: Executing Plugin Aardwolf_GMCP_Mapper script "OnPluginSent"
echo nhm
(White Aura) Sempre is here.
Chakax the Shaman is here.
A fat porcupine flexes his quills reflexively.

[320/320hp 364/364mn 640/686mv 0qt 1049tnl] > No Problem! A chubby porcupine is weak compared to you.

[320/320hp 364/364mn 640/686mv 0qt 1049tnl] > nhm

[320/320hp 364/364mn 640/686mv 0qt 1049tnl] >
Sempre flies west.

TRACE: Fired unlabelled timer



Typing in conw shows
Quote:
TRACE: Matched alias "^conw$"
TRACE: Executing alias script "send_consider"

and doesnt show anything else.
Amended on Wed 05 Jan 2011 03:18 AM by Snakesfordivine
Australia Forum Administrator #24
Ah, finally a clue!

The plugin is looking for:


No Problem! A chubby porcupine is weak compared to you.


but it gets:


[320/320hp 364/364mn 640/686mv 0qt 1049tnl] > No Problem! A chubby porcupine is weak compared to you.


And:


nhm


but it gets:


[320/320hp 364/364mn 640/686mv 0qt 1049tnl] > nhm


So basically the prompt is the problem.

So the first thing you can do is type:


prompt

You will no longer see prompts.


If you are happy to not see prompts, just leave it like that. It worked for me because I had prompts turned off.

After all, you get most of that info from the various other windows.

Failing that, you can add a newline to your prompt, see "help prompt". By adding %c to your prompt it can end in a carriage-return (hopefully the same thing as a newline) and then the prompts will be on a separate line.
#25
Nick Gammon said:

Ah, finally a clue!

The plugin is looking for:


No Problem! A chubby porcupine is weak compared to you.


but it gets:


[320/320hp 364/364mn 640/686mv 0qt 1049tnl] > No Problem! A chubby porcupine is weak compared to you.


And:


nhm


but it gets:


[320/320hp 364/364mn 640/686mv 0qt 1049tnl] > nhm


So basically the prompt is the problem.

So the first thing you can do is type:


prompt

You will no longer see prompts.


If you are happy to not see prompts, just leave it like that. It worked for me because I had prompts turned off.

After all, you get most of that info from the various other windows.

Failing that, you can add a newline to your prompt, see "help prompt". By adding %c to your prompt it can end in a carriage-return (hopefully the same thing as a newline) and then the prompts will be on a separate line.



Omg Thank you so much Nick! I turned off prompt and it works like a charm now!!! *bows down* ^______________^
USA Global Moderator #26
This seems to be a common issue with users who never added %c on their prompts. They likely were making use of the statmon tags without ever knowing about it, because it was kept hidden from them. Statmon added a secret carriage return, which they obviously no longer have. The best solution is to force all prompts to end in a carriage return mudside, because otherwise anchored trigger patterns will never work. Maybe this will happen soon.
Amended on Thu 06 Jan 2011 02:02 AM by Fiendish
#27
hi, I have a little problem with this plugin,
when I enter a room it works great shows up the mobs in the miniwindow and all that it should, but my prompt shows 3times in all rooms, does it have todo with the echo thing?
Australia Forum Administrator #28
I didn't write the plugin, but I am guessing you are seeing the prompt before and after when it does a "consider all".

One thing you could do is make a small trigger that detects your prompt, and compares it to the last time it got it. If they are the same it omits it. (Or, it always omits it, but if the prompt is different it redisplays it, something like that).
#29
:S to hard for me hehe, guess its not hard to get used to ^^
#30
First of all, let me say I love this plug-in. However, while its not a huge issue, I wanted to know if anyone else was experiencing the plug-in failing to function after being attacked.

I have noticed if I walk into a room with aggros, that when I leave, the plug-in no longer responds, and I have to reinitialize it. Its not too bad unless I am in an area with a lot of aggros.

Any ideas?

Thanks
Australia Forum Administrator #31
I seem to recall this is a prompt issue. It sends a "consider all" and waits for the end of the lists of mobs, by detecting the prompt. If you have a "battle prompt" it may not realize the list is over and be collecting a huge list of things in its internal buffer.

Try skimming back through this thread for a post along those lines, or if you feel confident, look at the difference between your normal prompt and battle prompt, and see if that might be what it is (and maybe add another trigger into the plugin).
#32
Hi Nick,
Thanks for the help. I turned off the battle prompt and it works now.
USA #33
I seem to be having an issue with some mobs in some rooms not getting captured into the consider window. Any ideas on why that might be happening?

-Androg
Australia Forum Administrator #34
Can you post examples please?
Australia Forum Administrator #35
What I meant was, disable or remove the plugin, then go to the problem zone, do a "consider all" and post the resulting text (copy and paste).

Then enable the plugin and do it again. Then we can see which lines are failing.
USA #36
Disabled

consider all
(R) A blood beetle chuckles at the thought of you fighting it.
(R) Best run away from Some muck while you can!
(H) Some quicksand chuckles at the thought of you fighting it.
(H) Some quicksand chuckles at the thought of you fighting it.

Enabled

conw
echo nhm
(R) Best run away from Some muck while you can!

Still enabled

con all
(R) A blood beetle chuckles at the thought of you fighting it.
(R) Best run away from Some muck while you can!
(H) Some quicksand chuckles at the thought of you fighting it.
(H) Some quicksand chuckles at the thought of you fighting it.

That help at all or am I still giving you the wrong info? Thanks!
USA #37
I should point out... I'm not getting any script errors whatsoever. The only thing I'm getting is some mobs left out of the consider window.
Australia Forum Administrator #38
What is the (R) and (H) stuff? The plugin is looking for:


Best run away from * while you can!


Not:


(R) Best run away from * while you can!


USA #39
Those are short flags. (R) is (Red Aura) (H) is (Hidden), (G) (Golden Aura) (W) (White Aura) (I) (Invisibile) etc etc (help auras in the game has a list of them). I did try this with long flags and short flags and the same mobs weren't showing up in the list. Maybe it's some setting on some of the mobs in the game, I might ask Lasher if he has an idea, too.

Do you think I should try changing the triggers to match on *Best run while you can!, etc?
Amended on Thu 14 Jul 2011 11:23 AM by Androg
Australia Forum Administrator #40
Yes I think that will help. And it will work on some already, eg.


 match="* looks a little worried about the idea."


Note how that already starts with an asterisk, so it would match, say:


(R) A blood beetle looks a little worried about the idea.


In that case the * would match: "(R) A blood beetle".

So I would add the asterisk to the ones that don't already have one at the start.
USA #41
That seems to have solved it. * with no space after it, I should say. I tried:

match="* Best run away from * while you can!"

but match="*Best run away from * while you can!" is what it needs (as you would have probably told me.)

Thanks for the help on this. I'll probably have a question about modifying this script for using study instead of consider (so it shows players as well as mobs)!

Thanks again...

-Androg
#42

Run-time error
Plugin: Aardwolf_Consider_Miniwindow (called from world: Aardwolf)
Function/Sub: execute_command called by Plugin Aardwolf_Consider_Miniwindow
Reason: Executing plugin Aardwolf_Consider_Miniwindow sub execute_command
[string "Plugin"]:314: attempt to concatenate local 's' (a nil value)
stack traceback:
        [string "Plugin"]:314: in function <[string "Plugin"]:307>
Error context in script:
 310 :         return
 311 :     end
 312 : 
 313 :     s = s:match ("^(%w+)%:%d+$")
 314*:     Execute (default_command .. " " .. s)
 315 :     ColourTell ("white", "blue", default_command .. " " .. s)
 316 :     ColourNote ("", "black", " ")
 317 : 
 318 : end -- execute_command


i get this error whenever i try to kill a monster with - in it's name.
i.e. A young half-griffon snickers nervously. (+2 to +3)

any help in resolving this error is appreciated.
Australia Forum Administrator #43
You probably need to change the match regular expression here:


function execute_command (id, s)

    if not s then
        return
    end

    s = s:match ("^(%w+)%:%d+$")
    Execute (default_command .. " " .. s)
    ColourTell ("white", "blue", default_command .. " " .. s)
    ColourNote ("", "black", " ")

end -- execute_command


The part %w+ only matches "words". You could make that line to be something like:


    s = s:match ("^([%w']+)%:%d+$")


That should match words and apostrophes.
#44
This plugin looks to be exactly what I have been searching for, but I cannot get it to install. I'm getting the following error:


Compile error
Plugin: Aardwolf_Consider_Window (called from world: Aardwolf)
Immediate execution
[string "Plugin"]:350: invalid escape sequence near '"[%w'
Error context in script:
 346 :     mob = nil
 347 :     for k,  v in pairs (consider_messages) do
 348 :         mob = string.match (line, k)
 349 :         if keyword_position == "end" then
 350*:             sPat = "[%w\-]+$"
 351 :         else
 352 :             sPat = "^[%w\-]+"
 353 :         end
 354 :         if mob then
Amended on Fri 03 Feb 2012 09:15 PM by Xaroth
#45
I've fixed the problem after browsing some other threads. I changed:

 350*:             sPat = "[%w\-]+$"
 351 :         else
 352 :             sPat = "^[%w\-]+"


to

 350*:             sPat = "[%w\\-]+$"
 351 :         else
 352 :             sPat = "^[%w\\-]+"


[Moderator edit] fixed backslashes for forum
Amended on Sat 04 Feb 2012 04:22 AM by Nick Gammon
USA Global Moderator #46
This is because LuaJIT and Lua 5.2 are both strict about invalid escape sequences, because invalid escape sequences likely mean that your string is not doing what you think it is. Just make sure that that is the pattern you actually want. There are two different ways that you can turn "\-" into something valid.
Amended on Sun 05 Feb 2012 04:46 AM by Fiendish
Netherlands #47
i got the same error as Xaroth.
how did you change the text?
it still is all chinese to me :P
Australia Forum Administrator #48
The way he did two posts up.
Netherlands #49
i know that.
but when i open the xml it doesn't show what i see on here.
how is that?

(thnx for the quick reply)
USA Global Moderator #50
You're likely opening it with the wrong kind of program. You need to use a text editor.
Netherlands #51
the thing is, when i open the file, i don't see line numbers.
and i sure don't see the sPat anywhere..
i'm trying to figure out what went wrong, but any help in between would be appreciated.
USA Global Moderator #52
Quote:

i don't see line numbers.

Line numbers may be shown by some editor programs, but are not actually part of the file.

Quote:
i sure don't see the sPat anywhere
Perhaps you accidentally opened the wrong file.
Amended on Sat 10 Mar 2012 10:49 PM by Fiendish
Netherlands #53
my sincere apologies for all the questions. but as my knowledge will become saturated some day, the questions will disappear :P

completely stared myself over a few things when i was into this too long the other day.
when used the ctrl+f i found it :P
but is this about the script prefix '\' ?
because when i look in my settings which i haven't changed, its on '\\\'

thnx for your patience.
Amended on Sat 10 Mar 2012 11:28 PM by Jsportive-Thalanvor
USA Global Moderator #54
Quote:

my sincere apologies for all the questions.

There is no need to apologize for anything. Your questions have been very polite and to the point, so they are not at all painful to answer.

Quote:
but is this about the script prefix '\' ?
because when i look in my settings which i haven't changed, its on '\\'

No. The issue is as follows...

Look at this page about Strings in Lua: http://www.lua.org/pil/2.4.html

Note the table of escape sequences in strings after the part that says "Strings in Lua can contain the following C-like escape sequences:"

In Lua 5.1, ANYthing can be escaped (preceded by "\") and if it is not in the table shown then the "\" is just ignored. In LuaJIT 2 (and Lua 5.2, upon which it is currently based) which is the Lua interpreter packaged with the Aardwolf MUSHclient Package, that is not the case. Escaping something not in that table is considered invalid because it means you don't really know what your string is doing and you've probably made a mistake.

Now I don't know if Xaroth's proposed solution is actually correct, because I haven't studied this particular script, but it will at least resolve the described code ambiguity. There are two ways to resolve the ambiguity presented by "\-" in the quoted code lines. The correct solution is one of either "\-" or "-". I can't say which, but Xaroth has indicated that "\-" gave satisfactory results.
Amended on Sun 11 Mar 2012 01:49 AM by Fiendish
Netherlands #55
okay, did i the way Xaroth did it. and it works.
thnx.
#56
Getting back into Aardwolf and was going to try this plugin, but was having some small problem.

There is no window or anything that appears.

I made the change to the script to fix the error and it seems to load. I can bring up the help text, but can't seem to get anything other then that.

I am using the aardclient.

Thanks
USA Global Moderator #57
Maybe it's hidden behind something else?
Netherlands #58
i had that with 2 windows :P
just move all bigger windows, or resize them temporarily.
you might find what you need.
#59
Thanks. It was hiding behind a window. Was kind of surprised that using the send to back option on the window covering it didn't make it so that the consider window came to the front.

Although now it's not auto updating. So far the only thing I have tried is turning off my prompt, but haven't had time to go through all of the troubleshooting tips on page 2 yet.

If you know a quick fix for that I would gladly take it. I will try to go through all the stuff on page 2 if not.

If it's not one thing it's another ROFL
USA Global Moderator #60
The "send to back" thing can only ever work with other plugins written to make use of my Z-Order features. This plugin was written long before that. But I have instructions for adding Z-ordering to any miniwindow plugin:

http://code.google.com/p/aardwolfclientpackage/wiki/ZOrderMonitor
#61
Thanks for the info.

I still haven't been able to get the script to auto update. I am not sure what I am doing wrong on it. I have even created a new char thinking it was some setting I set years ago and followed the stuff on earlier pages It might help. the 'conw' command manually still seems to work though.

using look in a room

look
The Grand City of Aylor - Southern Entrance (G)
TRACE: Matched trigger "^\{coords\}(?<zone>\d+)\,(?<x>\d+)\,(?<y>\d+)$"
  At this point in the road, The Great Andolor Highway has begun to slim
as the large paving stones slowly mix with, and turn into, a form of
cobblestone path.  It's quite amazing the amount of work and detail that
went into this simple shift in road.  To the north, the cobblestone
continues into the vast and wondrous city of Aylor.  To the south, the
large expanse of the great world lies before you, beckoning you towards
excitement and adventure.  
TRACE: Executing Plugin GMCP_handler script "OnPluginTelnetSubnegotiation"
TRACE: Executing Plugin Aardwolf_Group_Monitor script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Health_Bars script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_GMCP_Mapper script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Group_Monitor script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Health_Bars script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Chat_Capture_Miniwindow script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Ascii_Mapper script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_BigMap_Graphical script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Prompt_Fixer script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Statmon script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Chat_Capture_Miniwindow script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Ascii_Mapper script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Group_Monitor script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Health_Bars script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_GMCP_Mapper script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Chat_Capture_Miniwindow script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_BigMap_Graphical script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Prompt_Fixer script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Statmon script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_BigMap_Graphical script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Prompt_Fixer script "OnPluginBroadcast"
TRACE: Executing Plugin Aardwolf_Statmon script "OnPluginBroadcast"

[ Exits: north south up down ]
A beat-up rat in nasty-looking rags wears a bandana and has a peg for a leg.
A large vine with thick, dripping thorns edges closer...
A large mass of eyes and tentacles stands guard at the entrance.

[160/160hp 150/150mn 500/500mv 0qt 900tnl] >
TRACE: Trace off


using conw - this works

TRACE: Trace on
TRACE: Matched alias "^conw$"
TRACE: Executing alias script "send_consider"
TRACE: Executing Plugin Aardwolf_GMCP_Mapper script "OnPluginSent"
TRACE: Executing Plugin Aardwolf_GMCP_Mapper script "OnPluginSent"
echo nhm
TRACE: Matched trigger "You would be completely annihilated by *!"
TRACE: Executing trigger script "adapt_consider"
TRACE: Matched trigger "You would be completely annihilated by *!"
TRACE: Executing trigger script "adapt_consider"
TRACE: Matched trigger "You would be completely annihilated by *!"
TRACE: Executing trigger script "adapt_consider"

[160/160hp 150/150mn 500/500mv 0qt 900tnl] >
TRACE: Matched trigger "^nhm$"
TRACE: Executing trigger script "Show_Window"

[160/160hp 150/150mn 500/500mv 0qt 900tnl] >
TRACE: Trace off


state file

- <muclient>
- <!--  variables 
  --> 
- <variables muclient_version="4.81" world_file_version="15" date_saved="2012-03-19 12:44:47">
  <variable name="auto_conw">1</variable> 
  <variable name="doing_consider">false</variable> 
  <variable name="enabled">true</variable> 
  <variable name="mw_aa584807a32cf46af04a1bece3_windowflags">0</variable> 
  <variable name="mw_aa584807a32cf46af04a1bece3_windowmode">6</variable> 
  <variable name="mw_aa584807a32cf46af04a1bece3_windowx">0</variable> 
  <variable name="mw_aa584807a32cf46af04a1bece3_windowy">0</variable> 
  </variables>
  </muclient>
#62
I have fixed my issue. Not sure if it was the correct way or not yet, but the Exit line for me was '[ EXIT' instead of '[EXIT' so the trigger never ticked. I just added the space in the trigger to get it to work.
#63
Having trouble getting the plugin to auto consider when i enter a room. Works great after a kill or when i type conw. Conw auto is on


any suggestions?
Amended on Wed 15 May 2013 03:51 AM by Teklor
Australia Forum Administrator #64
It's probably something to do with your prompt, that it isn't matching when you enter a room.
#65
Nick Gammon said:

It's probably something to do with your prompt, that it isn't matching when you enter a room.



I've tried with prompt off and also with the %c at the end and still can't get it to auto-update properly. Other then auto updating it works perfectly though.
#66
Hi I have installed this plugin and cannot get the window to display anything other than : "consider all(help)"


My conw is on auto my autoexit is on my prompts have %c at the end and my triggers are enabled. As far as trace goes, the options do not allow me to disable repaint in plugins.

So I have not run a trace since the repaint spam is ever going. Thank you in advance.
USA #67
Here is an updated version of this plugin. I did not change much and it still needs a bit of work but she works for now. I did not write this plugin. I took the suggestion from the previous posts, updated them in the plugin and added a few updates of my own.

Quote:

1) Updated sPat variable to correctly escape in LUA and capture "-" and "." in mob names
2) Updated some of the triggers to regular expressions
3) Triggers should now capture Auras of Mobs in Minwin. This is not perfect but works.
4) Put a SPACE in match="[ Exits:.+$" to make the consider update work when moving
5) Tested on Aardwolf Mud Client R1802 | Mushclient version 4.93 - http://www.aardwolf.com/play/downloadmc.htm
6) I suggest having shortflags turned on. Either way works, shortflags toggled on is cleaner.


TODO:
"(R) You would be completely annihilated by A watchtower guard! (+50 and above)" OR "(R) You would be completely annihilated by A watchtower guard!" does not currently capture Auras "(R)" - Mobs names that start in the string, capture shortflags perfectly. Mobs names that are found in the middle or end of the string have to capture more data than needed to display the shortflags. If anyone has a solution for this please post an update.


Command Reminder.
conw                - update window with consider all command.
<num> <word>        - Execute <word> with keyword from line <num> on consider window.
<num>               - Execute with default word.
conw <word>         - set default command.
conw chng           - swop keyword from beginning of name to end of name or vice-versa.
conw auto           - toggle auto update consider window on room entry and after combat.
conw ?              - show this help.


I'm limited to 6,000 characters in this forum. Here is a link to the xml file: http://s000.tinyupload.com/?file_id=06002124828891494393

[EDIT] If you are in a group the minwin does not appear to update after each mob is killed as it does when soloing. Once you move it updates again.
Amended on Sat 06 Sep 2014 05:48 AM by Strazor
Australia Forum Administrator #68
From that link:

Template:saveplugin=Aardwolf_Consider_Window
To save and install the Aardwolf_Consider_Window plugin do this:
  1. Copy the code below (in the code box) to the Clipboard
  2. Open a text editor (such as Notepad) and paste the plugin code into it
  3. Save to disk on your PC, preferably in your plugins directory, as Aardwolf_Consider_Window.xml
    • The "plugins" directory is usually under the "worlds" directory inside where you installed MUSHclient.
  4. Go to the MUSHclient File menu -> Plugins
  5. Click "Add"
  6. Choose the file Aardwolf_Consider_Window.xml (which you just saved in step 3) as a plugin
  7. Click "Close"
  8. Save your world file, so that the plugin loads next time you open it.



<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Friday, August 14, 2009, 6:13 AM -->
<!-- MuClient version 4.93 -->

<!-- Plugin "Consider_Window" generated by Plugin Wizard -->
<!-- Updates Made by Strazor on September 6, 2014
     1) Updated sPat variable to correctly escape in LUA and capture "-" and "." in mob names
     2) Updated some of the triggers to regular expressions
     3) Triggers should now capture Auras of Mobs in Minwin.  This is not perfect but works.
     4) Put a SPACE in match="\[ Exits\:.+$" to make the consider update work when moving
     5) Tested on Aardwolf Mudclient R1802 | Mushclient version 4.93 - http://www.aardwolf.com/play/downloadmc.htm -->

<muclient>
<plugin
   name="Aardwolf_Consider_Window"
   author="Blainer"
   id="584807a32cf46af04a1bece3"
   language="Lua"
   purpose="Display clickable consider command output."
   save_state="y"
   date_written="2009-08-14 06:12:14"
   requires="4.43"
   version="1.0"
   >
<description trim="y">
<![CDATA[
Put consider info in a miniwindow with commands.
Mostly copied from: http://www.gammon.com.au/forum/bbshowpost.php?id=8847
And: http://www.gammon.com.au/forum/?id=9664
]]>
</description>
</plugin>

<!--  Get our standard constants -->

<include name="constants.lua"/>
<!--  Triggers  -->

<triggers>
  <trigger
   enabled="n"
   group="consider"
   match="* looks a little worried about the idea."
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="* says 'BEGONE FROM MY SIGHT unworthy!'"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="* should be a fair fight!"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="* snickers nervously."
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="* would be easy, but is it even worth the work out?"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="* would crush you like a bug!"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="^(.*?) would dance on your grave\!$"
   omit_from_output="y"
   regexp="yes"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="^(.*?)Best run away from (.*?) while you can\!$"
   omit_from_output="y"
   regexp="yes"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="*Challenging * would be either very brave or very stupid."
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="*No Problem! * is weak compared to you."
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="^(.*?) You would be completely annihilated by (.*?)\!$"
   omit_from_output="y"
   regexp="yes"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="^You would stomp (.*?) into the ground\.$"  
   omit_from_output="y"
   regexp="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="^(.*?) chuckles at the thought of you fighting (him|her|it)\.$"
   omit_from_output="y"
   regexp="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="^You see no one here but yourself\!$"
   keep_evaluating="y"
   omit_from_output="y"
   regexp="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
    <trigger
   enabled="n"
   group="consider"
   match="^nhm$"
   omit_from_output="y"
   keep_evaluating="n"
   regexp="y"
   script="Show_Window"
   send_to="12"
   sequence="1"
  >
  </trigger>
    <trigger
   enabled="n"
   group="auto_consider"
   match="^You receive .+ experience points\.$"
   omit_from_output="n"
   keep_evaluating="y"
   regexp="y"
   script="send_consider"
   send_to="12"
   sequence="1"
  >
  </trigger>
   <trigger
   enabled="n"
   group="auto_consider"
   match="\[ Exits\:.+$"
   omit_from_output="n"
   keep_evaluating="y"
   regexp="y"
   script="send_consider"
   send_to="12"
   sequence="1"
  >
  </trigger>
   <trigger
   enabled="n"
   group="auto_consider"
   match="^A (.+) has fled\!$"
   omit_from_output="n"
   keep_evaluating="y"
   regexp="y"
   script="send_consider"
   send_to="12"
   sequence="1"
  >
  </trigger>

</triggers>
<!-- Aliases -->
<aliases>
  <alias
   script="conw"
   match="^conw\s(.*)$"
   keep_evaluating="y"
   enabled="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  </alias>
    <alias
   script="send_consider"
   match="^conw$"
   keep_evaluating="y"
   enabled="y"
   regexp="y"
   send_to="12"
   sequence="99"
  >
  </alias>
  <alias
   script="command_line"
   match="^(\d+)\s?(\w*)$"
   enabled="y"
   regexp="y"
   send_to="12"
   keep_evaluating="y"
   sequence="1"
  >
  </alias>
</aliases>
<!--  Script  -->
<script>
<![CDATA[
-- Options -----------------------------------------------
local BACKGROUND_COLOUR     = ColourNameToRGB "black"
local BORDER_COLOUR         = ColourNameToRGB "dimgray"
local DEFAULT_TEXT_COLOUR   = ColourNameToRGB "white"
local TEXT_OFFSET           = "4"
local BORDER_WIDTH          = "1"
local LINE_SPACING          = "1"
local FONT_NAME             = "Dina"
local FONT_SIZE             = 8
local WIN_STACK             = "aa"  -- Windows are stacked alphabetically, so a win named "aa" will sit on top of a win named "zz".
                                    -- Adjust this setting to get the window to sit in front or behind other windows.
local SHOW_WELCOME          = true
local TITLE                 = "consider all"
local ECHO_CONSIDER         = false -- show consider in command window
local SHOW_NO_MOB           = false -- show warning when considering an empty room

require "movewindow"

consider_messages = {
    ["(.+) into the ground%."] =
      { range = "-19 and below", colour = "gray", },
    ["(.+) would be easy, but is it even worth the work out%?"] =
      { range = "-10 to -19", colour = "darkgreen", },
    ["No Problem%! (.+) is weak compared to you%."] =
      { range = "-6 to -9", colour = "forestgreen", },
    ["(.+) looks a little worried about the idea%."] =
      { range = "-2 to -6", colour = "chartreuse", },
    ["(.+) should be a fair fight%!"] =
      { range = "-2 to +2", colour = "springgreen", },
    ["(.+) snickers nervously%."] =
      { range = "+2 to +3", colour = "darkgoldenrod", },
    ["(.+) chuckles at the thought of you fighting .+%."] =
      { range = "+3 to +8", colour = "gold", },
    ["(.+) while you can%!"] =
      { range = "+8 to +16", colour = "tomato", },
    ["(.+) would be either very brave or very stupid%."] =
      { range = "+16 to +21", colour = "crimson", },
    ["(.+) would crush you like a bug%!"] =
      { range = "+21 to +32", colour = "lightpink", },
    ["(.+) would dance on your grave%!"] =
      { range = "+32 to +41", colour = "darkmagenta", },
    ["(.+) says 'BEGONE FROM MY SIGHT unworthy%!'"] =
      { range = "+41 to +50", colour = "darkviolet", },
    ["You would be completely annihilated by (.+)%!"] =
      { range = "+50 and above", colour = "magenta", },

      } -- end of consider_messages

replaceT =  { -- words to remove from Mobile's names to get the keyword
            ["a"] = "",
            ["A"] = "",
            ["an"] = "",
            ["An"] = "",
            ["the"] = "",
            ["The"] = "",
            ["of"] = "",
            ["Of"] = "",
            ["captured"] = "",
            ["damned"] = "",
            ["yummy"] = "",
            ["looking"] = "",
            ["wanders"] = "",
            ["beef"] = "",
            ["pot"] = "",
            ["scrumptious"] = "",
            ["tortured"] = "",
            ["Hell"] = "",
            ["largest"] = "",
            ["older"] = "",
            ["slithering"] = "",
            ["tiny"] = "",
            ["huge"] = ""
            }

targT = {}

function keyword_change (name, line, wildcards)

    if keyword_position == "end" then
        SetVariable ("keyword_position", "beginning")
    else
        SetVariable ("keyword_position", "end")
    end
    keyword_position = GetVariable ("keyword_position")

    ColourTell ("white", "blue", "Keywords will now be taken from the " .. keyword_position .. " of Mobile names. ")
    ColourNote ("", "black", " ")

end -- keyword_position

function conw (name, line, wildcards)

    --show help <conw ?>
    if wildcards[1] == "?" then
            a = {
                "conw - update window with consider all command.",
                "<num> <word> - Execute <word> with keyword from line <num> on consider window.",
                "<num> - Execute with default word.",
                "conw <word> - set default command.",
                "conw chng - swop keyword from beginning of name to end of name or vice-versa.",
                "conw auto - toggle auto update consider window on room entry and after combat.",
                "conw ? - show this help."
                }
        for i,v in ipairs (a) do
            sSpa = string.rep (" ", 20 - v:sub(1,v:find("-") - 1):len() )
            ColourTell ("yellow", GetInfo(271), v:sub(1,v:find("-") - 1) .. sSpa )
            ColourNote ("white", GetInfo(271), v:sub(v:find("-"), v:len() ))
        end
        return
    end

    if wildcards[1] == "auto" then
        if tonumber (GetVariable ("auto_conw")) == 1 then
            SetVariable ("auto_conw", 0)
            EnableTriggerGroup ("auto_consider", 0)
            ColourTell ("white", "blue", "Auto consider off.")
            ColourNote ("", "black", " ")
        else
            SetVariable ("auto_conw", 1)
            EnableTriggerGroup ("auto_consider", 1)
            ColourTell ("white", "blue", "Auto consider on.")
            ColourNote ("", "black", " ")
        end
        return
    end

    if wildcards[1] == "chng" then
        keyword_change ()
        return
    end

    if wildcards[1] and wildcards[1]:match ("^%w+$") then
        SetVariable ("default_command", wildcards[1])
        default_command = GetVariable ("default_command")
        ColourTell ("white", "blue", "Default command: " .. wildcards[1])
        ColourNote ("", "black", " ")
    end


end -- send_consider

function send_consider ()

    if GetVariable ("doing_consider") == "true" then
        return
    else
        SetVariable ("doing_consider", "true")
        EnableTriggerGroup ("consider", true)
        SendNoEcho ("consider all")
        Send ("echo nhm")
        targT = {}
    end

end -- send_consider

function execute_command (id, s)

    if not s then
        return
    end

    s = s:match ("^([%w']+)%:%d+$")
    Execute (default_command .. " " .. s)
    ColourTell ("white", "blue", default_command .. " " .. s)
    ColourNote ("", "black", " ")

end -- execute_command

function command_line (name, line, wildcards)

    iNum = tonumber (wildcards[1])
    if iNum > #targT then
        return
    end

    if wildcards[2] == "" then
        sKey = default_command
    else
        sKey = tostring (wildcards[2])
    end

    if targT[iNum] then
        Execute (sKey .. " " .. targT[iNum].keyword)
        ColourTell ("white", "blue", sKey .. " " .. targT[iNum].keyword .. " ")
        ColourNote ("", "black", " ")
    else
        ColourTell ("white", "blue", "no target in targT ")
        ColourNote ("", "black", " ")
    end

end -- command_line

function adapt_consider (name, line, wildcards)

    mob = nil
    for k,  v in pairs (consider_messages) do
        mob = string.match (line, k)
        if keyword_position == "end" then
            sPat = "[%w\\-\\.]+$"
        else
            sPat = "^[%w\\-\\.]+"
        end
        if mob then
            t = {
                keyword = mob:gsub ("%w+", function (str) return replaceT [str] end ):gsub("^%s+", ""):gsub("%s+$", ""):match(sPat),
                name    = mob,
                line    = line,
                colour  = v.colour,
                range   = "(" .. v.range .. ")",
                message = line
                }
            if ECHO_CONSIDER then
                ColourNote (v.colour, "", line .. " (" .. v.range .. ")" )
            end
            table.insert (targT, t)
            break
        end -- if

    end -- for

    if not mob and SHOW_NO_MOB then
        ColourTell ("white", "blue", "Could not find anything: " .. line)
        ColourNote ("", "black", " ")
    end -- not  found in table

end -- adapt_consider

function Draw_Title ()

    --draw the title and add drag hotspot
    top     = BORDER_WIDTH + LINE_SPACING
    bottom  = top + font_height
    left    = BORDER_WIDTH + TEXT_OFFSET
    right   = WindowInfo (win, 3)
    movewindow.add_drag_handler (win, 0, top, right, bottom, 1)
    WindowText (win, font_id, TITLE .. " (" .. default_command .. ")", left, top, right, bottom, BORDER_COLOUR)

    -- draw drag bar rectangle
    WindowRectOp (win, 1, 0, 0, WindowInfo (win, 3) , WindowInfo (win, 4), BORDER_COLOUR)

    banner_height = bottom + LINE_SPACING + BORDER_WIDTH

end -- MakeTitle

function Show_Window ()

    -- get width and height and draw the window
    if #targT > 0 then
        for i,v in ipairs (targT) do
            window_width = math.max (WindowTextWidth (win, font_id, tostring (i) .. ". " .. v.name .. " " .. v.range) + TEXT_OFFSET * 2 + BORDER_WIDTH * 2, banner_width, window_width)
        end
    else
        window_width = banner_width
    end
    window_height = banner_height * 1.2 + #targT * (font_height + LINE_SPACING)

    WindowCreate (win,
         windowinfo.window_left,
         windowinfo.window_top,
         window_width,     -- width
         window_height,  -- height
         windowinfo.window_mode,
         windowinfo.window_flags,
         BACKGROUND_COLOUR)

    -- draw each line
    top     = banner_height + LINE_SPACING
    left    = TEXT_OFFSET + BORDER_WIDTH
    bottom  = top + font_height

    for i,v in ipairs (targT) do
        sLine = tostring (i) .. ". " .. v.name .. " " .. v.range
        right   = WindowTextWidth (win, font_id, sLine) + left
        WindowText (win, font_id, sLine, left, top, right, bottom, ColourNameToRGB (v.colour))
        sBalloon = v.line .. " " .. v.range .. "\n\n" .. "Click to Execute: '" .. default_command .. " " ..  v.keyword .. "'"
        WindowAddHotspot (win, v.keyword .. ":" .. tostring (i), left, top, right, bottom,
            "", -- MouseOver
            "", -- CancelMouseOver
            "", -- MouseDown
            "", -- CancelMouseDown
            "execute_command", -- MouseUp
            sBalloon,
            1, -- Cursor
            0) --  Flag
        top     = bottom + LINE_SPACING
        bottom  = top + font_height
    end

    --draw the title
    Draw_Title()

    WindowShow (win, true)
    SetVariable ("doing_consider", "false")
    EnableTriggerGroup ("consider", false)

end -- Show_Consider

function Show_Banner ()

    window_width = title_width + BORDER_WIDTH * 2 + TEXT_OFFSET * 2
    window_height = font_height + LINE_SPACING * 2 + descent

    WindowCreate (win,
         windowinfo.window_left,
         windowinfo.window_top,
         window_width,     -- width
         window_height,  -- height
         windowinfo.window_mode,
         windowinfo.window_flags,
         BACKGROUND_COLOUR)

    Draw_Title ()

    WindowShow (win, true)

end -- ShowBanner

function OnPluginInstall ()

    if SHOW_WELCOME then
        Note("Consider_Window.xml installed")
    end

    win = WIN_STACK .. GetPluginID ()

    local fonts = utils.getfontfamilies ()
    if fonts[FONT_NAME] then
        font_size = FONT_SIZE
        font_name = FONT_NAME
    elseif fonts.Dina then
        font_size = 8
        font_name = "Dina"    -- the actual font
    else
        font_size = 10
        font_name = "Courier"
    end -- if

    font_id = "consider_font"

    windowinfo = movewindow.install (win, 6, miniwin.create_absolute_location)

    check (WindowCreate (win,
        windowinfo.window_left,
        windowinfo.window_top,
        1, 1,
        windowinfo.window_mode,
        windowinfo.window_flags,
        BACKGROUND_COLOUR) )

    WindowFont (win, font_id, font_name, font_size, false, false, false, false, 0, 0)  -- normal
    font_height = WindowFontInfo (win, font_id, 1)  -- height
    ascent = WindowFontInfo (win, font_id, 2)
    descent = WindowFontInfo (win, font_id, 3)

    default_command = GetVariable ("default_command") or "kill"
    keyword_position = GetVariable ("keyword_position") or "end"

    SetVariable ("doing_consider", "false")

    auto_conw = GetVariable ("auto_conw") or 1

    EnableTriggerGroup ("auto_consider", auto_conw)

    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

    OnPluginEnable ()

end -- OnPluginInstall

function OnPluginEnable ()

    title_width = WindowTextWidth (win, font_id, TITLE .. " (" .. default_command .. ")")
    banner_width = title_width + BORDER_WIDTH * 2 + TEXT_OFFSET * 2
    Show_Banner ()

end -- OnPluginEnable

function OnPluginDisable ()

  WindowShow (win, false)

end -- OnPluginDisable

function OnPluginSaveState ()

  SetVariable ("enabled", tostring (GetPluginInfo (GetPluginID (), 17)))
  SetVariable ("doing_consider", "false")
  movewindow.save_state (win)

end -- OnPluginSaveState

]]>
</script>
</muclient>
Amended on Sun 31 Dec 2017 08:42 AM by Fiendish
USA Global Moderator #69
re-opening thread. player found bugs in posted code.
Amended on Sun 27 Mar 2016 03:55 PM by Fiendish
#70
match="^(.*?) Best run away from (.*?) while you can\!$"

Has an extra space (so won't show up on miniwin):
change
"^(.*?) Best"
to
"^(.*?)Best"
Amended on Sun 27 Mar 2016 05:09 PM by Fiendish
Australia Forum Administrator #71
Amended plugin above.
#72
I'm getting this error when encountering mobs without any auras. I'm not sure if that was before I adding * to coloured consider plugin or after, because this is rare occassion due to minority of these types of mobs.

Run-time error
Plugin: Aardwolf_Consider_Window (called from world: Aardwolf)
Function/Sub: Show_Window called by trigger
Reason: processing trigger "" when matching line: "nhm"
[string "Plugin: Aardwolf_Consider_Window"]:426: attempt to concatenate field 'keyword' (a nil value)
stack traceback:
[string "Plugin: Aardwolf_Consider_Window"]:426: in function <[string "Plugin: Aardwolf_Consider_Window"]:396>
Australia Forum Administrator #73
We need to know what line 426 in your plugin is. Perhaps if you post your plugin?
#74
C/p has 6000 characters limits, though I haven't changed anything but aforementioned space removal on this plugin from your edit.

So it's should really have error on that particular line.
#75
Found the reason for this error through aard awesome tech channel.

There's couple mobs named 'mob!?'

That caused miniwin to break and reproduce the error I posted.

I've changed this line:
mob = string.match (line, k)
to
mob = string.match (string.gsub(line, "?!", ""), k)

This fix was suggested to me in tech channel I'm merely the messenger!

Also maybe worth to mention, this error only occured if mob had no auras (good, evil and angry, the error for this particular mob name only showed if - 'mob!?'
USA Global Moderator #76
Got this report.

Quote:
Hello!
I've found a little problem with the Consider_All plugin for MUSH, but the thread is closed so I'd figured I just write you here in game. It's missing a trigger for auto considering after a mob is killed and the player has the noexp option on.
Maybe you want to add it to the thread.
Bye!


Included with that is:

    <trigger
   enabled="n"
   group="auto_consider"
   match="^You have set your character to receive no experience points\!$"
   omit_from_output="n"
   keep_evaluating="y"
   regexp="y"
   script="send_consider"
   send_to="12"
   sequence="1"
  >
  </trigger>
#77
That's another trigger I've added for when a new mob appears in the room:


  <trigger
   enabled="n"
   group="auto_consider"
   match="^(.+) appears in the room\.$"
   omit_from_output="n"
   keep_evaluating="y"
   regexp="y"
   script="send_consider"
   send_to="12"
   sequence="1"
  >
  </trigger>
USA Global Moderator #78
Aardwolf's Kobus (no forum account) has made a number of updates to the plugin. Here is the new code:


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Friday, August 14, 2009, 6:13 AM -->
<!-- MuClient version 4.93 -->

<!-- Plugin "Consider_Window" generated by Plugin Wizard -->
<!-- Updates Made by Strazor on September 6, 2014
     1) Updated sPat variable to correctly escape in LUA and capture "-" and "." in mob names
     2) Updated some of the triggers to regular expressions
     3) Triggers should now capture Auras of Mobs in Minwin.  This is not perfect but works.
     4) Put a SPACE in match="\[ Exits\:.+$" to make the consider update work when moving
     5) Tested on Aardwolf Mudclient R1802 | Mushclient version 4.93 - http://www.aardwolf.com/play/downloadmc.htm -->
<!-- More updates by Kobus November 2017
	* Converted all consider triggers to regex including all possible flags, short or long
	* Replaced a gsub in adapt_consider with wildcard from the regex
	* Added gsub loop in adapt_consider for mobs with ?, ! or " in their names (nod Khannon)
	* Triggers now set color and level range variables for the miniwindow
	* Removed for loop in adapt_consider, no longer needed with color, range variables set by the triggers
	* Removed the consider_messages table as it is no longer needed with color, range set by the triggers
	* Added 2 triggers suggested on the forum for noexp and mob entry on repop
	* Removed call to adapt_consider when "You see no one here but yourself!"
	* Added 4 triggers for unkillable mobs (for omit only)
	* Added a trigger for mobs already being challenged (omit only)
	* Added a trigger for safe rooms (omit only)
	* Added suggestion on install for the help command 'conw ?'
-->
<muclient>
<plugin
   name="Aardwolf_Consider_Window"
   author="Blainer"
   id="584807a32cf46af04a1bece3"
   language="Lua"
   purpose="Display clickable consider command output."
   save_state="y"
   date_written="2009-08-14 06:12:14"
   requires="4.43"
   version="2.0"
   >
<description trim="y">
<![CDATA[
Put consider info in a miniwindow with commands.
Mostly copied from: http://www.gammon.com.au/forum/bbshowpost.php?id=8847
And: http://www.gammon.com.au/forum/?id=9664
]]>
</description>
</plugin>

<!--  Get our standard constants -->

<include name="constants.lua"/>
<!--  Triggers  -->

<triggers>
  <trigger
   enabled="n"
   regexp="y"
   group="consider"
   match="^(\([A-Za-z ]+\) ?)*(.+) looks a little worried about the idea\.$"
   keep_evaluating="y"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
   send_to="12"
  >
  <send>mob_color = "chartreuse"
mob_range = "-2 to -6"</send>
  </trigger>
  <trigger
   enabled="n"
   regexp="y"
   group="consider"
   match="^(\([A-Za-z ]+\) ?)*(.+) says 'BEGONE FROM MY SIGHT unworthy!'$"
   keep_evaluating="y"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
   send_to="12"
  >
  <send>mob_color = "darkviolet"
mob_range = "+41 to +50"</send>
  </trigger>
  <trigger
   enabled="n"
   regexp="y"
   group="consider"
   match="^(\([A-Za-z ]+\) ?)*(.+) should be a fair fight!$"
   keep_evaluating="y"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
   send_to="12"
  >
  <send>mob_color = "springgreen"
mob_range = "-2 to +2"</send>
  </trigger>
  <trigger
   enabled="n"
   regexp="y"
   group="consider"
   match="^(\([A-Za-z ]+\) ?)*(.+) snickers nervously\.$"
   keep_evaluating="y"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
   send_to="12"
  >
  <send>mob_color = "darkgoldenrod"
mob_range = "+2 to +3"</send>
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   regexp="y"
   match="^(\([A-Za-z ]+\) ?)*(.+) would be easy, but is it even worth the work out\?$"
   keep_evaluating="y"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
   send_to="12"
  >
  <send>mob_color = "darkgreen"
mob_range = "-10 to -19"</send>
  </trigger>
  <trigger
   enabled="n"
   regexp="y"
   group="consider"
   match="^(\([A-Za-z ]+\) ?)*(.+) would crush you like a bug!$"
   keep_evaluating="y"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
   send_to="12"
  >
  <send>mob_color = "lightpink"
mob_range = "+21 to +32"</send>
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="^(\([A-Za-z ]+\) ?)*(.+) would dance on your grave!$"
   keep_evaluating="y"
   omit_from_output="y"
   regexp="y"
   script="adapt_consider"
   sequence="100"
   send_to="12"
  >
  <send>mob_color = "darkmagenta"
mob_range = "+32 to +41"</send>
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="^(\([A-Za-z ]+\) ?)*Best run away from (.+) while you can!$"
   keep_evaluating="y"
   omit_from_output="y"
   regexp="y"
   script="adapt_consider"
   sequence="100"
   send_to="12"
  >
  <send>mob_color = "tomato"
mob_range = "+8 to +16"</send>
  </trigger>
  <trigger
   enabled="n"
   regexp="y"
   group="consider"
   match="^(\([A-Za-z ]+\) ?)*Challenging (.+) would be either very brave or very stupid\.$"
   keep_evaluating="y"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
   send_to="12"
  >
  <send>mob_color = "crimson"
mob_range = "+16 to +21"</send>
  </trigger>
  <trigger
   enabled="n"
   regexp="y"
   group="consider"
   match="^(\([A-Za-z ]+\) ?)*No Problem! (.+) is weak compared to you\.$"
   keep_evaluating="y"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
   send_to="12"
  >
  <send>mob_color = "forestgreen"
mob_range = "-6 to -9"</send>
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="^(\([A-Za-z ]+\) ?)*You would be completely annihilated by (.+)!$"
   keep_evaluating="y"
   omit_from_output="y"
   regexp="y"
   script="adapt_consider"
   sequence="100"
   send_to="12"
  >
  <send>mob_color = "magenta"
mob_range = "+50 and above"</send>
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="^(\([A-Za-z ]+\) ?)*You would stomp (.+) into the ground\.$"
   keep_evaluating="y"
   omit_from_output="y"
   regexp="y"
   script="adapt_consider"
   sequence="100"
   send_to="12"
  >
  <send>mob_color = "gray"
mob_range = "-19 and below"</send>
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="^(\([A-Za-z ]+\) ?)*(.+) chuckles at the thought of you fighting"
   keep_evaluating="y"
   omit_from_output="y"
   regexp="y"
   script="adapt_consider"
   sequence="100"
   send_to="12"
  >
  <send>mob_color = "gold"
mob_range = "+3 to +8"</send>
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="^You see no one here but yourself!$"
   keep_evaluating="y"
   omit_from_output="y"
   regexp="y"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="^.+ would smite you for killing .+!$"
   keep_evaluating="y"
   omit_from_output="y"
   regexp="y"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="^.+ would not approve of you killing .+!$"
   keep_evaluating="y"
   omit_from_output="y"
   regexp="y"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="^.+ has divine protection\.$"
   keep_evaluating="y"
   omit_from_output="y"
   regexp="y"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="^.+ has already been challenged\.$"
   keep_evaluating="y"
   omit_from_output="y"
   regexp="y"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="^If you killed .+, who would serve"
   keep_evaluating="y"
   omit_from_output="y"
   regexp="y"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="^Strange forces prevent violence here\.$"
   keep_evaluating="y"
   omit_from_output="y"
   regexp="y"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="n"
   group="consider"
   match="^nhm$"
   omit_from_output="y"
   keep_evaluating="n"
   regexp="y"
   script="Show_Window"
   send_to="12"
   sequence="1"
  >
  </trigger>
  <trigger
   enabled="n"
   group="auto_consider"
   match="^You have set your character to receive no experience points!$"
   omit_from_output="n"
   keep_evaluating="y"
   regexp="y"
   script="send_consider"
   send_to="12"
   sequence="1"
  >
  </trigger>
  <trigger
   enabled="n"
   group="auto_consider"
   match="^.+ appears in the room\.$"
   omit_from_output="n"
   keep_evaluating="y"
   regexp="y"
   script="send_consider"
   send_to="12"
   sequence="1"
  >
  </trigger>
    <trigger
   enabled="n"
   group="auto_consider"
   match="^You receive .+ experience points\.$"
   omit_from_output="n"
   keep_evaluating="y"
   regexp="y"
   script="send_consider"
   send_to="12"
   sequence="1"
  >
  </trigger>
   <trigger
   enabled="n"
   group="auto_consider"
   match="^\[ Exits"
   omit_from_output="n"
   keep_evaluating="y"
   regexp="y"
   script="send_consider"
   send_to="12"
   sequence="1"
  >
  </trigger>
   <trigger
   enabled="n"
   group="auto_consider"
   match="^.+ has fled!$"
   omit_from_output="n"
   keep_evaluating="y"
   regexp="y"
   script="send_consider"
   send_to="12"
   sequence="1"
  >
  </trigger>

</triggers>
<!-- Aliases -->
<aliases>
  <alias
   script="conw"
   match="^conw\s(.*)$"
   keep_evaluating="y"
   enabled="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  </alias>
    <alias
   script="send_consider"
   match="^conw$"
   keep_evaluating="y"
   enabled="y"
   regexp="y"
   send_to="12"
   sequence="99"
  >
  </alias>
  <alias
   script="command_line"
   match="^(\d+)\s?(\w*)$"
   enabled="y"
   regexp="y"
   send_to="12"
   keep_evaluating="y"
   sequence="1"
  >
  </alias>
</aliases>
<!--  Script  -->
<script>
<![CDATA[
-- Options -----------------------------------------------
local BACKGROUND_COLOUR     = ColourNameToRGB "black"
local BORDER_COLOUR         = ColourNameToRGB "dimgray"
local DEFAULT_TEXT_COLOUR   = ColourNameToRGB "white"
local TEXT_OFFSET           = "4"
local BORDER_WIDTH          = "1"
local LINE_SPACING          = "1"
local FONT_NAME             = "Dina"
local FONT_SIZE             = 8
local WIN_STACK             = "aa"  -- Windows are stacked alphabetically, so a win named "aa" will sit on top of a win named "zz".
                                    -- Adjust this setting to get the window to sit in front or behind other windows.
local SHOW_WELCOME          = true
local TITLE                 = "consider all"
local ECHO_CONSIDER         = false -- show consider in command window
local SHOW_NO_MOB           = false -- show warning when considering an empty room

require "movewindow"
mob_color = "gray" -- Color set by the triggers - Kobus
mob_range = "0 to 0" -- Range set by the triggers - Kobus

-- Consider messages table removed, no longe needed - Kobus

replaceT =  { -- words to remove from Mobile's names to get the keyword
            ["a"] = "",
            ["A"] = "",
            ["an"] = "",
            ["An"] = "",
            ["the"] = "",
            ["The"] = "",
            ["of"] = "",
            ["Of"] = "",
            ["captured"] = "",
            ["damned"] = "",
            ["yummy"] = "",
            ["looking"] = "",
            ["wanders"] = "",
            ["beef"] = "",
            ["pot"] = "",
            ["scrumptious"] = "",
            ["tortured"] = "",
            ["Hell"] = "",
            ["largest"] = "",
            ["older"] = "",
            ["slithering"] = "",
            ["tiny"] = "",
            ["huge"] = ""
            }

targT = {}

function keyword_change (name, line, wildcards)

    if keyword_position == "end" then
        SetVariable ("keyword_position", "beginning")
    else
        SetVariable ("keyword_position", "end")
    end
    keyword_position = GetVariable ("keyword_position")

    ColourTell ("white", "blue", "Keywords will now be taken from the " .. keyword_position .. " of Mobile names. ")
    ColourNote ("", "black", " ")

end -- keyword_position

function conw (name, line, wildcards)

    --show help <conw ?>
    if wildcards[1] == "?" then
            a = {
                "conw - update window with consider all command.",
                "<num> <word> - Execute <word> with keyword from line <num> on consider window.",
                "<num> - Execute with default word.",
                "conw <word> - set default command.",
                "conw chng - swop keyword from beginning of name to end of name or vice-versa.",
                "conw auto - toggle auto update consider window on room entry and after combat.",
                "conw ? - show this help."
                }
        for i,v in ipairs (a) do
            sSpa = string.rep (" ", 20 - v:sub(1,v:find("-") - 1):len() )
            ColourTell ("yellow", GetInfo(271), v:sub(1,v:find("-") - 1) .. sSpa )
            ColourNote ("white", GetInfo(271), v:sub(v:find("-"), v:len() ))
        end
        return
    end

    if wildcards[1] == "auto" then
        if tonumber (GetVariable ("auto_conw")) == 1 then
            SetVariable ("auto_conw", 0)
            EnableTriggerGroup ("auto_consider", 0)
            ColourTell ("white", "blue", "Auto consider off.")
            ColourNote ("", "black", " ")
        else
            SetVariable ("auto_conw", 1)
            EnableTriggerGroup ("auto_consider", 1)
            ColourTell ("white", "blue", "Auto consider on.")
            ColourNote ("", "black", " ")
        end
        return
    end

    if wildcards[1] == "chng" then
        keyword_change ()
        return
    end

    if wildcards[1] and wildcards[1]:match ("^%w+$") then
        SetVariable ("default_command", wildcards[1])
        default_command = GetVariable ("default_command")
        ColourTell ("white", "blue", "Default command: " .. wildcards[1])
        ColourNote ("", "black", " ")
    end


end -- send_consider

function send_consider ()

    if GetVariable ("doing_consider") == "true" then
        return
    else
        SetVariable ("doing_consider", "true")
        EnableTriggerGroup ("consider", true)
        SendNoEcho ("consider all")
        SendNoEcho ("echo nhm")
        targT = {}
    end

end -- send_consider

function execute_command (id, s)

    if not s then
        return
    end

    s = s:match ("^([%w']+)%:%d+$")
    Execute (default_command .. " " .. s)
    ColourTell ("white", "blue", default_command .. " " .. s)
    ColourNote ("", "black", " ")

end -- execute_command

function command_line (name, line, wildcards)

    iNum = tonumber (wildcards[1])
    if iNum > #targT then
        return
    end

    if wildcards[2] == "" then
        sKey = default_command
    else
        sKey = tostring (wildcards[2])
    end

    if targT[iNum] then
        Execute (sKey .. " " .. targT[iNum].keyword)
        ColourTell ("white", "blue", sKey .. " " .. targT[iNum].keyword .. " ")
        ColourNote ("", "black", " ")
    else
        ColourTell ("white", "blue", "no target in targT ")
        ColourNote ("", "black", " ")
    end

end -- command_line

function adapt_consider (name, line, wildcards)
    mob = nil
	mob = wildcards[2] -- New version because of regex triggers - Kobus
	while string.match(mob,[=[[?!",]]=]) do -- Pull out ? and ! - Kobus
		mob = string.gsub(mob,"%?","")
		mob = string.gsub(mob,"!","")
		mob = string.gsub(mob,[=["]=],"")
		mob = string.gsub(mob,[=[,]=],"")
	end -- Stripping ? ! " and , from mob names -- Kobus
    if keyword_position == "end" then
        sPat = "[%w\\-\\.]+$"
    else
        sPat = "^[%w\\-\\.]+"
    end
	-- Removed for loop here, no longer necessary with color, range set by triggers - Kobus
    if mob then
        t = {
            keyword = mob:gsub ("%w+", function (str) return replaceT [str] end ):gsub("^%s+", ""):gsub("%s+$", ""):match(sPat),
            name    = mob,
            line    = line,
            colour  = mob_color,
            range   = "(" .. mob_range .. ")",
            message = line
            } -- Changed to use color, range set by triggers - Kobus
        if ECHO_CONSIDER then
            ColourNote (mob_color, "", line .. " (" .. mob_range .. ")" )
			-- Changed to use color, range set by triggers - Kobus
        end
        table.insert (targT, t)
    end -- if


    if not mob and SHOW_NO_MOB then
        ColourTell ("white", "blue", "Could not find anything: " .. line)
        ColourNote ("", "black", " ")
    end -- not  found in table

end -- adapt_consider

function Draw_Title ()

    --draw the title and add drag hotspot
    top     = BORDER_WIDTH + LINE_SPACING
    bottom  = top + font_height
    left    = BORDER_WIDTH + TEXT_OFFSET
    right   = WindowInfo (win, 3)
    movewindow.add_drag_handler (win, 0, top, right, bottom, 1)
    WindowText (win, font_id, TITLE .. " (" .. default_command .. ")", left, top, right, bottom, BORDER_COLOUR)

    -- draw drag bar rectangle
    WindowRectOp (win, 1, 0, 0, WindowInfo (win, 3) , WindowInfo (win, 4), BORDER_COLOUR)

    banner_height = bottom + LINE_SPACING + BORDER_WIDTH

end -- MakeTitle

function Show_Window ()

    -- get width and height and draw the window
    if #targT > 0 then
        for i,v in ipairs (targT) do
            window_width = math.max (WindowTextWidth (win, font_id, tostring (i) .. ". " .. v.name .. " " .. v.range) + TEXT_OFFSET * 2 + BORDER_WIDTH * 2, banner_width, window_width)
        end
    else
        window_width = banner_width
    end
    window_height = banner_height * 1.2 + #targT * (font_height + LINE_SPACING)

    WindowCreate (win,
         windowinfo.window_left,
         windowinfo.window_top,
         window_width,     -- width
         window_height,  -- height
         windowinfo.window_mode,
         windowinfo.window_flags,
         BACKGROUND_COLOUR)

    -- draw each line
    top     = banner_height + LINE_SPACING
    left    = TEXT_OFFSET + BORDER_WIDTH
    bottom  = top + font_height

    for i,v in ipairs (targT) do
        sLine = tostring (i) .. ". " .. v.name .. " " .. v.range
        right   = WindowTextWidth (win, font_id, sLine) + left
        WindowText (win, font_id, sLine, left, top, right, bottom, ColourNameToRGB (v.colour))
        sBalloon = v.line .. " " .. v.range .. "\n\n" .. "Click to Execute: '" .. default_command .. " " ..  v.keyword .. "'"
        WindowAddHotspot (win, v.keyword .. ":" .. tostring (i), left, top, right, bottom,
            "", -- MouseOver
            "", -- CancelMouseOver
            "", -- MouseDown
            "", -- CancelMouseDown
            "execute_command", -- MouseUp
            sBalloon,
            1, -- Cursor
            0) --  Flag
        top     = bottom + LINE_SPACING
        bottom  = top + font_height
    end

    --draw the title
    Draw_Title()

    WindowShow (win, true)
    SetVariable ("doing_consider", "false")
    EnableTriggerGroup ("consider", false)

end -- Show_Consider

function Show_Banner ()

    window_width = title_width + BORDER_WIDTH * 2 + TEXT_OFFSET * 2
    window_height = font_height + LINE_SPACING * 2 + descent

    WindowCreate (win,
         windowinfo.window_left,
         windowinfo.window_top,
         window_width,     -- width
         window_height,  -- height
         windowinfo.window_mode,
         windowinfo.window_flags,
         BACKGROUND_COLOUR)

    Draw_Title ()

    WindowShow (win, true)

end -- ShowBanner

function OnPluginInstall ()

    if SHOW_WELCOME then
        Note("Consider_Window.xml installed")
		-- Suggest help command - Kobus
		Note("For a list of commands type 'conw ?'")
    end

    win = WIN_STACK .. GetPluginID ()

    local fonts = utils.getfontfamilies ()
    if fonts[FONT_NAME] then
        font_size = FONT_SIZE
        font_name = FONT_NAME
    elseif fonts.Dina then
        font_size = 8
        font_name = "Dina"    -- the actual font
    else
        font_size = 10
        font_name = "Courier"
    end -- if

    font_id = "consider_font"

    windowinfo = movewindow.install (win, 6, miniwin.create_absolute_location)

    check (WindowCreate (win,
        windowinfo.window_left,
        windowinfo.window_top,
        1, 1,
        windowinfo.window_mode,
        windowinfo.window_flags,
        BACKGROUND_COLOUR) )

    WindowFont (win, font_id, font_name, font_size, false, false, false, false, 0, 0)  -- normal
    font_height = WindowFontInfo (win, font_id, 1)  -- height
    ascent = WindowFontInfo (win, font_id, 2)
    descent = WindowFontInfo (win, font_id, 3)

    default_command = GetVariable ("default_command") or "kill"
    keyword_position = GetVariable ("keyword_position") or "end"

    SetVariable ("doing_consider", "false")

    auto_conw = GetVariable ("auto_conw") or 1

    EnableTriggerGroup ("auto_consider", auto_conw)

    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

    OnPluginEnable ()

end -- OnPluginInstall

function OnPluginEnable ()

    title_width = WindowTextWidth (win, font_id, TITLE .. " (" .. default_command .. ")")
    banner_width = title_width + BORDER_WIDTH * 2 + TEXT_OFFSET * 2
    Show_Banner ()

end -- OnPluginEnable

function OnPluginDisable ()

  WindowShow (win, false)

end -- OnPluginDisable

function OnPluginSaveState ()

  SetVariable ("enabled", tostring (GetPluginInfo (GetPluginID (), 17)))
  SetVariable ("doing_consider", "false")
  movewindow.save_state (win)

end -- OnPluginSaveState

]]>
</script>
</muclient>