[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  Miniwindows/Infobox to track variables

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: Miniwindows/Infobox to track variables
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Posted by WillFa   USA  (517 posts)  [Biography] bio
Date Tue 26 May 2009 01:11 AM (UTC)  quote  ]
Message
nope, you should be fine with that setup.

Glad you like the Infobox module. I put a lot of work into it. :)
[Go to top] top

Posted by Jai   (4 posts)  [Biography] bio
Date Mon 25 May 2009 07:17 PM (UTC)  quote  ]
Message
Wow, such fast replies, thanks!

I went with Willfa's because I understand it a little better and it's working great. Instead of putting it on a timer, I put it to an alias. I've a trigger to set off the alias when I join the game, and my alias to set a target variable also triggers the updating alias. If for some reason this way would cause problems and I should use a timer, please let me know!
[Go to top] top

Posted by WillFa   USA  (517 posts)  [Biography] bio
Date Mon 25 May 2009 07:33 AM (UTC)  quote  ]

Amended on Mon 25 May 2009 07:53 AM (UTC) by WillFa

Message
As Nick said, that needs a timer to keep it updated.


The big problem above though is how you were trying to make the caption.

This should work better for you:


<timers>
  <timer enabled="y" second="15.00" offset_second="0.00"    send_to="12"
>
  <send>require "InfoBox"
box = box or InfoBox:New("TW")
box.Bar.barStyle = InfoBox.barStyles.textOnly
box:WindowPosition(box.windowPositions.E)
tw = box.Bars[1] or box:AddBar("")
tw.caption = "KT: " .. GetVariable("kill_target") 
tw = box.Bars[2] or box:AddBar("")
tw.caption = "HT: " .. GetVariable("heal_target") 
tw = box.Bars[3] or box:AddBar("")
tw.caption = "DT: " .. GetVariable("debate_target") 
box:Update()</send>

  </timer>
</timers>


p.s. nick, it's possible to have a "bar" that's just a label. :)
[Go to top] top

Posted by Nick Gammon   Australia  (18,800 posts)  [Biography] bio   Forum Administrator
Date Mon 25 May 2009 06:45 AM (UTC)  quote  ]

Amended on Mon 25 May 2009 06:50 AM (UTC) by Nick Gammon

Message
One problem I see is that this will only show the current value, and it won't update (unless you are planning to put this inside a timer). Infoboxes, as far as I know, are for gauges rather than pure text (I could be wrong about that).

This timer I developed shows how you can just display the various variables you mention, in a small miniwindow. It updates every second, so it should show the current information.


<timers>
  <timer enabled="y" second="1.00" send_to="12"
>
  <send>

require "var"

-- make window if required
if not setup_target_window then

  target_win = GetPluginID () .. ":targets" -- get a unique name
  WindowCreate (target_win , 0, 0, 200, 55, 6, 0, ColourNameToRGB("whitesmoke"))  -- create window

  WindowFont (target_win, "f", "FixedSys", 9) -- define font
  target_font_height  = WindowFontInfo (target_win , "f", 1)  
  setup_target_window = true

end -- if first time

-- blank existing window contents

WindowRectOp (target_win, 2, 0, 0, 0, 0, WindowInfo (target_win, 9))

-- framing rectangle
WindowRectOp (target_win, 5, 0, 0, 0, 0, 5, 15)

-- variables for text position (the top updates as we move down)
local left = 5
local top = 5

-- kill target
WindowText (target_win, "f", "KT: " .. (var.kill_target or "none"), 
            left, top, 0, 0, ColourNameToRGB("green"))

top = top + target_font_height  

-- heal target
WindowText (target_win, "f", "HT: " .. (var.heal_target or "none"), 
            left, top, 0, 0, ColourNameToRGB("blue"))

top = top + target_font_height  

-- debate target
WindowText (target_win, "f", "DT: " .. (var.debate_target or "none"), 
            left, top, 0, 0, ColourNameToRGB("orange"))

-- make visible, or refresh if already visible
WindowShow (target_win ,  true)  

</send>

  </timer>
</timers>


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Jai   (4 posts)  [Biography] bio
Date Mon 25 May 2009 04:33 AM (UTC)  quote  ]
Message
Is there a quick way to keep track of what a variable is without looking it up in the list of variables? I have several targets set at once for different types of skills- I can make the variables and the aliases to set them- and I'd like a way to keep track of who I have targeted for what. I thought I could use the infoboxes/miniwindows for this, but it's not working out. I've been trying in Lua with:

require "InfoBox"
box = InfoBox:New("TW")
box:WindowPosition(box.windowPositions.E)
tw = box:AddBar("KT: (string.sub(GetVariable("kill_target")))"), 100, "gray", "gray", false, InfoBox.barStyles.solid)
tw = box:AddBar("HT: (string.sub(GetVariable("heal_target")))"), 100, "gray", "gray", false, InfoBox.barStyles.solid)
tw = box:AddBar("DT: (string.sub(GetVariable("debate_target")))"), 100, "gray", "gray", false, InfoBox.barStyles.solid)
box:Update()

or

require "InfoBox"
box = InfoBox:New("TW")
box:WindowPosition(box.windowPositions.E)
tw = box:AddBar("KT: ", GetVAriable("kill_target"))
tw = box:AddBar("HT: ", GetVAriable("heal_target"))
tw = box:AddBar("DT: ", GetVAriable("debate_target"))
box:Update()

Am I doing the scripts wrong or should I be trying to use something besides infoboxes?
[Go to top] 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.


1,672 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]