Aardwolf spellups plugin

Posted by Nick Gammon on Sun 13 Jul 2008 12:27 AM — 54 posts, 232,934 views.

Australia Forum Administrator #0

The plugin described provides "spellups" (buffs) for Aardwolf players.

First I will describe what it does, and then explain how to install it.

Initially, after installing, you will see a window which shows you have no spellups on you, and none requested:

One thing you can do now is request a couple of spellups, for example "armor" and "bless" by specifying them separated by commas:

    spellup armor, bless

The window changes to indicate those two are requested, and are also pending. Pending means you want them, but don't have them yet.

I have been sitting, so it can't cast them yet, so I'll stand up, and let it get on with it:

    stand

It immediately detected it could cast the spells since I changed position, and cast both of them. Now the spellup window shows they are both active:

The window also shows how long each one will last, and is refreshed each second. They are sorted into order with the soonest to expire at the top, so you can see at a glance if your spells are about to expire.

It can be a bit tedious for a high level player to work out all of their possible spellups, so if you want all of them you can just type "spellup all":

    spellup all

I sat down again so you can see the effect. The existing ones are still active, but another 10 are now pending. Let's stand up and let them take effect:

    stand

If a spell fails to cast, it detects that, and retries, until it is cast successfully. Spells are cast in the order you specify, so a more important one can be cast before a less important one.

We also see from the above screenshot that as spellups are about to expire, their "time to go" is coloured yellow (less than 3 minutes) or red (less than one minute). This gives you a visual cue that perhaps you should spellup again before starting a big fight.

You can also get "bad" spells on you (debuffs). This screenshot shows an example:

The spell "blindness" is shown in red to alert you the bad effect, and perhaps you could get it cured one way or another before continuing.


Other options

Remove an unwanted spellup

Perhaps you don't need 'underwater breathing' as it just wastes mana? You can remove it by preceding the name(s) of the spells with a minus sign:

    spellup - underwater

Add a wanted spellup

If you want to add a spell back, you can add it by preceding the name(s) of the spells with a plus sign:

    spellup + underwater

Pause spellups

If you are in the city and want to chat with friends without seeing lots of spellup messages, just type "spellup pause"

    spellup pause

Resume spellups

If you have paused spellups, and now want them to continue, just type "spellup resume"

    spellup resume 

Fast spellups

The default behaviour is for the spellup script to spell you up in the order you specify. That way, if mana is low, you spend it on an important spell, rather than something you might not need, like underwater breathing. However if you are in a hurry, you can do "spellup fast" which quickly casts all needed spellups, and then waits for any error messages, to recast any that failed:

    spellup fast 

Spellup other players

If another player requests a spellup, you can just type "spellup other (name)", which makes the script quickly cast all suitable spellups on the other player:

    spellup other Traethiel

Cancel all spellups

To remove all existing spellups (from the list), type "spellup none". Of course, existing spellups will continue to affect you, however they will not be recast when they expire.

    spellup none

Help on spellups

To be reminded of these options, type "spellup help" and a summary will appear in the output window.

    spellup help

Recoveries

Some spellups have recovery times (cooldowns). The plugin detects such cases, and shows a "recovery" line for each such spell. Any spell which is awaiting cooldown will be shown as "on cooldown", and the script will not attempt to recast it until the cooldown period is over.


Brief version

Once you are confident the spellup plugin is working properly, you can type "spellup brief" to see a shortened display.

    spellup brief

Type "spellup full" to return to the full version:
    spellup full
Amended on Sun 13 Jul 2008 06:40 AM by Nick Gammon
Australia Forum Administrator #1
To install, 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_Spellups.xml (44 Kb)


This plugin also uses these plugins and files:

http://www.gammon.com.au/mushclient/plugins/Aardwolf/Stats_Detector.xml (6 Kb)

http://www.gammon.com.au/mushclient/plugins/Aardwolf/AFK_Detector.xml ( 3 Kb)

http://www.gammon.com.au/mushclient/plugins/Aardwolf/Playing_Detector.xml (2 Kb)

http://www.gammon.com.au/mushclient/plugins/Aardwolf/Create_World_File.xml (2 Kb)

http://www.gammon.com.au/mushclient/plugins/Aardwolf/telnet_options.lua (2 Kb)


In a standard MUSHclient installation these files should to into this directory:


C:\Program Files\MUSHclient\worlds\plugins\Aardwolf\


You also need a "dummy world file" for the spellups to appear in (a world which connects to IP address 0.0.0.0).

You can make your own, or download this file:

http://www.gammon.com.au/mushclient/plugins/Aardwolf/Spellups.mcl

