MUSHclient Plugins
-
Pyratherndar
- Citizen of Archai
- Posts: 23
- Joined: Sun Sep 13, 2015 12:32 am
Re: MUSHclient Plugins
The post that was posted by Kody _Oakborne has a mapper posted and it is written out in detailed length, my question is --is there different sections that need to by pluggin apart from eachother or does the entire thing go in as oe plug in and if it isn't all one can you please tell me what i am looking for when i stop from one plug in to the next. thank you very much for you time and patients.
Re: MUSHclient Plugins
Hi Pyra,
What Kody posted is the whole thing. You copy the whole thing to a text editor like Notepad and save it as Chat_Capture_Miniwindow.xml and put it in C:\Program Files\MUSHclient\worlds\plugins (or where ever you have mushclient installed).
Then in mushclient go to File/Plugins (or Shift+Ctrl+P) and click on the [Add] button. Find the file you just saved and load it up. That should get you going with it.
What Kody posted is the whole thing. You copy the whole thing to a text editor like Notepad and save it as Chat_Capture_Miniwindow.xml and put it in C:\Program Files\MUSHclient\worlds\plugins (or where ever you have mushclient installed).
Then in mushclient go to File/Plugins (or Shift+Ctrl+P) and click on the [Add] button. Find the file you just saved and load it up. That should get you going with it.
- Kody_Oakborne
- Citizen of Archai
- Posts: 209
- Joined: Tue Apr 22, 2014 1:35 am
Re: MUSHclient Plugins
Found a room that still would chat in the plug in. I've edited the plug in and edited my post on page 2 to include the newest plug in
May the trees guard you, and house you, and guide you.
Kody
Kody
Re: MUSHclient Plugins
Rum, south of tavern?
- Kody_Oakborne
- Citizen of Archai
- Posts: 209
- Joined: Tue Apr 22, 2014 1:35 am
Re: MUSHclient Plugins
Yes. Due to the word "askew," it was picking up the wildcard from the trigger for "ask_," for when you ask so and so. I edited the trigger to add a space, I believe there's a separate trigger for "asks_," that could be left alone. I did a small test to see if it would still work and it seemed to work fine. Let me know if you find any more issues.RPGer wrote:Rum, south of tavern?
May the trees guard you, and house you, and guide you.
Kody
Kody
Re: MUSHclient Plugins
I made some minor improvements to the mapper:
* Back-exits are now auto-mapped. You no longer have to double walk to get the rooms linked
* Doors (gates,etc) no longer confuse it. If you walk through the door in a normal direction, it will be mapped
* Corrected issue with walking too fast causing incorrect room linkages.
* Added Right-click options: Delete Room, Delete Exit, and Edit Bookmark
* Bookmarks now show up when you enter a room (right below the exits)
Cheers
* Back-exits are now auto-mapped. You no longer have to double walk to get the rooms linked
* Doors (gates,etc) no longer confuse it. If you walk through the door in a normal direction, it will be mapped
* Corrected issue with walking too fast causing incorrect room linkages.
* Added Right-click options: Delete Room, Delete Exit, and Edit Bookmark
* Bookmarks now show up when you enter a room (right below the exits)
Cheers
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
Modified by Galaban
]]>
</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 "darkorange" },
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 = {}
last_auto_added_exits = {}
-- When we auto-add inverse exits, they will be incorrect for mazes.
-- So, this value will keep the last N auto-added inverse exits in memory.
-- All prior auto-added inverse exits and all other exits are solidified.
-- [=NOTE=] LOTJ specific. LOT has very few mazes, so this should be rare.
MAX_HISTORICAL_EXITS_TO_VALIDATE = 10
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
-- for calculating the way back
local inverse_direction = {
n = "s",
s = "n",
e = "w",
w = "e",
u = "d",
d = "u",
ne = "sw",
sw = "ne",
nw = "se",
se = "nw",
['in'] = "out",
out = "in",
}
-------------------------------------------------------------------
-- Back-tracking exit history (presume the back-track is correct)
-------------------------------------------------------------------
currIndex = 1
count = 0
function autoexitbuffer_push_value(room_id, dir)
--store the value
last_auto_added_exits[currIndex] = {room_id, dir}
currIndex = currIndex + 1
if (currIndex > MAX_HISTORICAL_EXITS_TO_VALIDATE) then
currIndex = 1
end
if (count < MAX_HISTORICAL_EXITS_TO_VALIDATE) then
count = count + 1
end
DebugNote(3,"Pushing auto-exit buffer from",room_id," direction",dir)
end
function autoexitbuffer_contains_value(room_id, dir)
if (count < 1) then return end
for i = 1, MAX_HISTORICAL_EXITS_TO_VALIDATE do
if (last_auto_added_exits[i] ~= nil and
last_auto_added_exits[i][1] == room_id and
last_auto_added_exits[i][2] == dir) then
DebugNote(3,"Found auto-exit buffer from",room_id," direction",dir)
return true
end
end
return false
end
function autoexitbuffer_drop_value(room_id, dir)
if (count < 1) then return end
for i = 1, MAX_HISTORICAL_EXITS_TO_VALIDATE do
if (last_auto_added_exits[i] ~= nil and
last_auto_added_exits[i][1] == room_id and
last_auto_added_exits[i][2] == dir) then
DebugNote(3,"Dropping room from auto-exit buffer: from",room_id," direction",dir)
count = count - 1
return true
end
end
return false
end
function DebugNote(level,...)
-- NOTE: We're basically hard-coded a "always" notes.
if (level > 1) then
return
end
local arg={...}
local outStr = ""
for i,v in ipairs(arg) do
local outVal = v or "nil"
if (outVal == "") then outVal = "<empty>" end
if (outVal == true) then outVal = "true" end
if (outVal == false) then outVal = "false" end
if (outStr ~= "") then outStr = outStr .. " " end
outStr = outStr .. outVal
end
if (level == 1) then
mapper.mapprint(outStr)
else
ColourNote("orange","black", outStr)
end
end
-- -----------------------------------------------------------------
-- 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
-- try to work out where previous room's exit led
if (from_room and (expected_exit ~= nil and expected_exit ~= "0")) then
DebugNote(2,"Expected exit: ",expected_exit,"from_room",from_room)
-- If we left a room and it lead where we did not expect it to go, fix it up.
-- If it did lead where we expected it to go, make sure it's not in the list of potentially invalid exits.
if (current_room ~= expected_exit) then
DebugNote(2,"Fixing exit. CurrRoom: ",current_room," expected exit: ",expected_exit,"...")
-- Only try to fix up this exit if it was one of our recently auto-added inverse exits.
-- EG: going from Room 1 to 2 automatically adds back-links from 2 to 1. But if that was bad, fix it.
-- 99% of the time (curr ~= expected) is due to fast movement
-- So, we want to ignore this unless this happens to be one of the presumptions we made.
if (autoexitbuffer_contains_value(from_room, last_direction_moved)) then
--expected_exit = rooms [current_room].exits[last_direction_moved]
fix_up_exit(false)
end
else -- Expected exit was correct.
autoexitbuffer_drop_value(from_room, last_direction_moved)
end
elseif ((expected_exit == "0" or expected_exit == nil) and from_room) then
fix_up_exit (true)
end -- exit was wrong
-- call mapper to draw this rom
mapper.draw (uid)
-- We've handled it, so clear it out so we don't mess with it again
DebugNote(3,"Room processed. Clearing last_direction_moved.")
last_direction_moved = nil
from_room = nil
end -- Name_Or_Exits
function print_notes()
local note = rooms[current_room].notes
if (note ~= nil and note ~= "") then
Note("")
DebugNote(1,"[Mapper Note]:",note)
end
end
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
print_notes()
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\nNotes: %s",
room.name or "unknown",
table.concat (texits, ", "),
uid,
rooms[uid].notes or ""
)
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 (setting_zero_exit)
DebugNote(3,"Calling fix_up_exit. Zero exit?",setting_zero_exit,"last_dir_moved", last_direction_moved)
-- where we were before
local room = rooms [from_room]
-- leads to here
room.exits [last_direction_moved] = current_room
if (setting_zero_exit) then
local inverse_direction = inverse_direction[last_direction_moved]
local room = rooms [current_room]
room.exits [inverse_direction] = from_room
autoexitbuffer_push_value(current_room, inverse_direction)
end
end -- fix_up_exit
-- -----------------------------------------------------------------
-- try to detect when we send a movement command
-- -----------------------------------------------------------------
function OnPluginSent (sText)
if valid_direction [sText] then
local previous_direction = last_direction_moved
last_direction_moved = valid_direction [sText]
DebugNote(2, "Just moved", last_direction_moved)
if current_room and rooms [current_room] then
expected_exit = rooms [current_room].exits [last_direction_moved]
DebugNote(3,"Room:",current_room, "Direction:", last_direction_moved,"Expected exit:",expected_exit)
--if expected_exit then
-- If we walk through a "wall", that's a problem on most muds. Not on Shattered Islands, though!
from_room = current_room
-- OK, here's the bug we're trying to avoid:
-- If we move from room 1 to 2 to 3, we will not receive the MSDP vnum for 2
-- before we see 3. So, we hit room 3 and think that 1 leads to 3...
if (previous_direction) then
from_room = nil
DebugNote(2,"Previous movement detected. Not logging room.")
end
--end -- if
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, room_click = room_click }
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
-------------------------------------------------------------------
-- Right-Click Room
-------------------------------------------------------------------
function room_click (uid, flags)
-- check we got room at all
if not uid then
return nil
end
-- look it up
local room = rooms [uid]
if not room then
return
end
local function checkmark (which)
if rooms [uid].info == which then
return "+"
else
return ""
end
end
local handlers = {
{ name = "Delete Exit", func = room_delete_exit} ,
{ name = "Delete Room", func = room_delete} ,
{ name = "Edit bookmark", func = room_edit_bookmark} ,
}
local t, tf = {}, {}
for _, v in pairs (handlers) do
table.insert (t, v.name)
tf[string.match(v.name, "[^\+]+")] = v.func --Get rid of the + sign from the function menu table.
end
local choice = WindowMenu (mapper.win,
WindowInfo (mapper.win, 14),
WindowInfo (mapper.win, 15),
table.concat (t, "|"))
local f = tf [choice]
if (f) then
f (room, uid)
end
end
-------------------------------------------------------------------
-- Deletes Room Exit (Called from Right+Click Menu)
-------------------------------------------------------------------
function room_delete_exit (room, uid)
local available = {
n = "North",
s = "South",
e = "East",
w = "West",
u = "Up",
d = "Down",
ne = "Northeast",
sw = "Southwest",
nw = "Northwest",
se = "Southeast",
['in'] = "In",
out = "Out",
}
-- remove non-existent exits
for k in pairs (available) do
if room.exits [k] then
available [k] = available [k] .. " --> " .. room.exits [k]
else
available [k] = nil
end
end
if next (available) == nil then
utils.msgbox ("There are no exits from this room.", "No exits!", "ok", "!", 1)
return
end
local chosen_exit = utils.listbox ("Choose exit to delete", "Exits ...", available )
if not chosen_exit then
return
end
DebugNote(1,"Deleted exit", available [chosen_exit], "from room", uid, "from database.")
-- update in-memory table
rooms [uid].exits [chosen_exit] = nil
DebugNote(3,"Redrawing map")
mapper.draw (current_room)
end
-------------------------------------------------------------------
-- Deletes Room Exit (Called from Right+Click Menu)
-------------------------------------------------------------------
function room_delete(room, uid)
if (uid == current_room) then
ColourNote("orange","black","You cannot delete your current room.")
return
end
-- update in-memory table, resetting exits to zero.
for i, v in pairs(rooms[uid].exits) do
DebugNote(1,"deleting exit ", i, " leading ", v)
local exit_room = rooms[uid].exits[i]
local invers_dir = inverse_direction[i]
rooms[exit_room].exits[invers_dir] = "0"
rooms[uid].exits[i] = "0" -- sanity
end
rooms[uid] = nil
DebugNote(1,"Deleted room", uid, "from database.")
DebugNote(3,"Redrawing map")
mapper.draw (current_room)
end
-------------------------------------------------------------------
-- Edit Bookmarks
-------------------------------------------------------------------
function room_edit_bookmark (room, uid)
local notes, found
if (rooms[uid].notes ~= "" and rooms[uid].notes ~= nil) then
notes = rooms[uid].notes
found = true
end
local inboxtext = "Enter room comment (creates a bookmark for this room)"
if found then
inboxtext = "Modify room comment (clear it to delete from database)"
end
newnotes = utils.inputbox (inboxtext, room.name, notes)
if not newnotes then
return
end
if newnotes == "" then
if not found then
DebugNote(1,"No comment entered, bookmark not saved.")
else
DebugNote(1,"Bookmark for room", uid, "deleted.")
rooms[uid].notes = nil
end
return
end
if notes == newnotes then
-- no change made
return
end
if found then
DebugNote(1,"Bookmark for room", uid, "changed to:", newnotes)
else
DebugNote(1,"Bookmark added to room", uid, ":", newnotes)
end
rooms[uid].notes = newnotes
end
]]>
</script>
</muclient>
Re: MUSHclient Plugins
Are these instructions still valid? If I could get an automapper to work I might go back to using MUSHclient.RPGer wrote:Hi Pyra,
What Kody posted is the whole thing. You copy the whole thing to a text editor like Notepad and save it as Chat_Capture_Miniwindow.xml and put it in C:\Program Files\MUSHclient\worlds\plugins (or where ever you have mushclient installed).
Then in mushclient go to File/Plugins (or Shift+Ctrl+P) and click on the [Add] button. Find the file you just saved and load it up. That should get you going with it.
Re: MUSHclient Plugins
Yup, that's it.Swamp Ape wrote: Are these instructions still valid? If I could get an automapper to work I might go back to using MUSHclient.
The mapper still has some issues, since it's using title/desc/exits in a hash, but overall it's pretty impressive (Thanks to Teef)
Last edited by galaban on Tue Apr 12, 2016 3:47 pm, edited 1 time in total.
- Kody_Oakborne
- Citizen of Archai
- Posts: 209
- Joined: Tue Apr 22, 2014 1:35 am
Re: MUSHclient Plugins
All of these should still be functional; I never reviewed the mapper because I don't really care for mappers, but everything else is working fine when I just loaded it up on my new PC.
May the trees guard you, and house you, and guide you.
Kody
Kody
Re: MUSHclient Plugins
Thank you galaban.
The update and the right-click edits are much appreciated.
Time to re-map the Entire world!(mwa)
The update and the right-click edits are much appreciated.
Time to re-map the Entire world!(mwa)