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

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Plugins
. . -> [Subject]  Aardwolf Consider all miniwindow.
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Aardwolf Consider all miniwindow.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Pages: 1  2  3  4  5 

Posted by Fiendish   USA  (1,031 posts)  [Biography] bio   Global Moderator
Date Reply #60 on Sun 18 Mar 2012 02:47 AM (UTC)  quote  ]
Message
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

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

Posted by Softpaws   (4 posts)  [Biography] bio
Date Reply #61 on Mon 19 Mar 2012 05:00 PM (UTC)  quote  ]
Message
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>
[Go to top] top

Posted by Softpaws   (4 posts)  [Biography] bio
Date Reply #62 on Mon 19 Mar 2012 08:25 PM (UTC)  quote  ]
Message
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.
[Go to top] top

Posted by Teklor   (2 posts)  [Biography] bio
Date Reply #63 on Tue 14 May 2013 03:34 AM (UTC)  quote  ]

Amended on Wed 15 May 2013 03:51 AM (UTC) by Teklor

Message
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?
[Go to top] top

Posted by Nick Gammon   Australia  (19,616 posts)  [Biography] bio   Forum Administrator
Date Reply #64 on Wed 15 May 2013 10:18 PM (UTC)  quote  ]
Message
It's probably something to do with your prompt, that it isn't matching when you enter a room.

- Nick Gammon

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

Posted by Teklor   (2 posts)  [Biography] bio
Date Reply #65 on Wed 15 May 2013 11:27 PM (UTC)  quote  ]
Message
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.
[Go to top] top

Posted by Hellion   (1 post)  [Biography] bio
Date Reply #66 on Mon 10 Mar 2014 10:13 AM (UTC)  quote  ]
Message
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.
[Go to top] top

Posted by Strazor   USA  (16 posts)  [Biography] bio
Date Reply #67 on Sat 06 Sep 2014 05:19 AM (UTC)  quote  ]

Amended on Sat 06 Sep 2014 05:48 AM (UTC) by Strazor

Message
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.
[Go to top] top

Posted by Nick Gammon   Australia  (19,616 posts)  [Biography] bio   Forum Administrator
Date Reply #68 on Sat 06 Sep 2014 05:39 AM (UTC)  quote  ]
Message
From that link:

Template:saveplugin=Aardwolf_Consider_Window To save and install the Aardwolf_Consider_Window plugin do this:
  1. Copy between the lines below (to the Clipboard)
  2. Open a text editor (such as Notepad) and paste the plugin into it
  3. Save to disk on your PC, preferably in your plugins directory, as Aardwolf_Consider_Window.xml
  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"



<?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)

    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>

- Nick Gammon

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

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


46,247 views.

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

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Web site powered by FutureQuest.Net]