Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Plugins ➜ Gauges and Compass for Achaea

Gauges and Compass for Achaea

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1 2  

Posted by Fadedparadox   USA  (91 posts)  Bio
Date Mon 25 Aug 2008 02:32 AM (UTC)

Amended on Sun 07 Jun 2009 08:06 PM (UTC) by Fadedparadox

Message
Three plugins for Achaea.

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.

http://sites.google.com/site/trevizemoonflair/mushclient/atcp

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.

http://sites.google.com/site/trevizemoonflair/mushclient/ngauges

And third, a compass. Same as above, uses images from Nexus and is a .zip that needs to be unzipped into the plugin directory.

http://sites.google.com/site/trevizemoonflair/mushclient/ncompass

If you use any of them, you'll want to move the text to the right. This is the script in Lua to do that:

TextRectangle (150, 0, 0, 0, 0, 0x000000, 0, 0x000000, 0)

Enjoy!

(edited to update urls)
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #1 on Mon 25 Aug 2008 10:03 AM (UTC)
Message
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.
Top

Posted by Fadedparadox   USA  (91 posts)  Bio
Date Reply #2 on Mon 25 Aug 2008 10:17 AM (UTC)

Amended on Wed 10 Jun 2009 01:03 PM (UTC) by Fadedparadox

Message
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:

http://sites.google.com/site/trevizemoonflair/screenshots/MUSHclient_compass_gauges.png
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #3 on Mon 25 Aug 2008 10:41 AM (UTC)
Message
You've basically done what I have done too and am still working on. Nice. =)
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #4 on Mon 25 Aug 2008 10:09 PM (UTC)

Amended on Tue 26 Aug 2008 12:24 AM (UTC) by Nick Gammon

Message
That looks fantastic! It shows what the miniwindows can do.

Maybe make the textrectangle background colour closer to the background colour of the gauges, but that is just personal preference.

For example:


TextRectangle (150, 0, 0, 0, 0, 0x000000, 0, 0x3F484E, 0)



- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Scarn   (47 posts)  Bio
Date Reply #5 on Thu 28 Aug 2008 08:06 PM (UTC)
Message
Hey....

stats = {
health = 100, maxhealth = 130,
mana = 100, maxmana = 100,
endurance = 100, maxendurance = 100,
willpower = 100, maxwillpower = 100,
exp = 0, maxexp = 100,

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
}



