[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" plugin
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Aardwolf "consider" plugin

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


Posted by Nick Gammon   Australia  (15,394 posts)  [Biography] bio
Date Wed 06 Aug 2008 03:18 AM (UTC)  quote  ]
Message
Here is a fun plugin I wrote for Aardwolf. It doesn't require any separate modules, or even a particularly recent version of MUSHclient.

When you type "consider" it simply colours the output in a way which indicates how much the mobs you are in the room with are to be feared.

To use, copy between the lines and save as Consider_info.xml. Or, right-click and download this file:

http://www.gammon.com.au/mushclient/plugins/Aardwolf/Consider_info.xml

Then save that file in your MUSHclient plugins directory, and use File -> Plugins to install it.


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Wednesday, August 06, 2008, 1:13 PM -->
<!-- MuClient version 4.35 -->

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

<muclient>
<plugin
   name="Consider_info"
   author="Nick Gammon"
   id="2a5caa1cd7dbcff665e2a23d"
   language="Lua"
   purpose="Colours &quot;consider&quot; lines"
   date_written="2008-08-06 13:07:35"
   requires="4.30"
   version="1.0"
   >
<description trim="y">
<![CDATA[
When you type "consider" (or "consider all") the lines are coloured to make it easier to tell high level from low level mobs.
]]>
</description>

</plugin>


<!--  Triggers  -->

<triggers>
  <trigger
   enabled="y"
   group="consider"
   match="* looks a little worried about the idea."
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="y"
   group="consider"
   match="* says 'BEGONE FROM MY SIGHT unworthy!'"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="y"
   group="consider"
   match="* should be a fair fight!"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="y"
   group="consider"
   match="* snickers nervously."
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="y"
   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="y"
   group="consider"
   match="* would crush you like a bug!"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="y"
   group="consider"
   match="* would dance on your grave!"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="y"
   group="consider"
   match="Best run away from * while you can!"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="y"
   group="consider"
   match="Challenging * would be either very brave or very stupid."
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="y"
   group="consider"
   match="No Problem! * is weak compared to you."
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="y"
   group="consider"
   match="You would be completely annihilated by *!"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="y"
   group="consider"
   match="You would stomp * into the ground."
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="y"
   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>
</triggers>

<!--  Script  -->


<script>
<![CDATA[

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
      
function adapt_consider (name, line, wildcards)
  mob = nil
  for k,  v in pairs (consider_messages) do
    mob = string.match (line, k)
    
    if mob then
      ColourNote (v.colour, "", line .. " (" .. v.range .. ")" )
      break
    end -- if
  
  end -- for

  if not mob then
    ColourNote ("white", "blue", "Could not find message: " .. line)
  end -- not  found in table

end -- adapt_consider



]]>
</script>


</muclient>



- Nick Gammon

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

Posted by Nick Gammon   Australia  (15,394 posts)  [Biography] bio
Date Wed 06 Aug 2008 03:21 AM (UTC)  quote  ]

Amended on Wed 06 Aug 2008 03:22 AM (UTC) by Nick Gammon

Message

Example output:

The numbers in brackets indicate the relative level ranges, compared to yours. You can customize the colours by editing the plugin and simply putting a different colour in the table next to each message.


- Nick Gammon

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

Posted by Fiendish   (79 posts)  [Biography] bio
Date Tue 14 Oct 2008 12:30 PM (UTC)  quote  ]

Amended on Tue 14 Oct 2008 01:04 PM (UTC) by Fiendish

Message
Out of curiosity, is there a reason why you did it this way instead of simply making a message for each trigger? Looping to find the right message after you already know which message should appear based on the trigger pattern seems somewhat inefficient.
[Go to top] top

Posted by Nick Gammon   Australia  (15,394 posts)  [Biography] bio
Date Tue 14 Oct 2008 08:37 PM (UTC)  quote  ]

Amended on Tue 14 Oct 2008 08:43 PM (UTC) by Nick Gammon

Message
I must admit I can't think of a good reason, except for some sort of strange laziness that overtook me, that made me do more work than I needed to. :-O

