Message
| The plugin below illustrates how you can usefully use the Hyperlink script command to make a nice extra window that shows all sorts of useful information about your MUD, with clickable hyperlinks. See the screen shot in the next post for an example of how it looks.
The underlined green and yellow words actually send the command to the MUD. The brown words send "help (word)" so you can let the MUD show you more help.
This particular plugin is configured for Aardwolf, but the general idea could be adopted by changing the wording in the plugin as required. Most of it is driven by tables of words, and explanations.
You also need to create a dummy world (that is, a world with IP address of 0.0.0.0) which is the world which is used to display this information. The name of this world needs to be the same as in the variable helper_world (Helplist in this example), in the sub-folder 'folder' (Aardwolf in this example).
The Helplist.mcl file should be here in a standard MUSHclient installation:
C:\Program Files\MUSHclient\worlds\Aardwolf\Helplist.mcl
In order for clicking on words to carry out the appropriate actions, you should also install the plugin Send_Input_To_Main_World as described here:
http://www.gammon.com.au/forum/?id=8769
To use, copy from between the lines below, save as Aardwolf_Helplist.xml in your MUSHclient -> Worlds -> Plugins folder, and then use the File menu -> Plugins to install it.
Alternatively, RH click the link below and choose "Save Link As" (or "Save Linked File As") to save the linked file.
http://www.gammon.com.au/mushclient/plugins/Aardwolf/Aardwolf_Helplist.xml
In a standard MUSHclient installation this file should to into this directory:
C:\Program Files\MUSHclient\worlds\plugins\Aardwolf\
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Thursday, June 26, 2008, 12:22 PM -->
<!-- MuClient version 4.29 -->
<!-- Plugin "Aardwolf_Helplist" generated by Plugin Wizard -->
<muclient>
<plugin
name="Aardwolf_Helplist"
author="Nick Gammon"
id="8a8e24942fe60f88bcaf1807"
language="Lua"
purpose="Makes a helper window with hyperlinks"
date_written="2008-06-26 12:21:22"
requires="4.29"
version="1.0"
save_state="y"
>
<description trim="y">
<![CDATA[
Creates a window with various helpful commands in it, hyperlinked.
]]>
</description>
</plugin>
<!-- Aliases -->
<aliases>
<alias
name="helplist"
script="make_helper_window"
match="helplist"
enabled="y"
sequence="100"
>
</alias>
</aliases>
<script>
<![CDATA[
require "getworld"
helper_world = "Helplist"
folder = "Aardwolf"
spells = {
{ name = "Skills", desc = "List of skills." },
{ name = "Spells", desc = "List of spells." },
{ name = "Spells spellup", desc = "List of spellups (buffs)." },
{ name = "Spells combat", desc = "List of combat abilities." },
{ name = "Affects", desc = "Current affects (buffs) on you." },
} -- end spells
spellstrainer = function ()
w:ColourTell ("silver", "", "To get spells and skills training, do ")
w:Hyperlink ("recall", "", "", "yellow", "")
w:ColourTell ("silver", "", " and then ")
w:Hyperlink ("run u6ne", "", "", "yellow", "")
w:Note ""
end -- spellstrainer
gethealing = function ()
w:ColourTell ("silver", "", "To get healed, cured or restored, do ")
w:Hyperlink ("recall", "", "", "yellow", "")
w:ColourTell ("silver", "", ", ")
w:Hyperlink ("3e", "", "", "yellow", "")
w:ColourTell ("silver", "", " and then ")
w:Hyperlink ("heal", "", "", "yellow", "")
w:Note ""
end -- gethealing
movement = {
{ name = "Areas", desc= "Shows all areas in a level range." },
{ name = "Recall", desc= "Returns you to Aylor Grand Temple." },
{ name = "Speedwalks", desc= "Available speedwalks." },
{ name = "Mobdeaths", desc= "Shows most frequently killed mobs (monsters) " },
{ name = "Mobkills", desc= "Shows the mobs that most often kill players. " },
{ name = "Areadeaths", desc= "Shows areas with at least one mob killed. " },
{ name = "Areakills", desc= "Shows the mobs that most often kill players overall. " },
{ name = "Find all", desc= "Shows nearby places of interest in the city. " },
{ name = "Bigmap", desc= "Outdoors (not in an area), shows a large map." },
{ name = "Look", desc= "Look around current room." },
{ name = "Exits", desc= "See room exits." },
} -- end movement
todo = {
{ name = "Goals", desc = "See a list of quests you have open." },
{ name = "Quest Info", desc = "Show information about current quest" },
{ name = "Train", desc = "Show training costs for each of your stats." },
{ name = "Raceinfo", desc = "Show training costs modifiers for your race." },
{ name = "Exp", desc = "Experience you have, and need to level up." },
} -- end todo
-- Information about you
mystuff = {
{ name = "Score", desc = "Important information about your character." },
{ name = "Inventory", desc = "What is in your bags." },
{ name = "Equip", desc = "What you are wearing." },
{ name = "Hunger", desc = "Hunger and thirst." },
{ name = "Config", desc = "Your configuration options." },
{ name = "List", desc = "List what is for sale, if at a shop." },
{ name = "Worth", desc = "Shows your gold, bank balance, etc." },
{ name = "Myrank", desc = "Things you have done." },
} -- end mystuff
combat = {
{ name = "Consider all", desc = "Compare your own strength to others in the room." },
{ name = "Scan", desc = "Show characters in the immediate area." },
{ name = "Study", desc = "Show health of all characters in the room." },
{ name = "Where", desc = "Shows players nearby (or 'WHERE <mob>' to find a mob)." },
{ name = "Flee", desc = "Attempt to run away during combat. Costs experience." },
{ name = "Wimpy", desc = "Set character to auto flee when low on hit points." },
{ name = "Ownedwhere", desc = "Shows items you own, including your corpses." },
{ name = "Read page6", desc = "Shows popular low-level areas." },
} -- end combat
comms = {
{ name = "Channels", desc = "See a list of all channels available." },
{ name = "Friend", desc = "See your friends." },
{ name = "Info", desc = "View/Toggle Game info channels." },
{ name = "Quiet", desc = "Temporarily turn channels off/on (toggle)." },
{ name = "Socials", desc = "List socials in game." },
{ name = "Random", desc = "Use a random social." },
{ name = "Forums", desc = "See available message forums." },
{ name = "Note", desc = "Read next unread note." },
{ name = "Clist", desc = "Show list of clans." },
{ name = "Who", desc = "Show who is on Aardwolf." },
{ name = "Who helper", desc = "Show players prepared to help you." },
{ name = "CatchTells", desc = "Stores all tells sent to you (toggle)." },
{ name = "Replay", desc = "Displays all saved/caught tells." },
}
-- groups of related things
groups = {
{ name = "Spells and skills", list = spells,
extrafunc = spellstrainer,
extrahelp = { "Train", "Practice", "Learned", "Showspell", "Allspells"},
}, -- end Spells and skills
{ name = "Movement", list = movement,
extrahelp = { "coordinates", "world", "shortmap", "maptags", "explored", "enter" },
}, -- end Movement
{ name = "To do / improvements", list = todo,
extrahelp = { "Eat", "Drink", "Gulp", "Run", "Find", "aq", "Listen", "www", "rules" },
}, -- end To do
{ name = "Information about you", list = mystuff,
extrahelp = { "Appraise", "Identify", "Value", "Buy",
"Sell", "Bid", "Auction", "Deposit", "Withdraw",
"Experience", "Alignment", "Get", "Drop",
"Wear", "Wield", "Hold", "Remove", "Object Flags",
"Qp", "Tp", "Newhelp" },
}, -- end Information
{ name = "Combat", list = combat,
extrafunc = gethealing,
extrahelp = { "Healing", "Death", "Cr", "Cast",
"Sleep", "Wake", "Group", "pk", "hunt"},
}, -- end Combat
{ name = "Communications", list = comms,
extrahelp = { "Tell", "Reply", "Ignore", "Whois", "Warinfo",
"Say", "Emote", "Note", "Subscribe", "Forum",
"afk", "deaf", "ignore", "rank" },
}, -- end Communications
} -- end groups
function ShowExtraHelp (tbl)
w:ColourTell ("silver", "", "Also see ")
table.sort (tbl, function (a, b) return a:upper () < b:upper () end )
local total = #tbl
for i, item in ipairs (tbl) do
if i ~= 1 then
if i == total then
w:ColourTell ("silver", "", " and ")
else
w:ColourTell ("silver", "", ", ")
end -- if
end -- not first one
if w:GetLineInfo (w:GetLinesInBufferCount (), 2) > 70 then
w:Note ""
w:Tell (string.rep (" ", string.len ("Also see ")))
end -- if
w:Hyperlink ("help " .. item, item:upper (), "Help on '" .. item .. "'",
"goldenrod", "", false) -- not URL
end -- for each item
w:Note ""
end -- ShowExtraHelp
function show_a_group (g)
w:ColourNote ("yellow", "", g.name)
-- may as well put commands in alphabetic order
table.sort (g.list, function (a, b) return a.name < b.name; end)
-- show each one
for k, v in ipairs (g.list) do
w:ColourTell ("", "", " ")
w:Hyperlink (v.name, v.name, "Send '" .. v.name .. "'", "lime", "", false) -- not URL
w:ColourTell ("gray", "", string.rep (".", 16 - #v.name))
w:ColourNote ("white", "", v.desc)
end -- for loop
-- anything extra in this group?
if g.extrafunc then
g.extrafunc ()
end -- call function to do special stuff
-- additional table of things to put "help" in front of
if g.extrahelp then
ShowExtraHelp (g.extrahelp)
end -- table of additional things
-- show additional string
if g.extrastr then
w:ColourNote ("silver", "", g.extrastr)
end -- extra string to show
-- blank line between groups
w:Note ("")
end -- show_a_group
function make_helper_window ()
w = get_a_world (helper_world, folder)
if not w then
ColourNote ("white", "red", "Could not open window to display help in")
return
end -- if no window
w:SetCommandWindowHeight (0) -- no command window
w:DeleteOutput () -- get rid of greeting stuff
w:Activate ()
w:SetWorldWindowStatus (4) -- restore it
for k, v in ipairs (groups) do
show_a_group (v)
end -- for each group
w:ColourTell ("silver", "", "Type 'HELP <subject>' for help, ")
w:Hyperlink ("contents", "CONTENTS", "Display help categories",
"silver", "", false) -- not URL
w:ColourNote ("silver", "", " for help by category, 'INDEX x' for ")
w:ColourNote ("silver", "", "help on words beginning with x, or 'HELP SEARCH <word>' to search for a word.")
w:DoCommand "Start" -- scroll back to home
end -- make_helper_window
function IntroduceOurselves ()
Tell ("Type ")
Hyperlink ("helplist", "", "", "yellow", "")
Note (" for some helpful information about Aardwolf.")
end --
function OnPluginInstall ()
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 () -- do initialization stuff
end -- OnPluginInstall
function OnPluginEnable ()
-- ensure world file exists
CallPlugin ("35dfdbf3afc8cbf60c91277c", "CreateWorldFile", folder .. "," .. helper_world)
local w = get_a_world (helper_world, folder)
if w then
w:Activate ()
w:SetOption ("do_not_show_outstanding_lines", 1)
w:SetWorldWindowStatus (2) -- minimize it on install
w:SetCommandWindowHeight (0) -- no command window
end -- no world
-- Activate ()
DoAfterSpecial (2, "IntroduceOurselves ()", sendto.script)
end -- OnPluginEnable
function OnPluginDisable ()
local w = get_a_world (helper_world, folder)
if w then
w:SetWorldWindowStatus (2) -- minimize it on disable
end -- if
end -- OnPluginDisable
function OnPluginSaveState ()
SetVariable ("enabled", tostring (GetPluginInfo (GetPluginID (), 17)))
end -- OnPluginSaveState
]]>
</script>
</muclient>
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|