Put that into the "worlds\Aardwolf" directory, which in a standard installation would be:

C:\Program Files\MUSHclient\worlds\Aardwolf\




An easy way of installing all the required plugins is to install the "plugin installer" described below, and then let it load everything else for you:

http://www.gammon.com.au/forum/?id=8767




The other plugins are explained here:

Stats detector:

http://www.gammon.com.au/forum/?id=8776

AFK detector:

http://www.gammon.com.au/forum/?id=8779

Playing detector:

http://www.gammon.com.au/forum/?id=8778

Telnet options:

http://www.gammon.com.au/forum/?id=8775
Amended on Sun 13 Jul 2008 06:38 AM by Nick Gammon
Australia Forum Administrator #2
You can also cast spells by number, if that is how you remember them. For example:


spellup 72, 34, 35


It replies:


Requested (3): Shield, Detect invis, Detect magic


That confirms you got the numbers right. ;)
#3
Is there anyway you could explain to me in full detail how do put this spellupscript on my computer? I am not very smart when it comes to these things. when I even try to save these things it gives me an option to save them to desktop and stuff but not to save them under administration files. should I save to desktop then move to other?
If you could just help me I would really appreciate it...I am new to mud and could really use it
thanks !
Australia Forum Administrator #4
Certainly you can save them on the desktop and then move them.

I believe Lasher is working on an installer to automate the process, it should be out in a couple of days.

Meanwhile, locate the MUSHclient install, which defaults to:


C:\Program Files\MUSHclient\


Inside that directory should be a "worlds" directory. If necessary, make a subfolder to hold the "dummy world file" in which the spellup messages appear:


C:\Program Files\MUSHclient\worlds\Aardwolf\


Download the following file and put into that directory:

http://www.gammon.com.au/mushclient/plugins/Aardwolf/Spellups.mcl




Then, go back up to the directory:


C:\Program Files\MUSHclient\worlds\plugins\


Make another directory inside plugins called Aardwolf (if it isn't there already):


C:\Program Files\MUSHclient\worlds\plugins\Aardwolf\


Download the following files and copy into that directory:

http://www.gammon.com.au/mushclient/plugins/Aardwolf/Stats_Detector.xml (6 Kb)
http://www.gammon.com.au/mushclient/plugins/Aardwolf/AFK_Detector.xml ( 3 Kb)
http://www.gammon.com.au/mushclient/plugins/Aardwolf/Playing_Detector.xml (2 Kb)
http://www.gammon.com.au/mushclient/plugins/Aardwolf/Create_World_File.xml (2 Kb)
http://www.gammon.com.au/mushclient/plugins/Aardwolf/telnet_options.lua (2 Kb)
http://www.gammon.com.au/mushclient/plugins/Aardwolf/Aardwolf_Spellups.xml (44 Kb)




Now, to automatically load all that stuff into MUSHclient download this file:

http://www.gammon.com.au/mushclient/plugins/Plugin_Installer.xml

Put it into this directory:


C:\Program Files\MUSHclient\worlds\plugins\


Start MUSHclient up, go to the File menu -> Plugins, and install Plugin_Installer.xml as a plugin. When you have done that, a couple of seconds later it should install all the other plugins if you put them in the right place.




#5
Using aardwolfs custom made client I get this error after following the mentioned procedure. When I downloaded all the required files it said i all ready had them so didn't bother to download them. Thought it does work just get the below run-time error when loading the plugin.

Laviunt.

Run-time error
Plugin: xCreate_World_File (called from world: Aardwolf)
Function/Sub: CreateWorldFile called by Plugin xCreate_World_File
Reason: Executing plugin xCreate_World_File sub CreateWorldFile
C:\Programs\MUSHclient\lua\getworld.lua:30: Function 'io.open' disabled in Lua sandbox - see MUSHclient global preferences
stack traceback:
[C]: in function 'error'
[string "Sandbox"]:39: in function 'open'
C:\Programs\MUSHclient\lua\getworld.lua:30: in function 'make_world'
[string "Plugin"]:35: in function <[string "Plugin"]:6>

Australia Forum Administrator #6
The simplest way to fix that is to go to the Lua sandbox and change the first 3 lines.

In MUSHclient, go to File menu -> Global Preferences, click on the Lua tab, and make sure the first 3 lines read:


trust_all_worlds = true -- change to true to trust all the worlds
trust_all_plugins = true-- change to true to trust all the plugins
warn_if_not_trusted = false -- change to true to show warnings


Slightly safer is not to trust all plugins but instead add one line further down:


 -- Plugin IDs of plugins we trust - add your plugins to the table

  local trusted_plugins = {
     [""] = "",            -- trust main script (ie. if no plugin running)
     ["03ca99c4e98d2a3e6d655c7d"] = "Chat",  
     ["982581e59ab42844527eec80"] = "Random_Socials", 
     ["4a267cd69ba59b5ecefe42d8"] = "Installer_sumcheck",  
     ["83beba4e37b3d0e7f63cedbc"] = "Reconnecter",   
     ["35dfdbf3afc8cbf60c91277c"] = "xCreate_World_File",  --> add this line
     }  -- end of trusted_plugins 


#7
just wanted to report a bug with this plugin. i couldn't find any better place to do this but if they're is then please tell me...

the bug is that the spellup plugin recognizes attack spells as spellup spells, even when they're not on the spellup list.
like say, i fail to cast ego whip 10 times. it gives me the message:

Failed to cast 'Ego whip' 10 times. Removing from spellup list.

Didn't know if anyone reported this yet, but if not here it is.
Australia Forum Administrator #8
It shouldn't be casting "ego whip" because that is not marked as a spellup.

Inside the state file (RH double-click the plugin in the plugin list), I see:


[115] = {
    name = "ego whip",
    target = 1,
    spellup = false,
    percent = 0,
    recovery = -1,
    },


Compare to "shield":


 [72] = {
    name = "shield",
    skilltype = 1,
    target = 2,
    spellup = true,
    percent = 100,
    recovery = -1,
    },


Which has "spellup = true" in it.

Can you check your state file for me to see if "ego whip" looks like it does for me? Also where did you get the spellup plugin from? The link mentioned on this page, or from Aardwolf site?
#9
I found two bugs here.
when using skills that is actually buffs

clanskills and hide, sneak or shadow form
it's listed as debuff.

and I also get error messages when I fail spells like remove curse more then 10 times.

got the spellup from this website. as well.

Laviunt.
#10
Here's what it looks like for me:

[115] = {
name = "ego whip",
recovery = -1,
target = 1,
skilltype = 1,
percent = 77,
spellup = false,
},

I got the spellup here at your site, not Aardwolf's site.

This has also happened with Psychic drain:

[131] = {
name = "psychic drain",
recovery = -1,
target = 1,
skilltype = 1,
percent = 81,
spellup = false,
},

I don't know much about coding or scripts, so I hope I've posted the information you need. If not, I'll post whatever else you might need. Thanks Mr. Gammon. :)
Australia Forum Administrator #11
OK I see what you mean now. :)

