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
➜ Lua
➜ MUSHclient Buff Indicator Plugin
MUSHclient Buff Indicator Plugin
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Jarvis
(6 posts) Bio
|
Date
| Tue 28 Jun 2011 05:06 PM (UTC) |
Message
| Hello all!
I'm entirely new at scripting in Lua but have a little experience programming in other, completely different languages.
I'm trying to write a plugin for MUSHclient that will display whether specific buffs are up or not in a Miniwindow.
Example: When I cast haste upon myself I get the message "You get a hurried look." This should trigger the font/indicator colour to change to green.
When the buff times out or is dispelled, I get the message "The world speeds up around you." This should change the font/indicator to red.
I'm pretty sure I can define triggers and use them to call functions. Properly formatting, displaying text or an indicator and changing their colour in a miniwindow; however, is beyond my ability.
Can anyone help me?
Thank you!
Jarvis | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #1 on Tue 28 Jun 2011 09:21 PM (UTC) |
Message
|
Using the module described there you can simply have gauges, text etc. in a miniwindow.
This describes the basics of setting up a miniwindow:
http://www.gammon.com.au/mushclient/mw_creation.htm
Put those two together and the rest should be a cinch! |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Jarvis
(6 posts) Bio
|
Date
| Reply #2 on Tue 28 Jun 2011 11:24 PM (UTC) |
Message
| Awesome!
Thanks so much.
Jarvis | Top |
|
Posted by
| Jarvis
(6 posts) Bio
|
Date
| Reply #3 on Wed 29 Jun 2011 04:16 AM (UTC) |
Message
| Well,
Drawing pretty miniwindows now no problem! Now my problem is the opposite.
Is there a tutorial or guide around here that can help me with variables and sending values through triggers?
I want to change my variable called "armor" to darkgreen or darkred, triggered by the respective buff gained/lost messages. I've tried manually putting the line armor="darkgreen" within the trigger and having the trigger send to the variable armor with no success.
Though, I may have just solved my problem by typing this message. If it works, I'll repost in a little while.
Thanks!
Jarvis | Top |
|
Posted by
| Jarvis
(6 posts) Bio
|
Date
| Reply #4 on Wed 29 Jun 2011 06:08 AM (UTC) |
Message
| Well, I feel like I'm beating my head against a brick wall.
I simply do not know how to retrieve information in a trigger for use in the script. Or maybe my triggers just aren't working, but I've used test trigger and typed in the exact trigger with no results.
Or I just don't know how to properly define variables in Lua.
Not giving up yet!
Jarvis | Top |
|
Posted by
| Jarvis
(6 posts) Bio
|
Date
| Reply #5 on Wed 29 Jun 2011 06:48 AM (UTC) |
Message
| It works! I am a genius. Or at least those the wrote the code I based most of this on are geniuses.
Here it is if anyone's curious:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Wednesday, June 29, 2011, 1:12 PM -->
<!-- MuClient version 4.73 -->
<!-- Plugin "Buff_Indicator" generated by Plugin Wizard -->
<muclient>
<plugin
name="Buff_Indicator"
author="Jarvis"
id="f2c3153a7cc946c2a56ffe2f"
language="Lua"
purpose="To show nice pretty lights for buffs."
date_written="2011-06-29 13:09:25"
requires="4.73"
version="1.0"
>
</plugin>
<!-- Get our standard constants -->
<include name="constants.lua"/>
<!-- Triggers -->
<triggers>
<trigger
enabled="y"
match="You feel less protected."
regexp="n"
script="no_armor"
sequence="100"
>
</trigger>
<trigger
enabled="y"
match="The glow sinks into your skin!"
regexp="n"
script="yes_armor"
sequence="100"
>
</trigger>
<trigger
enabled="y"
match="You feel less righteous."
regexp="n"
script="no_bless"
sequence="100"
>
</trigger>
<trigger
enabled="y"
match="You feel righteous."
regexp="n"
script="yes_bless"
sequence="100"
>
</trigger>
</triggers>
<!-- Script -->
<script>
<![CDATA[
require "InfoBox"
box = InfoBox:New("ARMOR")
buffs = box:AddBar("Buffs")
box.Bars[1].captionPlacement = 4
box:CaptionPlacement()
box:Update()
function no_armor ()
buffs = box:AddBar("Armor", 100, "darkred")
box.Bars[1].captionPlacement = 4
box:CaptionPlacement()
box:Update()
end
function yes_armor ()
buffs = box:AddBar("Armor", 100, "darkgreen")
box.Bars[1].captionPlacement = 4
box:CaptionPlacement()
box:Update()
end
function no_bless ()
buffs = box:AddBar("Bless", 100, "darkred")
box.Bars[1].captionPlacement = 4
box:CaptionPlacement()
box:Update()
end
function yes_bless ()
buffs = box:AddBar("Bless", 100, "darkgreen")
box.Bars[1].captionPlacement = 4
box:CaptionPlacement()
box:Update()
end
]]>
</script>
</muclient>
I've only put in armor and bless... Only 13 more buffs to add.. | Top |
|
Posted by
| Jarvis
(6 posts) Bio
|
Date
| Reply #6 on Wed 29 Jun 2011 10:38 AM (UTC) |
Message
| It's finished and quite a bit different than the example above, which adds a new bar every time a buff is gained or lost... I fixed that and made the functions much shorter by creating the bars in the script and then using the functions to remove and insert the new colored bar.
Unfortunately, if I lose or gain a bunch of buffs at the same time, the miniwindow goes blank. Presumably because so many triggers are being activated at once? It will return if one of the triggers activates and Updates the window again. I tried adding code that when I typed affect to see which buffs are active, it would update the list, but it often proved too much for it to handle without blanking on me... The code could probably be optimized a lot..
Thanks again!
Jarvis | 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.
17,511 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top