[phpBB Debug] PHP Warning: in file [ROOT]/viewtopic.php on line 2067: Undefined array key "author"
[phpBB Debug] PHP Warning: in file [ROOT]/viewtopic.php on line 2067: Undefined array key "author"
[phpBB Debug] PHP Warning: in file [ROOT]/viewtopic.php on line 2067: Undefined array key "author"
[phpBB Debug] PHP Warning: in file [ROOT]/viewtopic.php on line 2067: Undefined array key "author"
[phpBB Debug] PHP Warning: in file [ROOT]/viewtopic.php on line 2067: Undefined array key "author"
[phpBB Debug] PHP Warning: in file [ROOT]/viewtopic.php on line 2067: Undefined array key "author"
[phpBB Debug] PHP Warning: in file [ROOT]/viewtopic.php on line 2067: Undefined array key "author"
[phpBB Debug] PHP Warning: in file [ROOT]/viewtopic.php on line 2067: Undefined array key "author"
[phpBB Debug] PHP Warning: in file [ROOT]/viewtopic.php on line 2067: Undefined array key "author"
[phpBB Debug] PHP Warning: in file [ROOT]/viewtopic.php on line 2067: Undefined array key "author"
http://www.shatteredisles.com • MUSHclient Plugins
Page 1 of 6

MUSHclient Plugins

Posted: Mon Nov 04, 2013 12:27 am
by
Decided to just put a new topic to keep things organized

Re: MUSHclient Plugins

Posted: Mon Nov 04, 2013 12:29 am
by
This is the mapper I got working for MUSHclient.
Copy and paste to notepad. save as an .xml

Code: Select all

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>

<muclient>
<plugin
   name="Shattered_Isles_Mapper"
   author="Teef"
   id="8b5490301cec2d16454f2234"
   language="Lua"
   purpose="Simple Mapper for Shattered Isles"
   save_state="y"
   date_written="2010-08-30"
   requires="4.51"
   version="1.1"
   >
<![CDATA[
Install this plugin to show a map.

This creates a map that can be dragged around by the name using the Mapper plugin included in MUSHclient 4.51 and up

Zoom in with scroll wheel.
Adjust colors and size with configure button in corner
Hover cursor over square to get room name.
Click on square to speedwalk to it. 

The map uses room names, room descriptions, and exits to draw.
You have to teach the mapper by going back and forth since it doesn't assume that all directions are two-way.


Modified by Teef
Based on Simple Mapper by Nick Gammon

]]>
</plugin>


<!--  Triggers  -->

<triggers>
   <trigger
   enabled="y"
   group="mappertest"
   lines_to_match="4"
   keep_evaluating="y"
   match="^\[(?!Delay)(.+?)\.\]\n\n(.*\n(\S.*\n)*)\Z"
   multi_line="y"
   name="Name_Desc"
   regexp="y"
   script="Name_Desc"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="y"
   keep_evaluating="y"
   match="^Obvious Exits\: .*"
   name="Name_Or_Exits"
   regexp="y"
   script="Name_Or_Exits"
   sequence="100"
  >
  </trigger>
</triggers>

<aliases>
<alias
   match="^mapper find ([\w* %d/"]+)$"
   enabled="y"
   sequence="100"
   script="map_find"
   regexp="y"
  >
  
  </alias>  
  </aliases>
  

<!--  Script  -->