If you want to fix it quickly, edit the spellup plugin with any text editor (like notepad), and near the bottom find these lines:


  -- REGULAR FAIL
  if reason == 1 then --  Regular fail - recast
     failed_attempt_count [sn] = (failed_attempt_count [sn] or 0) + 1
     if failed_attempt_count [sn] > MAX_RETRIES then
       ColourNote ("red", "", "Failed to cast '" .. capitalize (spells [sn].name) .. 
                   "' "  .. MAX_RETRIES .. " times. Removing from spellup list.")
       remove_spellup (sn)
     end -- if


Change them to:


 -- REGULAR FAIL
  if reason == 1 then --  Regular fail - recast
     failed_attempt_count [sn] = (failed_attempt_count [sn] or 0) + 1
     if failed_attempt_count [sn] > MAX_RETRIES then
       if remove_spellup (sn) then
         ColourNote ("red", "", "Failed to cast '" .. capitalize (spells [sn].name) .. 
                     "' "  .. MAX_RETRIES .. " times. Removing from spellup list.")
       end -- if we had it in the first place
     end -- if


That basically suppresses the message if it isn't in the list.
#12
Thanks Mr. Gammon, I'm glad there was a way to fix it. This is a really awesome plugin. The best spellup plugin I've found so far. :)
Australia Forum Administrator #13
Quote:

clanskills and hide, sneak or shadow form
it's listed as debuff.


Let me check with Lasher on that one.
Australia Forum Administrator #14
It also works a bit faster, if near the end you change it to read:


   if stats.position_str == "standing" and    -- need to be standing
       playing and           -- and playing
       not AFK and           -- not AFK
       not low_mana and      -- not recently out of mana
       not low_moves and     -- not recently out of moves
       reason ~= "recoveryon" and  -- recovery on is usually followed by {affon}
       have_slist and        -- have received list of spells
       not paused and        -- they haven't paused us
       (reason == "affecton" or reason == "fast" or last_cast_time ~= os.time ()) then  -- only once a second, or we thrash
      try_to_buff_us (reason)    
    end -- OK to cast


