Statusbar.exe triggering

Posted by Solara on Mon 10 Dec 2012 05:06 PM — 7 posts, 27,194 views.

USA #0
Hi, trying to setup Statusbar.exe to use as a status window.
Read this thread: http://www.gammon.com.au/forum/?id=4951, an downloaded the statusbar.exe file.

Could someone explain in simple steps how to set up a trigger to display some text in the statusbar?

I copy and pasted the following into an Immediate Window and it does display the sample status bar so I know the funciton works (I did not download the amended LuaSocket stuff.)

socket = require "socket"
s = socket.udp ()
s:setpeername ("127.0.0.1", 4111)

s:send ("magic,title,Status Bar - BabbleMUD")
s:send ("magic,config,10,5,100,15,60,320,20")
s:send ("magic,size,10,10,350,140")
s:send ("magic,textcolour," .. ColourNameToRGB ("indigo"))
s:send ("magic,backcolour," .. ColourNameToRGB ("lightsteelblue"))
s:send ("magic,labels,HP,Mana,Move,XP")
s:send ("magic,values,10,20,30,80")
s:send ("magic,font,Comic Sans MS,10,0,700")
s:send ("magic,colours," .. 
        ColourNameToRGB ("darkgreen") .. "," .. 
        ColourNameToRGB ("darkblue") .. "," .. 
        ColourNameToRGB ("saddlebrown") .. "," .. 
        ColourNameToRGB ("dimgray"))
s:send ("magic,fillcolours," .. 
        ColourNameToRGB ("lightgreen") .. "," .. 
        ColourNameToRGB ("lightblue") .. "," .. 
        ColourNameToRGB ("tan") .. "," .. 
        ColourNameToRGB ("gainsboro"))

s:send ("magic,text,5,88,Darkhaven Square")

s:close ()


Supposedly you don't need Luasocket and can use the udpsend commands built into MushClient, but I can't get it to work. I also couldn't get "os.execute ('start "statusbar" "' .. GetInfo (66) .. 'StatusBar.exe"')" to work either to automatically launch statusbar.exe, which is located in the same folder as MushClient.

I tried something simple in my trigger script:
UdpSend ("127.0.0.1", 4111, "magic,labels,HP,Mana,Move,XP")


But it doesn't do anything to the statusbar.exe window itself.

Any help appreciated.
Oh, and I've allowed Mushclient and Statusbar.exe to act as servers in my firewall program.
Amended on Mon 10 Dec 2012 05:09 PM by Solara
USA #1
Hmm odd just tried to rerun that code again on another computer within an Immediate Window and nothing happens. Downloaded the amended Luasocket stuff and replaced the original Mush files and nothing happens still....
Australia Forum Administrator #2
I recommend you use miniwindows these days to do things like status bars.

Example: http://www.gammon.com.au/forum/?id=9270
USA #3
Looks good, but I'm not too saavy with modifying plugins.

I'm not looking for a health/mana bar, but want a miniwindow to show when I cast a spell and when the spell wears off - or spell status window basically.

What would I need to modify in that plugin to enable me to do that using simple a simple trigger to send the status of a spell to that miniwindow?

Thanks!
Australia Forum Administrator #4
I had a button bar with cooldowns in this thread:

http://www.gammon.com.au/forum/?id=9359

Also see this thread for an "infobox" plugin (that I think ships with the client):

http://www.gammon.com.au/forum/?id=9097

Using that, and in a few lines of code, you should be able to draw a bar, and then update that (say once a second) in a timer to make it count down to zero.
Australia Forum Administrator #5
Here's an example, triggered by a heal message:


<triggers>
  <trigger
   enabled="y"
   match="You receive a heal."
   send_to="12"
   sequence="100"
  >
  <send>

require "infobox"

HEALTIME = 10   -- how many seconds

-- heal box
healBox = infobox:New ("heal")

-- one bar in it
healBar = healBox:AddBar ("Heal: ", 100) -- start at 100 percent

-- current value
healBar.value = 100  -- percent

-- draw it
healBox:Update ()

-- called by the timer when it fires
function UpdateHealTimeFunction ()
  healBar.value = healBar.value - (100 / HEALTIME)
  healBox:Update ()
  if healBar.value &lt;= 0 then
    healBox:RemoveBar (healBar.id)
    EnableTimer ("UpdateHealTime", false)
    WindowDelete (healBox.windowName)
    healBox = nil
  end -- if
end -- function

-- add a timer to count the time down
AddTimer ( "UpdateHealTime",
    0, 0, 1,  -- every second
    "",   -- send nothing
    timer_flag.Enabled + timer_flag.Replace + timer_flag.Temporary,  -- flags
     "UpdateHealTimeFunction")  -- script

</send>
  </trigger>
</triggers>

USA #6
Okay, thanks for all that Nick.
I'll have a good at it this weekend and we'll see how that goes.