First, an ATCP plugin that gets the data for the rest. After you add it, you have to log off and back on Achaea, if you're currently connected, to activate it.
Second, another gauges plugin, this one uses the images from Nexus, Achaea's web client (with their permission). It's a zip file with bitmaps, unzip it to your normal plugin directory.
It seems I'm not the only one who wrote an ATCP framework for gauges and compasses to trigger off. Happen to have a screenshot? Mine has the basic stuff working, except that I'm still adding features to it.
I used the bitmaps from Nexus, Dusty modified them to work well. Also, the ATCP plugin is mostly borrowed from Keldar, with his permission. I just stripped everything but the basics from it and made it broadcast to any other plugin that wants to listen.
Here's a screenshot of the compass and bars at work:
percent = function (stat)
local x = math.floor (stats[stat]/stats["max" .. stat]*100)
if x > 100 then x = 100 elseif x < 0 then x = 0 end
return x
end, -- func
}
Is there any way I can turn "health", "mana" etc into firing off a variable, rather than the ATCP plugin? I've tried a few variants (GetVariable ("Health") Can'get get anywhere though. Thanks, Scarn.
Get rid of the OnPluginBroadcast function and replace the stats table with:
stats = {
percent = function (stat)
local x = math.floor (tonumber (GetPluginVariable ("", stat))/tonumber (GetPluginVariable ("", "max" .. stat))*100)
if x > 100 then x = 100 elseif x < 0 then x = 0 end
return x
end, -- func
}
Just make sure you have each stat and max stat as a variable in the World, by the same names as used in the table.
stats = {
percent = function (health)
local x = math.floor (tonumber (GetPluginVariable ("Health", health))/tonumber (GetPluginVariable ("", "max" .. health))*100)
if x > 100 then x = 100 elseif x < 0 then x = 0 end
return x
end, -- func
}
You need to extract the file first, using a program like WinRAR or 7-zip. Merely renaming the compressed files does not make it possible for MUSHclient to read the plugin. :)
I am having some trouble with installing this plugin. The NCompass and Ngauges are not working for some reason. I got the following error message when I try to install the Compass plugin.
Run-time error
Plugin: Compass (called from world: Achaea)
Function/Sub: OnPluginBroadcast called by Plugin Compass
Reason: Executing plugin Compass sub OnPluginBroadcast
[string "Plugin"]:85: attempt to perform arithmetic on field '?' (a nil value)
stack traceback:
[string "Plugin"]:85: in function 'create'
[string "Plugin"]:99: in function 'draw'
[string "Plugin"]:28: in function <[string "Plugin"]:25>
Error context in script:
81 : for dir in tpairs (compass.active) do
82 : if compass.directions[dir] then
83 : local left = compass.location[dir][1]
84 : local top = compass.location[dir][2]
85*: local right = compass.location[dir][1] + compass.dimension[dir][1]
86 : local bottom = compass.location[dir][2] + compass.dimension[dir][2]
87 : WindowDrawImage (compass.name, dir,
88 : left, top, right, bottom, 1)
89 : WindowAddHotspot (compass.name, dir,
They get it upon installation. The compass files linked in the original post are the ones they're using. I'm completely unable to duplicate this error.
What you said in your post, Nick: "85*: local right = compass.location[dir][1] + compass.dimension[dir][1]" about that looking strange, basically I have a table, compass.location, that has the starting point (upper left) of each arrow. I also have compass.dimension defined at the bottom of the plugin, when it's created, to be the dimensions of each arrow. The line makes the right property of the image the left side plus the width.
The origin of the error is the OnPluginBroadcast function. It calls draw which calls create, which is where the error seems to be. It sees compass.location[dir][1] or compass.dimension[dir][1] as nil. Both should be set, and at least when I use it, are. The only thing I could think of is when they're set, it uses the image width/height but even when I don't have the images where the plugin expects, it doesn't error out.
I can't seem to duplicate this error, no matter how hard I try. Any ideas?
1. compass.location[dir][1] not existing
2. compass.dimension[dir][1] not existing
It gives an error with '?' in it. I am sure that both compass.location[dir] and compass.dimension[dir] exist, as I get a 'cannot index...' error if I delete either of them where they're made. Same with compass.location and compass.dimension. And I get an error with 'compass' in it if I delete compass entirely. I only get the '?' error if it's the key 1 that doesn't exist.
I still can't play with it to find which of the two, or the exact cause, though, since I can't make it happen as the plugin is now.
I apologize, I misread the earlier message, the add is not adding something to itself.
The only thing I can see would go wrong is this:
for dir in pairs (compass.directions) do
WindowLoadImage (compass.name, dir, plugindir .. [[compass/arrow_]] .. dir .. ".bmp")
compass.dimension[dir] = {}
compass.dimension[dir][1] = WindowImageInfo(compass.name, dir, 2)
compass.dimension[dir][2] = WindowImageInfo(compass.name, dir, 3)
end -- for
Now if the file compass/arrow_ne (for example) doesn't exist, then the WindowLoadImage will fail, and the WindowImageInfo will return nil, which would account for the later error.
I would check the return code from WindowLoadImage. Perhaps they didn't load the images where they were supposed to?
That worked, thanks Nick. You were right, they must not have the images in the right place.
I tried moving the images before then adding the plugin and it still worked. Guess I did something in the wrong order before, and somehow avoided the error.