Add the extra bit in bold: reason == "affecton" or


#15
I just tried to get the spellup plugin to work but received an entire chunk of errors. Wondering if anyone has any hints of enlightenment.

In my main window:

Run-time error
Plugin: Aardwolf_Spellups (called from world: aardwolf)
Immediate execution
[string "Plugin"]:22: attempt to index global 'os' (a nil value)
stack traceback:
[string "Plugin"]:22: in main chunk
Error context in script:
18 : stats = { position = "0", mana = "0", moves = "0" } -- table will be replaced by Stats_Detector plugin
19 :
20 : fighting = false
21 : playing = false
22*: last_buff = os.time ()
23 :
24 : -- the next 3 items are saved to the plugin state file
25 :
26 : -- known spells and recoveroes indexed by number

In a note opened up as a window of mushclient:

Line 1673: Error parsing script (problem in this file)

Really not very good with this kinda stuff...
Australia Forum Administrator #16
Sounds like the Lua sandbox in the global preferences is an old version, when I initially disallowed all the "os" functions (because some of them can be used to delete files).

A quick fix is to go to File -> Global Preferences -> Lua, and disable the sandbox by replacing everything there with:



-- sandbox disabled


Note the two hyphens - they are needed as a Lua comment. Also if you leave it completely empty MUSHclient replaces it with the default sandbox next time it starts up.

More secure would be to delete the entire sandbox. Save and close it, and exit MUSHclient. Then restart MUSHclient and the newer default sandbox will be loaded. Then follow the instructions earlier in this page to allow specific plugins.
#17
i was just wondering.. is there any way to make this plugin start minimized when i load mushclient? i can't figure how to do it.
Australia Forum Administrator #18
In the plugin, at around line 199, inside the OnPluginEnable function, find this line:


    w:SetWorldWindowStatus (3) -- restore it  


Change it to:


    w:SetWorldWindowStatus (2) -- minimize it  

#19
Thank you Nick! That worked like a charm. =D
#20
Is the spellup link broken?
it shows for me as

XML Parsing Error: not well-formed
Location: http://www.gammon.com.au/mushclient/plugins/Aardwolf/Aardwolf_Spellups.xml
Line Number 1200, Column 30: match="^spellups?\:?\s*((?<action>\+|\-)\s*)?(?<list>[A-Za-z0-9, ]+)?$"
Australia Forum Administrator #21
You should RH-mouse click and "save linked file as" rather than letting your web browser try to interpret the XML. The plugin should load OK into MUSHclient.
#22
I am unable to get the spellup plugin to work properly. I had a number of initial errors and messages. I've corrected them from the posts in this thread, or by searching the forums. At this point, I have the blank spellup window running, but all of the plugin input(?) shows up in the main window.

so, I type "spellup armor"

and get, "Requested(1): Armor", in the main window. Spellup window does nothing. The spell is not cast. Thank you very much for the assisstance.
#23
Some clarifications:

Apparently all of commands are supposed to be reflected in the main window. The problem I continue to have is that no spells are actually cast and the spellup window remains blank.
Australia Forum Administrator #24
Hmm, it is a while since I worked on this, but try this:

In the file Aardwolf_Spellups.xml at around line 1030, change:


function show_wanted (w)

 w = w or GetWorldById (GetWorldID ())


to:


function show_wanted (w)

  local w = get_a_world (affect_world, folder)
  if not w then
    return
  end


Can you please let me know if this works?


#25
Thank you for the response. I can report progress. The requested output now shows up in the spellup output world/screen. Still no actual casting of the spell(s) and it doesn't seem to recognize or display my current "affects." Maybe I'm doing something really silly; this is the first time I've tried to use plugins. I don't want to waste your time with this...
Australia Forum Administrator #26
I wouldn't say you have done anything silly. The installation instructions are admittedly somewhat complex.

Check page 1 of this thread, and see that all the other required plugins are installed and enabled. Sounds like it isn't recognizing your current spells or status.
#27
Is there a more stable version of this plugin?
I seem to have issues with the "pause output", "wrap output" of it and the scroll bar.

What happens is if I scroll up to the top of my list, it will automatically put me back at the bottom or vice-versa.
That is, of course, when the scrolling will work. Sometimes it won't even work and it'll just highlight the information while I'm on the path of the scroll bar.
Australia Forum Administrator #28
It isn't really designed to scroll. The window is refreshed every second so scrolling is not very meaningful. I suggest you resize it so that it doesn't need to scroll.
#29
I find that the spellup plugin works well in general, but if I have to cast a lot of spellups sometimes casts each spell many times, even after they have succeeded.