The version below should be more efficient ...


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Wednesday, August 06, 2008, 1:13 PM -->
<!-- MuClient version 4.35 -->

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

<muclient>
<plugin
   name="Consider_info"
   author="Nick Gammon"
   id="2a5caa1cd7dbcff665e2a23d"
   language="Lua"
   purpose="Colours &quot;consider&quot; lines"
   date_written="2008-10-15 07:35"
   requires="4.30"
   version="2.0"
   >
<description trim="y">
<![CDATA[
When you type "consider" (or "consider all") the lines are coloured to make it easier to tell high level from low level mobs.
]]>
</description>

</plugin>


<!--  Triggers  -->

<triggers>

  <trigger
   enabled="y"
   group="consider"
   match="You would stomp * into the ground."
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
   name="a"
  >
  </trigger>

  <trigger
   enabled="y"
   group="consider"
   match="* would be easy, but is it even worth the work out?"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
   name="b"
  >
  </trigger>
  
  <trigger
   enabled="y"
   group="consider"
   match="No Problem! * is weak compared to you."
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
   name="c"
  >
  </trigger>
  
  <trigger
   enabled="y"
   group="consider"
   match="* looks a little worried about the idea."
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
   name="d"
  >
  </trigger>

  <trigger
   enabled="y"
   group="consider"
   match="* should be a fair fight!"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
   name="e"
  >
  </trigger>

  <trigger
   enabled="y"
   group="consider"
   match="* snickers nervously."
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
   name="f"
  >
  </trigger>
  
  <trigger
   enabled="y"
   group="consider"
   match="^(.*?) chuckles at the thought of you fighting (him|her|it)\.$"
   omit_from_output="y"
   regexp="y"
   script="adapt_consider"
   sequence="100"
   name="g"
  >
  </trigger>
    
  <trigger
   enabled="y"
   group="consider"
   match="Best run away from * while you can!"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
   name="h"
  >
  </trigger>
  
  <trigger
   enabled="y"
   group="consider"
   match="Challenging * would be either very brave or very stupid."
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
   name="i"
  >
  </trigger>
  
  <trigger
   enabled="y"
   group="consider"
   match="* would crush you like a bug!"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
   name="j"
  >
  </trigger>
  
  <trigger
   enabled="y"
   group="consider"
   match="* would dance on your grave!"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
   name="k"
  >
  </trigger>
  
  <trigger
   enabled="y"
   group="consider"
   match="* says 'BEGONE FROM MY SIGHT unworthy!'"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
   name="l"
  >
  </trigger>
 
  <trigger
   enabled="y"
   group="consider"
   match="You would be completely annihilated by *!"
   omit_from_output="y"
   script="adapt_consider"
   sequence="100"
   name="m"
  >
  </trigger>
  
</triggers>

<!--  Script  -->


<script>
<![CDATA[

consider_messages = {
    a = { range = "-19 and below",  colour = "gray", },
    b = { range = "-10 to -19",     colour = "darkgreen", },
    c = { range = "-6 to -9",       colour = "forestgreen", },
    d = { range = "-2 to -6",       colour = "chartreuse", },
    e = { range = "-2 to +2",       colour = "springgreen", },
    f = { range = "+2 to +3",       colour = "darkgoldenrod", },
    g = { range = "+3 to +8",       colour = "gold", },
    h = { range = "+8 to +16",      colour = "tomato", },
    i = { range = "+16 to +21",     colour = "crimson", },
    j = { range = "+21 to +32",     colour = "lightpink", },
    k = { range = "+32 to +41",     colour = "darkmagenta", },
    l = { range = "+41 to +50",     colour = "darkviolet", },
    m = { range = "+50 and above",  colour = "magenta", },
      } -- end of consider_messages
      
function adapt_consider (name, line, wildcards)
  mob = consider_messages [name]
  if mob then
    ColourNote (mob.colour, "", line .. " (" .. mob.range .. ")" )
  else
    ColourNote ("white", "blue", "Could not find message for trigger: " .. line)
  end -- if
end -- adapt_consider

]]>
</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.


2,647 views.

[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

[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]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]