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.
Entire forum
➜ MUSHclient
➜ Plugins
➜ need help with infobox
Posting of new messages is disabled at present.
Refresh page
Posted by
| Bakarus
(17 posts) Bio
|
Date
| Mon 01 Oct 2012 07:31 PM (UTC) |
Message
| This plugin is supposed to list buff spells you cast on yourself and hightlight them green if they are active and when they wear off the background turns darkred. With 1 spell this works fine, but having trouble doing it with more spells.
current code is here.
require "InfoBox"
box = InfoBox:New("ARMOR")
buffs = box:AddBar("Buff Tracker")
box.Bars[1].captionPlacement = 4
box:CaptionPlacement()
box:Update()
function yes_armor ()
if has_armor == true then
box:RemoveBar(2)
armor = box:AddBar("Armor", 100, "darkred")
box.Bars[2].captionPlacement = 4
box:CaptionPlacement()
has_armor = false
box:Update()
elseif has_armor == false then
box:RemoveBar(2)
armor = box:AddBar("Armor", 100, "darkgreen")
box.Bars[2].captionPlacement = 4
box:CaptionPlacement()
has_armor = true
box:Update()
else
armor = box:AddBar("Armor", 100, "darkgreen")
box.Bars[2].captionPlacement = 4
box:CaptionPlacement()
has_armor = true
box:Update()
end
end
function yes_ bless ()
if has_bless == true then
box:RemoveBar(3)
bless = box:AddBar("Bless", 100, "darkred")
box.Bars[3].captionPlacement = 4
box:CaptionPlacement()
has_bless = false
box:Update()
elseif has_bless == false then
box:RemoveBar(3)
bless = box:AddBar("Bless", 100, "darkgreen")
box.Bars[3].captionPlacement = 4
box:CaptionPlacement()
has_bless = true;
box:Update()
else
bless = box:AddBar("Bless", 100, "darkgreen")
box.Bars[3].captionPlacement = 4
box:CaptionPlacement()
has_bless = true
box:Update()
end
end
The armor code by itself works fine, I but when you cast bless it sometimes over writes armor and vice versa when you refresh the spells after they expire. any help is appreciated.
I think the main issue is in the array portion.
| Top |
|
Posted by
| Nick Gammon
Australia (23,122 posts) Bio
Forum Administrator |
Date
| Reply #1 on Mon 01 Oct 2012 09:10 PM (UTC) |
Message
| Can you copy and paste the actual code please? This won't compile:
(Extra space there). Plus indent your stuff, it's pretty unreadable like that, eg.
function yes_armor ()
if has_armor == true then
box:RemoveBar(2)
armor = box:AddBar("Armor", 100, "darkred")
box.Bars[2].captionPlacement = 4
box:CaptionPlacement()
has_armor = false
box:Update()
elseif has_armor == false then
box:RemoveBar(2)
armor = box:AddBar("Armor", 100, "darkgreen")
box.Bars[2].captionPlacement = 4
box:CaptionPlacement()
has_armor = true
box:Update()
else
armor = box:AddBar("Armor", 100, "darkgreen")
box.Bars[2].captionPlacement = 4
box:CaptionPlacement()
has_armor = true
box:Update()
end
end
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Bakarus
(17 posts) Bio
|
Date
| Reply #2 on Mon 01 Oct 2012 11:58 PM (UTC) Amended on Tue 02 Oct 2012 09:06 PM (UTC) by Bakarus
|
Message
| The actual code is the first post, not sure how the space got in there. Only other part is my triggers here.
<!-- triggers -->
<triggers
muclient_version="4.73"
world_file_version="15"
date_saved="2012-10-01 16:55:31"
>
<trigger
enabled="y"
group="buffs"
match="A faint outline of magical armor surrounds you."
script="yes_armor"
send_to="12"
sequence="100"
>
<send>SetVariable("has_armor", "true")
</send>
</trigger>
<trigger
enabled="y"
group="buffs"
match="You feel * power entering your body."
script="yes_bless"
send_to="12"
sequence="100"
>
<send>SetVariable("has_bless", "true")</send>
</trigger>
<trigger
enabled="y"
group="buffs"
match="You feel less protected."
script="yes_armor"
send_to="12"
sequence="100"
>
<send>SetVariable("has_armor", "false")</send>
</trigger>
<trigger
enabled="y"
group="buffs"
match="You feel less righteous."
script="yes_bless"
send_to="12"
sequence="100"
>
<send>SetVariable("has_bless", "false")</send>
</trigger>
</triggers>
and you have the script already. | Top |
|
Posted by
| Bakarus
(17 posts) Bio
|
Date
| Reply #3 on Wed 03 Oct 2012 01:06 AM (UTC) |
Message
| I'm not sure if there is anything else i can provide, i can submit some screen shots of how its going wrong it that would help. | Top |
|
Posted by
| Bakarus
(17 posts) Bio
|
Date
| Reply #4 on Wed 03 Oct 2012 01:28 AM (UTC) |
Message
| Maybe instead of removing and creating a new bar when a buff wears off, is there a way to simply change the backcolor of the bar when the buff wears off instead? | Top |
|
Posted by
| Nick Gammon
Australia (23,122 posts) Bio
Forum Administrator |
Date
| Reply #5 on Wed 03 Oct 2012 03:48 AM (UTC) |
Message
| See my reply above:
Quote:
Can you copy and paste the actual code please? This won't compile ...
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Bakarus
(17 posts) Bio
|
Date
| Reply #6 on Wed 03 Oct 2012 04:08 AM (UTC) |
Message
| This is the code, the triggers used are posted above. Its not a complete plugin yet, just a script and triggers, don't want to use the plugin wizard until its working.
require "InfoBox"
box = InfoBox:New("ARMOR")
buffs = box:AddBar("Buff Tracker")
box.Bars[1].captionPlacement = 4
box:CaptionPlacement()
box:Update()
function yes_armor ()
if has_armor == true then
armor.BackColor = "darkred"
has_armor = false
box:Update()
elseif has_armor == false then
armor = box:AddBar("Armor", 100, "darkgreen")
box.Bars[1].captionPlacement = 4
box:CaptionPlacement()
has_armor = true
box:Update()
end
end
-- bless
function yes_bless ()
if has_bless == true then
bless.BackColor = "darkred"
has_bless = false
box:Update()
elseif has_bless == false then
bless = box:AddBar("Bless", 100, "darkgreen")
box.Bars[1].captionPlacement = 4
box:CaptionPlacement()
has_bless = true;
box:Update()
end
end
| Top |
|
Posted by
| Nick Gammon
Australia (23,122 posts) Bio
Forum Administrator |
Date
| Reply #7 on Wed 03 Oct 2012 05:29 AM (UTC) |
Message
| I didn't write that plugin. Did you go through the tutorial that came with it?
As far as I can see if you want multiple bars (eg. for Armor and Bless) you need to do multiple box:AddBar.
What you have is just confusing, for me. Can't you just add the bars once (at the start)? Then the first bar will be bar 1 and the second one bar 2. Won't it? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Bakarus
(17 posts) Bio
|
Date
| Reply #8 on Wed 03 Oct 2012 02:10 PM (UTC) |
Message
| I did go through the tutorial, but saw no mention of changing the colors of the bars after creating them, since I didn't think that was possible, I tried to AddBar when the spell was cast, then RemoveBar when it expired and AddBar after expiration with the new red background to indicate the buff was no longer active.
What I had there was after many attempts at trying different things, I would have posted the plugin along with it, but it is a huge file.
I can add the bars at the beginning but I am unsure of how to 'change' the colors when the buff expires, that's my problem.
I will go through the original infobox plugin again and see if i can find anyway of doing what i would assume should be supported. | Top |
|
Posted by
| Nick Gammon
Australia (23,122 posts) Bio
Forum Administrator |
Date
| Reply #9 on Wed 03 Oct 2012 09:37 PM (UTC) |
Message
| Try bringing up its internal documentation. In the command window type:
then:
You should see this:
Additional help can be found on the following functions and values
*AddYourOwn *Inheritance AddBar AnchorRight
BadColour Bar BarStyle Bars
Caption CaptionPlacement CloseWindow ColourText
Columns Fade Font GoodColour
InsertBar New Padding RemoveBar
ReopenWindow Resize ResizeOutput Rows
TextColour TextStyle Threshold Update
Value WatchCaption WatchValue WindowPosition
anchorRight axis backgroundColour badColour
barStyle barStyles button caption
captionPlacement captionPlacements cellHeight cellLeft
cellPadding cellTop cellWidth columns
customColourCodes displaceOutput fontBold fontCharset
fontID fontItalic fontName fontPadding
fontPitchAndFamily fontSize fontStrikeout fontUnderline
gaugeHeight gaugeLeft gaugeWidth goodColour
id padding rows textColour
textStyle textStyles threshold value
windowFlags windowHeight windowPosition windowPositions
windowWidth
Syntax: /InfoBox:Doc("topic")
Then you can get help on stuff like colouring existing bars, eg.
/InfoBox:Doc ("goodColour")
Gives:
Applies To: Bar
Prototype: Bar.goodColour = n
The number value of the color drawn near 100% values for gradients, or when value
is greater than threshold for solid fills. The GoodColour function sets this value
to the number equivalent to a color.
Bar:GoodColour("indigo") -- ok
Bar.goodColour = 8519755 -- ok
Bar.goodColour = "indigo" -- NOT OK!
n = number; the number value for a colour.
|
- 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.
21,255 views.
Posting of new messages is disabled at present.
Refresh page
top