Am I alone in this?
#30
Swalec:

Yes, the timer doesn't keep up with what has been attempted to cast. I have a modified spellup plugin at
http://code.google.com/p/bastmush/source/browse/trunk/worlds/plugins/Aardwolf/

It has a couple of additions, like being able to make a spell depend on another spell. So protection good will not be cast if inertial barrier is on. Also, you can temporarily disable a spell without taking it out of the list. You can use spellup skills like sneak, hide, heighten senses, nimble cunning, etc...

Also, you will need the modified AFK and Playing detector in the same directory. I modified those in some way I believe, but couldn't tell you what I did.

I will document those plugins eventually.

Eric
Australia Forum Administrator #31
Quote:

if I have to cast a lot of spellups sometimes casts each spell many times, even after they have succeeded.


There is a bit of a timing problem, because of the nature of client/server interaction. It casts a spell, and if it doesn't get confirmation quickly enough, it assumes it has failed and casts it again. Sometimes if the success message arrives slightly too late, then it can "thrash" and recast an unnecessary spell. If you want to do lots on yourself, try "spellup fast" which casts them without waiting for confirmation.
Australia Forum Administrator #32
I have archived those plugins (as at this date/time) here, in case that site becomes unavailable:

http://www.gammon.com.au/mushclient/plugins/Bast/
#33
Hi Nick,

If people want to use the miniwindow plugins of mine, they have been converted to use a class that I developed. Therefore, the files in the lua directory are also required.

I hope to have them documented this week, but didn't want Swalec to reinvent the wheel on the spellup plugin.

Thanks,
Eric
Australia Forum Administrator #34
OK I have uploaded them to a lua subdirectory inside the previous link.

For anyone wanting to use them, I presume you would need to put all the .lua files into the lua subdirectory under the MUSHclient executable.

Then the plugins would go into the world->plugins directory.
#35
Thanks for the updated version, Eric.

I can see how a timer would cause this; I'm guessing that the spellup plugin keeps it's list of independent of the mud? I'm guessing that there isn't an equivalent of a "effects" but with tags that you can call to sync the two.

Swalec
#36
Hmmm, well okay, so this doesn't cast at all. I've tried to add in the other versions of the plugins.

Looks like we have a serious version problem here, I think. WIll experiment more tomorrow.

Swalec
#37
I've written a little patch to your latest version, which I include below. Basically, it adds a tick timer to the spellups. Perhaps a little out of place, but the existing tick timer uses the status bar. This overwrites PotionQuaffer. And the spellup script already has a looping timer which works perfectly.

Just a thought.


diff Aardwolf_Spellups.xml.orig Aardwolf_Spellups.xml
875a876,886
> -- PWL ADDED
> local last_tick = 0
>
> function OnPluginTelnetOption (option)
> if option == string.char (101,1) then
> last_tick = os.time()
> SetStatus ("Time to tick: " .. (last_tick + 30) - os.time ())
> end -- if
> end -- function
> -- PWL END
>
897a909,919
> -- PWL -- tick added
> local ttt = (last_tick + 30) - os.time ()
> w:Note ( "" )
> w:Note ( "" )
> if( ttt > 10 ) then
> w:Note ( "Time to Tick: " .. ttt )
> else
> w:ColourNote ( "red", "", "Time to Tick: " .. ttt )
> end
> -- PWL END
>
#38
I have a problem with this plugin. I am using the custom Aardwolf MUSHclient from their download page. I have not added any plugins except for this spellup plugin. I get the spellup window, and it tracks my spells fine. if I am affected, it tells me what spell and how much longer i am affected. When i type spellup spell it says it is requested and that it is pending. I can do spellup all and i get like 6 requested, and 6 pending spells,

but it does not cast.

i am standing. i did a resume. did pause, resume. still does not cast. A nice gentleman in game helped me trouble shoot it. Thanks to Inicus. He had me remove my LUA sandbox and change it to -- sandbox disabled. upon doing so and exiting and entering the program i get a ton of errors. here are the errors:

Welcome to MUSHclient version 4.33!
Written by Nick Gammon.

For information and assistance about MUSHclient visit our forum at:
http://www.gammon.com.au/forum/