<script>
<![CDATA[

local MAX_NAME_LENGTH = 60
local MUD_NAME = "Shattered Isles"

require "mapper"
require "serialize"
require "copytable"
require "commas"
  
default_config = {
  -- assorted colours
  BACKGROUND_COLOUR       = { name = "Background",        colour =  ColourNameToRGB "lightseagreen", },
  ROOM_COLOUR             = { name = "Room",              colour =  ColourNameToRGB "cyan", },
  EXIT_COLOUR             = { name = "Exit",              colour =  ColourNameToRGB "darkgreen", },
  EXIT_COLOUR_UP_DOWN     = { name = "Exit up/down",      colour =  ColourNameToRGB "darkmagenta", },
  EXIT_COLOUR_IN_OUT      = { name = "Exit in/out",       colour =  ColourNameToRGB "#3775E8", },
  OUR_ROOM_COLOUR         = { name = "Our room",          colour =  ColourNameToRGB "black", },
  UNKNOWN_ROOM_COLOUR     = { name = "Unknown room",      colour =  ColourNameToRGB "#00CACA", },
  DIFFERENT_AREA_COLOUR   = { name = "Another area",      colour =  ColourNameToRGB "#009393", },
  MAPPER_NOTE_COLOUR      = { name = "Messages",          colour =  ColourNameToRGB "lightgreen" },
  
  ROOM_NAME_TEXT          = { name = "Room name text",    colour = ColourNameToRGB "#BEF3F1", },
  ROOM_NAME_FILL          = { name = "Room name fill",    colour = ColourNameToRGB "#105653", },
  ROOM_NAME_BORDER        = { name = "Room name box",     colour = ColourNameToRGB "black", },
  
  AREA_NAME_TEXT          = { name = "Area name text",    colour = ColourNameToRGB "#BEF3F1",},
  AREA_NAME_FILL          = { name = "Area name fill",    colour = ColourNameToRGB "#105653", },   
  AREA_NAME_BORDER        = { name = "Area name box",     colour = ColourNameToRGB "black", },
               
  FONT = { name =  get_preferred_font {"Dina",  "Lucida Console",  "Fixedsys", "Courier", "Sylfaen",} ,
           size = 8
         } ,
         
  -- size of map window
  WINDOW = { width = 400, height = 400 },
  
  -- how far from where we are standing to draw (rooms)
  SCAN = { depth = 30 },
  
  -- speedwalk delay
  DELAY = { time = 0.3 },
  
  -- how many seconds to show "recent visit" lines (default 3 minutes)
  LAST_VISIT_TIME = { time = 60 * 3 },  
  
  }
  
rooms = {}

valid_direction = {
  n = "n",
  s = "s",
  e = "e",
  w = "w",
  u = "u",
  d = "d",
  ne = "ne",
  sw = "sw",
  nw = "nw",
  se = "se",
  north = "n",
  south = "s",
  east = "e",
  west = "w",
  up = "u",
  down = "d",
  northeast = "ne",
  northwest = "nw",
  southeast = "se",
  southwest = "sw",
  ['in'] = "in",
  out = "out",
  }  -- end of valid_direction
  
-- -----------------------------------------------------------------
-- We have a room name and room exits
-- -----------------------------------------------------------------

function process_exits (exits_str)-- changed from process_room_desc
 -- local roomname = trim (wildcards.roomname)
 -- local exits_str = trim (wildcards.exits)
 -- local roomdesc = trim (wildcards.roomdesc)

  -- ColourNote ("white", "blue", "exits: " .. exits_str)  -- debug
  
  -- generate a "room ID" by hashing the room description and exits
  uid = utils.tohex (utils.md5 (roomname .. roomdesc .. exits_str))
  uid = uid:sub (1, 25)  

  -- break up exits into individual directions
  exits = {}
  
  for exit in string.gmatch (exits_str, "%w+") do
    local ex = valid_direction [exit]
    if ex then
      exits [ex] = "0"  -- don't know where it goes yet
    end -- if
  end -- for
  
  local name = roomname
  
  if #name > MAX_NAME_LENGTH then
    name = name:sub (1, MAX_NAME_LENGTH - 3) .. "..."
  end -- if too long
  
  -- add to table if not known
  if not rooms [uid] then
    ColourNote ("cyan", "", "Mapper adding room " .. uid:sub (1, 8) .. ", name: " .. name)
    rooms [uid] = { name = name, desc = roomdesc, exits = exits, area = MUD_NAME }
  end -- if

  -- save so we know current room later on  
  current_room = uid
  
  -- call mapper to draw this rom
  mapper.draw (uid)

  -- try to work out where previous room's exit led  
  if expected_exit == "0" and from_room then
    fix_up_exit ()
  end -- exit was wrong
    
end -- Name_Or_Exits


function Name_Or_Exits (name, line, wildcards)

  exits = string.match (line, "^Obvious Exits\: (.*)")
  
  if exits then
    process_exits (exits)
  end -- if

  --roomname = line
  --roomdesc = nil
  
end -- Name_Or_Exits

function Name_Desc (name, line, wildcards) -- Teef roomname and roomdesc grab
  roomname = wildcards[1]
  roomitems = wildcards[2]
  roomdesc = string.gsub (roomitems , "  You notice .+$", "\n")
  
  --roomdesc = (roomdesc or "" ) .. line .. "\n"--Teef
end -- Name_Desc

-- -----------------------------------------------------------------
-- mapper 'get_room' callback - it wants to know about room uid
-- -----------------------------------------------------------------

function get_room (uid)
  
  if not rooms [uid] then 
   return nil
  end -- if
 
  local room = copytable.deep (rooms [uid])
 
  local texits = {}
  for dir in pairs (room.exits) do
    table.insert (texits, dir)
  end -- for
  table.sort (texits)
  
  room.hovermessage = string.format (
       "%s\tExits: %s\nRoom: %s",
        room.name or "unknown", 
        table.concat (texits, ", "),
      uid
      )
      
  if uid == current_room then
    room.bordercolour = config.OUR_ROOM_COLOUR.colour
    room.borderpenwidth = 2
  end -- not in this area
      
  return room
  
end -- get_room

-- -----------------------------------------------------------------
-- We have changed rooms - work out where the previous room led to 
-- -----------------------------------------------------------------

function fix_up_exit ()

  -- where we were before
  local room = rooms [from_room]
  
  -- leads to here
  room.exits [last_direction_moved] = current_room
    
  -- clear for next time
  last_direction_moved = nil
  from_room = nil
  
end -- fix_up_exit

-- -----------------------------------------------------------------
-- try to detect when we send a movement command
-- -----------------------------------------------------------------

function OnPluginSent (sText)
  if valid_direction [sText] then
    last_direction_moved = valid_direction [sText]
    -- print ("Just moved", last_direction_moved)
    if current_room and rooms [current_room] then
      expected_exit = rooms [current_room].exits [last_direction_moved]
      if expected_exit then
        from_room = current_room
      end -- if
    -- print ("expected exit for this direction is to room", expected_exit)
    end -- if
  end -- if 
end -- function

-- -----------------------------------------------------------------
-- Plugin Install
-- -----------------------------------------------------------------

function OnPluginInstall ()
  
  config = {}  -- in case not found

  -- get saved configuration
  assert (loadstring (GetVariable ("config") or "")) ()

  -- allow for additions to config
  for k, v in pairs (default_config) do
    config [k] = config [k] or v
  end -- for
    
  -- and rooms
  assert (loadstring (GetVariable ("rooms") or "")) ()
  
  -- initialize mapper
  
  mapper.init { config = config, get_room = get_room  } 
  mapper.mapprint (string.format ("MUSHclient mapper installed, version %0.1f", mapper.VERSION))

end -- OnPluginInstall

-- -----------------------------------------------------------------
-- Plugin Save State
-- -----------------------------------------------------------------

function OnPluginSaveState ()
  mapper.save_state ()
  SetVariable ("config", "config = " .. serialize.save_simple (config))
  SetVariable ("rooms", "rooms = " .. serialize.save_simple (rooms))
end -- OnPluginSaveState

-- -----------------------------------------------------------------
-- Plugin just connected to world
-- -----------------------------------------------------------------

function OnPluginConnect ()
  from_room = nil
  last_direction_moved = nil
end -- OnPluginConnect
  
-- -----------------------------------------------------------------
-- Find a room
-- -----------------------------------------------------------------

function map_find (name, line, wildcards)
 
  local room_ids = {}
  local count = 0
  local wanted = (wildcards [1]):lower ()

  -- scan all rooms looking for a simple match  
  for k, v in pairs (rooms) do
     local desc = v.desc:lower ()
     if string.find (desc, wanted, 1, true) then
       room_ids [k] = true
       count = count + 1
     end -- if
  end   -- finding room
  
  -- see if nearby
  mapper.find (
    function (uid) 
      local room = room_ids [uid] 
      if room then
        room_ids [uid] = nil
      end -- if
      return room, next (room_ids) == nil
    end,  -- function
    show_vnums,  -- show vnum?
    count,      -- how many to expect
    false       -- don't auto-walk
    )
  
end -- map_find


]]>
</script>


