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 ➜ Lua ➜ Statusbar.exe triggering

Statusbar.exe triggering

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


Posted by Solara   USA  (59 posts)  Bio
Date Mon 10 Dec 2012 05:06 PM (UTC)

Amended on Mon 10 Dec 2012 05:09 PM (UTC) by Solara

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

Posted by Solara   USA  (59 posts)  Bio
Date Reply #1 on Mon 10 Dec 2012 06:05 PM (UTC)
Message
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....
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #2 on Mon 10 Dec 2012 11:33 PM (UTC)
Message
I recommend you use miniwindows these days to do things like status bars.

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

- Nick Gammon

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

Posted by Solara   USA  (59 posts)  Bio
Date Reply #3 on Wed 12 Dec 2012 12:10 AM (UTC)
Message
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!
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #4 on Wed 12 Dec 2012 12:59 AM (UTC)
Message
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.

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #5 on Wed 12 Dec 2012 01:32 AM (UTC)
Message
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>


- Nick Gammon

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

Posted by Solara   USA  (59 posts)  Bio
Date Reply #6 on Thu 13 Dec 2012 06:13 AM (UTC)
Message
Okay, thanks for all that Nick.
I'll have a good at it this weekend and we'll see how that goes.
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.


18,791 views.

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.