--- Connected on Thursday, February 12, 2009, 11:35 PM ---
--- Aardwolf Mushclient - setup already done ---
--- Type 'initaard' to automatically size windows ---
-----------------------------------------------------------------------------
What be thy name, adventurer?
radial
Existing profile loaded - please enter your password.
Password:
############# Reconnecting to Game #############
Refreshing affected / learned / spellup list.
You have no missed tells.
[370/370hp 439/439mn 698/698mv 0qt 637tnl] >
l
Invalid spellheaders line: 108,create sou
Run-time error
Plugin: Aardwolf_Spellups (called from world: Aardwolf)
Function/Sub: display_timer called by timer
Reason: processing timer "display_timer"
[string "Plugin"]:887: attempt to index field '?' (a nil value)
stack traceback:
[string "Plugin"]:887: in function 'show_wanted'
[string "Plugin"]:824: in function 'show_current_buffs'
[string "Plugin"]:1391: in function <[string "Plugin"]:1390>
Error context in script:
883 : w:ColourNote ("olive", "", "You have not requested any spellups.")
884 : else
885 : local buf_names = {}
886 : for _, sn in ipairs (wanted_buffs) do
887*: table.insert (buf_names, capitalize (spells [sn].name))
888 : end -- for
889 : w:ColourNote ("olive", "", "Requested (" .. #buf_names ..
890 : "): " .. table.concat (buf_names, ", "))
891 : end -- if
Invalid spellheaders line: nd,0,0,0,-1,1
Loaded information about 555 spells.
Loaded information about 25 recoveries.
[370/370hp 439/439mn 698/698mv 0qt 637tnl] >
On the outskirts of a battlefield
Quickly moving through the areas around the battlefield, you manage to
avoid most of the severe fighting. Though the sounds of battle are all
around you still, you are, at least for now, safe. [Exits: north east west]
A three-legged stool runs with great ease.
A bucket filled with who-knows-what floats after you.
[370/370hp 439/439mn 698/698mv 0qt 637tnl] >
Timer function "display_timer" not found or had a previous error.
Timer function "display_timer" not found or had a previous error.
Timer function "display_timer" not found or had a previous error.
Timer function "display_timer" not found or had a previous





And it just keeps doing the display timer error forever.
#39
Continued. when the default of the sandbox text is in there, i never see any errors. it's just that the plugin still does not cast. all other functions of the plugin seem to work.

here's the default sandbox text

trust_all_worlds = false -- change to true to trust all the worlds
trust_all_plugins = false -- change to true to trust all the plugins
warn_if_not_trusted = false -- change to true to show warnings