</muclient>

11/5 fixed bug. Changed roomdesc = string.gsub (roomitems , "You notice .+$", "") to roomdesc = string.gsub (roomitems , " You notice .+$", "\n")

Re: MUSHclient Plugins

Posted: Mon Nov 04, 2013 1:12 am
by
For DG style compass, healthbars and position indicator
https://www.dropbox.com/sh/ppe3xbfkyvft ... /dgcompass

just copy that folder and put that in your plugin folder and put the xml into your plugin folder as well and boom goes the dynamite. I'll update as I make changes to it

MUSHclient folder -> World folder -> plugins folder. put the xml and the folder "dgcompass" with the icons in it there. C:\Program Files\MUSHclient\worlds\plugins

Re: MUSHclient Plugins

Posted: Tue Nov 05, 2013 12:25 am
by
Just a quick button bar that can be put by the mapper so you don't have to take your hand off the mouse while walking around.
buttons can be horizontal or vertical.
https://www.dropbox.com/sh/ppe3xbfkyvft ... ompButtons

load the .xml like any other plug in. Nothing fancy the icons can just go straight into the 1st MUSHclient folder free without a folder of their own.
This is also a good demo of how you can make your own buttons and such.

Re: MUSHclient Plugins

Posted: Tue Nov 05, 2013 12:43 am
by
So, the part that i couldnt figure out until now, is that you seem to have to open up the plug-in window (shift+ctrl+p) and pick these files.