gauges = {
name = GetWorldID () .. "1",

position = {5, 20, 35, 50, 65},

create = function (txt, num, col, pos)
WindowRectOp (gauges.name, 1,
26, gauges.position[pos]-1, 127, gauges.position[pos]+1,
ColourNameToRGB ("silver"))
WindowRectOp (gauges.name, 2,
27, gauges.position[pos], 127, gauges.position[pos]+10,
0x010101)
WindowRectOp (gauges.name, 2,
27, gauges.position[pos], 127-(100-num), gauges.position[pos]+10,
ColourNameToRGB (col))
local txtwidth = WindowTextWidth (gauges.name, "font", txt)
WindowRectOp (gauges.name, 2,
25-(txtwidth), gauges.position[pos], 25, gauges.position[pos]+10,
0x010101)
WindowText (gauges.name, "font", txt,
25-(txtwidth), gauges.position[pos], 0, gauges.position[pos]+10,
ColourNameToRGB ("silver"), false)
end, -- func

draw = function ()
gauges.create ("H:", stats.percent ("health"), "red", 1)
gauges.create ("M:", stats.percent ("mana"), "blue", 2)
gauges.create ("E:", stats.percent ("endurance"), "gold", 3)
gauges.create ("W:", stats.percent ("willpower"), "purple", 4)
gauges.create ("XP:", stats.percent ("exp"), "gray", 5)
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.
Top

Posted by Fadedparadox   USA  (91 posts)  Bio
Date Reply #6 on Fri 29 Aug 2008 07:14 AM (UTC)

Amended on Fri 29 Aug 2008 07:18 AM (UTC) by Fadedparadox

Message
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.
Top

Posted by Scarn   (47 posts)  Bio
Date Reply #7 on Fri 29 Aug 2008 08:10 AM (UTC)
Message
Error number: 0
Event: Run-time error
Description: [string "Plugin"]:7: attempt to perform arithmetic on a nil value

stack traceback:

[string "Plugin"]:7: in function 'percent'

[string "Plugin"]:41: in function 'draw'

[string "Plugin"]:51: in main chunk
Called by: Immediate execution


Here is the plugin, im royally confused now.

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

<muclient>
<plugin
name="Gauges"
author="Trevize"
id="0860ccb8e0e747814da4d907"
language="Lua"
purpose="gauges"
date_written="2008-08-18"
requires="4.35"
version="1.01"
>
</plugin>

<script><![CDATA[

TextRectangle (300, 0, 0, 0, 0, 0x000000, 0, 0x000000, 0)



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
}




gauges = {
name = GetWorldID () .. "1",

position = {5, 20, 35, 50, 65},

create = function (txt, num, col, pos)
WindowRectOp (gauges.name, 1,
26, gauges.position[pos]-1, 127, gauges.position[pos]+1,
ColourNameToRGB ("silver"))
WindowRectOp (gauges.name, 2,
27, gauges.position[pos], 127, gauges.position[pos]+10,
0x010101)
WindowRectOp (gauges.name, 2,
27, gauges.position[pos], 127-(100-num), gauges.position[pos]+10,
ColourNameToRGB (col))
local txtwidth = WindowTextWidth (gauges.name, "font", txt)
WindowRectOp (gauges.name, 2,
25-(txtwidth), gauges.position[pos], 25, gauges.position[pos]+10,
0x010101)
WindowText (gauges.name, "font", txt,
25-(txtwidth), gauges.position[pos], 0, gauges.position[pos]+10,
ColourNameToRGB ("silver"), false)
end, -- func

draw = function ()
gauges.create ("H:", stats.percent ("health"), "red", 1)
end, -- func
}

WindowCreate (gauges.name, 0, 0, 133, 80, 10, 4, ColourNameToRGB ("black"))
WindowFont (gauges.name, "font", "Lucida Console", 8, false, false, false, false)
gauges.draw ()
WindowShow (gauges.name, true)



]]></script>

</muclient>

Top

Posted by Fadedparadox   USA  (91 posts)  Bio
Date Reply #8 on Fri 29 Aug 2008 09:38 PM (UTC)
Message
You changed it. Put the script in exactly how I posted.
Top

Posted by Artrack   (8 posts)  Bio
Date Reply #9 on Thu 04 Sep 2008 05:30 AM (UTC)
Message
Ok so I'm a total noob, to muds and to MUSHclient. I've just downloaded it today and would like to know how to install/use these plugins.

I've downloaded those files, saved them as XML's and moved them to the plugin directory.

While in MUSHclient used "File->Plugins->Add" but I get errors as soon as they are loaded.

I think that I'm somehow downloading them wrong because the files I get don't look like XML files.

Any help will be appreciated, thanks!
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #10 on Thu 04 Sep 2008 10:55 AM (UTC)
Message
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. :)
Top

Posted by Artrack   (8 posts)  Bio
Date Reply #11 on Fri 05 Sep 2008 03:21 AM (UTC)
Message
Ok, the problem wasn't the zip folders, it was the xml files. The first two files in the list.

How am I supposed to get the first two files to work?
Top

Posted by Artrack   (8 posts)  Bio
Date Reply #12 on Fri 05 Sep 2008 04:49 AM (UTC)
Message
nevermind, it was my browser that wouldn't let me get the files in the right format
Top

Posted by Speedy999   (4 posts)  Bio
Date Reply #13 on Fri 05 Jun 2009 01:00 PM (UTC)

Amended on Fri 05 Jun 2009 01:01 PM (UTC) by Speedy999

Message
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,

Thanks in advance.

Regards

Speedy999
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #14 on Sat 06 Jun 2009 10:23 PM (UTC)
Message
Is that copied and pasted, or retyped? I didn't write that plugin, but I am not familiar with the tpairs function used near the top of your message.

Also, this looks strange:

85*: local right = compass.location[dir][1] + compass.dimension[dir][1]

It seems to be adding something to itself. Something which, according to the error, is nil (that is, the value does not exist).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


74,389 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.