--[[

-- Lua initialization (sandbox) --> please read comments carefully.

-- Default initialization supplied with version 3.80.

Use this to create a "sandbox" for safe execution of non-trusted scripts.

If you only run your own scripts or plugins then you may not need this.

The code in this area is executed after each Lua script space is created
but before any of your scripts are done. This can be used to initialise things
(eg. load DLLs, load files, set up variables) or to disable things as shown below.

By setting a function name to nil you effectively make it unavailable.

You can remove some functions from a library rather than all of them, eg.

os.execute = nil -- no operating system calls
os.remove = nil -- no deleting files
os.rename = nil -- no renaming files

This script will automatically be replaced if you completely delete it from
the Global Preferences, and restart MUSHclient. To avoid this, leave a comment
in (if you don't want any further action taken).

--]]

-- Example sandbox --

function MakeSandbox ()

local function ReportDisabled (pkg, func)
return function ()
error (string.format (
"Function '%s.%s' disabled in Lua sandbox - see MUSHclient global preferences",
pkg, func), 2)
end -- function
end -- ReportDisabled

package.loadlib = ReportDisabled ("package", "loadlib") -- disable loadlib function
package.loaders [3] = nil -- disable DLL loader
package.loaders [4] = nil -- disable all-in-one loader

for k, v in pairs (io) do
if type (v) == "function" then
io [k] = ReportDisabled ("io", k)
end -- type is function
end -- for

local orig_os = os -- so we know names of disabled ones

-- replace 'os' table with one containing only safe functions
os = {
date = os.date,
time = os.time,
setlocale = os.setlocale,
clock = os.clock,
difftime = os.difftime,
}

for k, v in pairs (orig_os) do
if not os [k] and type (v) == "function" then
os [k] = ReportDisabled ("os", k)
end -- not still active
end -- for

if warn_if_not_trusted then
ColourNote ("yellow", "black",
"Lua sandbox created, some functions disabled.")
end -- if warn_if_not_trusted

end -- end of function MakeSandbox


-- default is to sandbox everything --

-- To trust individual worlds or plugins, add them to the lists below.

-- To find your current world ID, do this: /print (GetWorldID ())
-- Plugin IDs are mentioned near the start of every plugin.

-- You can limit the behaviour to specific worlds, or specific plugins
-- by doing something like this:

do

-- World IDs of worlds we trust - replace with your world IDs
-- (and remove comment from start of line)

local trusted_worlds = {
-- ["a4a1cc1801787ba88cd84f3a"] = true, -- example world A
-- ["cdc8552d1b251e449b874b9a"] = true, -- example world B
-- ["1ec5aac3265e472b97f0c103"] = true, -- example world C
} -- end of trusted_worlds

-- Plugin IDs of plugins we trust - add your plugins to the table

local trusted_plugins = {
[""] = "", -- trust main script (ie. if no plugin running)
["03ca99c4e98d2a3e6d655c7d"] = "Chat",
["982581e59ab42844527eec80"] = "Random_Socials",
["4a267cd69ba59b5ecefe42d8"] = "Installer_sumcheck",
["83beba4e37b3d0e7f63cedbc"] = "Reconnecter",
} -- end of trusted_plugins


-- check worlds
if not trust_all_worlds then
if not trusted_worlds [GetWorldID ()] then
if warn_if_not_trusted then
ColourNote ("yellow", "black", "Untrusted world " .. WorldName () ..
", ID: " .. GetWorldID ())
end -- if warn_if_not_trusted
MakeSandbox ()
end -- not trusted world or plugin
end -- not trusting all worlds

-- check plugins - check name *and* plugin ID
if not trust_all_plugins then
if trusted_plugins [GetPluginID ()] ~= GetPluginName () then
if warn_if_not_trusted then
ColourNote ("yellow", "black", "Untrusted plugin " .. GetPluginName () ..
", ID: " .. GetPluginID ())
end -- if warn_if_not_trusted
MakeSandbox ()
end -- not trusted world or plugin
end -- if not trusting all plugins

end -- local block

-- warn if we can't load DLLs (checkbox might be unchecked)
if not package.loadlib and warn_if_not_trusted then
local by_this_plugin = ""
if GetPluginID () ~= "" then
by_this_plugin = " by this plugin"
end -- this is a plugin
ColourNote ("yellow", "black",
"Loading of DLLs" .. by_this_plugin .. " is disabled.")
end -- if
Australia Forum Administrator #40
I'll try to reproduce your problem shortly, but first can I clarify something? You said:

Quote:

I am using the custom Aardwolf MUSHclient from their download page. I have not added any plugins except for this spellup plugin.


On page 1 of this thread are detailed five files in addition to the spellups plugin itself, that need to be installed, as they are "helper" files that help it to work.

Did you install all these files, in the directories described on the first page of the thread?
#41
Yes, I followed the instructions in the first page. I even tried the link you posted here on page 3 with an updated version of the spellup file as well.

I would assume that if i did not do the correct files in the correct places this plugin wouldnt work as much as it is working. everything seems to be functioning correctly, it just does not cast any spells for me. they are all stuck in pending.

Please pm me with your contact info and i can zip up my directory and send it to look at if you'd like.
Amended on Fri 13 Feb 2009 01:22 PM by radialmonster
#42
If you are using the one from this page:

http://code.google.com/p/bastmush/wiki/Aardwolf_Spellups

There are some troubleshooting tips at the bottom of the page, along with an installation guide.

#43
Thanks, I will check this out when I can later. I have not tried any of the files from that google.com directory yet. Maybe part of the issue is there is a bunch of files here on page 1, then on another page theres a link to some newer files, then theres another elsewhere etc and some one else writes an update etc. Perhaps a modified first post that always has the most up to date version would be most helpful.

Edit

I want to report that I have uninstalled mushclient and reinstalled using the aardwolf client. i then also installed the spellups using the link here from http://code.google.com/p/bastmush/wiki/Aardwolf_Spellups with all of it's sub plugins.

The plugin appears to be working just fine! I will do this same thing on my home computer (yes Im at work;) ) that i was having the issue with maybe tomorrow and will report back.
Amended on Fri 13 Feb 2009 03:43 PM by radialmonster
#44
Endavis, your spellup script needs work.
#1. Right-Clicking and saving as isn't the best way to install the files. Loading them up and copying and pasting them into a notepad file works the best.

#2. It doesn't work. At least not on a reliable basis. A by reliable basis, I mean more than once. Currently, I'm logged into the realm of Aardwolf. Plugins installed correctly and properly into the right locations with no spellups on me. Spellup plugin is doing nothing at all.
Australia Forum Administrator #45
OK, we need to get to the bottom of this. We now have a couple of reports of the spellups plugin "doing nothing".

My original spellup plugin worked fine when I last used it. Admittedly that was a little while ago as I have been doing other things. First thing I would check is that timers are enabled in your main world, as timers are what are used to keep the main loop "ticking".