Re: MUSHclient Plugins

Posted: Tue Nov 05, 2013 12:58 am
by
I always did it the hard way around lol just click on File then go down to Plugins. I never learn shortcuts

Re: MUSHclient Plugins

Posted: Tue Nov 05, 2013 3:52 pm
by
updated compass with mask icon to show when hidden. just add the Hidden.bmp to your folder and replace the .xml with the updated one and reinstall

Re: MUSHclient Plugins

Posted: Tue Nov 05, 2013 3:58 pm
by
OH man..how did you get hidden to work? I was trying to get that going but the prompt only tells you when you are hidden and not when you are visible.

For some reason i was having a really hard time with that.

Oh wait..maybe I can just do a if hidden to turn it on and a if !hidden to turn it off. Is that what you did? I must have tried that and it didnt work or something. I'll try this again.

Re: MUSHclient Plugins

Posted: Tue Nov 05, 2013 5:09 pm
by
Well after a lot of soul searching... i.e. watching the scroll for hours on end while PTing I noticed that there are only 2 possible messages You conceal yourself from plain view. and You reveal yourself from your hidden position. and triggered off of those and off the score command You are hidden to set it if you log in while hidden. The prompt toggle was also giving me fits so I just went with triggers since there is no prompt for "visible" I was gonna go off the prompt and use like a skull for when you're a ghost but I guess they took that out? Because I died and spent no time as a ghost yesterday.

Now if there are some spells or other ways to make a person hidden. Just add those triggers to the script.

Re: MUSHclient Plugins

Posted: Tue Nov 05, 2013 6:46 pm
by
Yeah I thought about that too after I asked the question and it kind of came to me the same way...
Wait what a I doing..there's only one possible message for being hidden and one for coming out of hiding.

Still bugs me that we cant do it through the prompt, but i guess the trigger on the line is probably a little more real-time anyway.