Next we need to establish how far it has got. On page 1 of this thread it shows how, after you ask for spellups, you briefly see something like:


Pending (2): Armor, Bless
Position: Standing


Do you in fact see a list of pending spellups like this? If not, then certainly it won't try to cast them. Remember you need to tell it which spellups you want, for example by typing:


spellup all


Next question is, if you manually spellup yourself, does the plugin detect it?

For example, if you just type:


cast 'detect magic'


Then the spellup window should then show something like:


Spellups affecting you (1):

Detect magic      7m


Does that happen?


#46
The issue I was having, yes, the spells were shown in both requested and pending.

If i manually cast a spell, spellups would recognize it and begin to count down the time remaining correctly.

I have since though fixed the issue by uninstalling aardwolf client and reinstalling and installing the plugin files using the directions from here: http://code.google.com/p/bastmush/wiki/Aardwolf_Spellups.

#47
I've replicated both of these bugs. The display.timer errors often happens on load. I *think* the problem is a race condition; perhaps, if the timer runs before the plugin state is serialized? Quite likely to happen in my case, because one of my plugins has a very large state file which is slow to deserialize.

For the second issue -- no spells being cast -- I've also replicate the work around, which is to manually cast a spell. I think it's the same problem as with the repeated spell cast; the plugin doesn't know exactly what has happened on the server side. Having the plugin resync by parsing saffect would be my solution...

BTW, I think we have a version problem now. Endavis' version of the plugin has one really nice enhancement (for me!) -- it works for skills also. Would it be possible to get spellup onto a VCS somewhere; it would be a pity if we ended up with a fork.

Thanks for the effort!


Swalec
Australia Forum Administrator #48
Serialization is atomic - nothing will happen until the plugin initialization finishes.

If you are keen, you could modify the plugin to use SQLite instead of serialization. It would take a bit of work, but that would eliminate the loading delay, and the saving delay when the spells need to be written out again. See this thread for a discussion of the general idea, and how I changed the spell checker plugin to use SQLite:

http://www.gammon.com.au/forum/?id=9241

Also multiple worlds could then share the spells information, which would mean that they don't need to be downloaded each time you make a new character.
#49
I know this is an old thread, but it made more sense to bump this than to start a new one.

I've been using this plugin for a while and really like it, but it has a number of problems. Would it be possible to get these addressed? I'm willing to pay a small fee for Mr. Gammon's time to do so.

The main problems I am currently aware of:

1. It gives the "too many failures, removed from spellups list" error when you lose concentration on spells that aren't in the spellups list.

2. The script seems to get confused when you are moving or fighting and there are spellups pending, causing it to generate many duplicate spellup commands, leading to a massive lag and waste of mana.

Thanks!
Australia Forum Administrator #50
The information provided on this forum is free of charge. :)

It's been a while since I worked on this, and thus a partial problem is that the Aardwolf spellup situation may have changed. I believe in fact that spellups are now integrated into the server-side code, but am not certain of this.

I also believe that Fiendish, and possibly others, are working on, or have worked on, improved spell-up plugins. It may well be worth asking on the Tech channel if there are more modern plugins available, or whether indeed the latest "Aardwolf Client" (which is really MUSHclient packaged up with various nifty plugins and configurations) addresses the problems you raised.

If you don't have any luck, perhaps post a more detailed example of the sorts of things you are talking about.
#51
Hi Nick,

Thanks for the reply.

I've tried to ask on the game and have been pointed to at least one variant but it doesn't work properly.

The two issues with the script are as follows.

The most important is that it seems to send the same cast command multiple times, getting confused sometimes if the spell doesn't cast the first time. It ends up taking 2, 3 or more times as many casts to get rebuffed as it should. I can paste a sample output if that would help.

The secondary issue is that it seems to count and report failures to cast spells and then "take them off the list" even if they never were on it... this includes spells that aren't buffs at all.
USA Global Moderator #52
I believe that Bast is working on a brand new spellup plugin to replace the currently available gmcp modified miniwindowed plugin that was based on the old one Nick wrote. I don't know what the status of this new one is at present. I've been away for a few weeks.
Amended on Tue 18 Jan 2011 02:44 AM by Fiendish
#53
I am working on a new one. I have finished 75% of the feature set I would like to see in it. I am currently working on a spellup other solution and hunting a couple of bugs down. 2 weeks at the latest I hope.

If you know how to use subversion, you can checkout trunk/Bast at bastmush.googlecode.com and give it a whirl.

Bast