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.
 Entire forum ➜ MUSHclient ➜ Suggestions ➜ a color status bar

a color status bar

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


Pages: 1 2  3  

Posted by Faolong   USA  (28 posts)  Bio
Date Sat 26 Oct 2002 02:22 AM (UTC)
Message
can we have a color status bar to indicate the levels of mana and hp and moves... etc.. it would be really useful if somebody wanted to replace the prompt line....
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 26 Oct 2002 09:48 PM (UTC)
Message
I am working on that right now, as it sounds really useful.

In fact, I am doing a separate bar, so you can have the full width of the screen. This is planned to be a Rich Edit control, so you can have different colours, multiple fonts, bold, underline etc.

- Nick Gammon

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

Posted by Guest1   USA  (256 posts)
Date Reply #2 on Sun 27 Oct 2002 12:14 PM (UTC)

Amended on Sun 27 Oct 2002 12:53 PM (UTC) by Guest1

Message
Do you think you will add the ability to 'customize' the activity toolbar in the near future? For me at least, I'd like to be able to have one of the buttons link to an open notepad window within MC instead of only to world windows.

Actually.. what I'd like to do also is open existing notepad windows but open them within mushclient rather than outside MC.. I'm trying to spot somewhere on the menu to do that other than opening new ones.. can't seem to find it. Am I missing something? currently using vers 3.26 if that helps
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #3 on Sun 27 Oct 2002 09:40 PM (UTC)
Message

OK then, this looks pretty exciting.

Version 3.29 onwards of MUSHclient will have a separate "info" bar, which is intended to show information relevant to what you are doing (eg. current status).

Here is an example:

The info bar is the width of the entire MUSHclient window, giving you lots of room to store things. In it you can have:

  • Multiple different fonts
  • Different colours (text colour)
  • Different font sizes and styles (eg. bold, underline)

By judicious use of symbol or special fonts (my example uses Webdings) you can draw gauges and similar things.


- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #4 on Sun 27 Oct 2002 09:50 PM (UTC)

Amended on Sun 27 Oct 2002 09:51 PM (UTC) by Nick Gammon

Message
This is the technique I used to do the above gauges. There is a DoGauge subroutine that draws individual gauges, and then a small trigger routine called by a trigger, which draws the three gauges ...


sub DoGauge (sPrompt, iCurrent, iMax, sGoodColour, sBadColour)
dim pc, count

'
'  Do prompt in black Arial
'
  world.InfoColour "black"
  world.InfoFont "Arial", 10, 0
  world.Info sPrompt

'
'  Use Webdings for gauge (black square)
'

  world.InfoFont "Webdings", 10, 0

  pc = CInt ((CInt (iCurrent) / CInt (iMax)) * 10)

'
'  Below 20% warn by using different colour
'

  if pc < 2 then
    world.InfoColour sBadColour
  else
    world.InfoColour sGoodColour
  end if

'
'  Draw active part of gauge
'
  for count = 1 to pc
    world.Info "g"
  next  

'
'  Draw rest of gauge in grey (ie. unfilled bit)
'

  world.InfoColour "dimgray"
  while count < 10
    count = count + 1
    world.Info "g"
  wend

end sub

sub DoPrompt (sName, sLine, wildcards)

  world.InfoClear

'
'  World name
'

  world.InfoFont "Arial", 12, 1  ' 12 point Arial *bold*
  world.InfoColour "purple"
  world.Info world.GetInfo (2)  ' world name

  DoGauge "  HP: ", wildcards (1), wildcards (2), "darkgreen", "maroon"
  DoGauge "  Mana: ", wildcards (3), wildcards (4), "mediumblue", "mediumblue"
  DoGauge "  Move: ", wildcards (5), wildcards (6), "gold", "gold"

end sub


- Nick Gammon

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

Posted by Shadowfyr   USA  (1,788 posts)  Bio
Date Reply #5 on Sun 27 Oct 2002 11:17 PM (UTC)

Amended on Sun 27 Oct 2002 11:20 PM (UTC) by Shadowfyr

Message
Hmm. Nice.. Now just patching my own code for the Hitbar in so you can use some code and a function from my HitBar plugin at www.magnumsworld.com/muds:

pc = CInt ((CInt (iCurrent) / CInt (iMax)) * 10)
Hue = 120 * pc
Sat = 255
Lumin = 60 * pc + 68
color = HSLtoRGB(Hue, Sat, Lumin)

DoGauge " HP: ", wildcards (1), wildcards (2), color, "maroon"

and it will be even nicer. ;) In fact it may be a lot better than even the one I built. Especially since mine is specific to Ages of Despair. Is the bar resizable? Like if you have a 'lot' more stuff than will fit on one line easilly?
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #6 on Mon 28 Oct 2002 02:50 AM (UTC)

Amended on Mon 28 Oct 2002 02:54 AM (UTC) by Nick Gammon

Message
Can't make that work right now, so for now we'll have a single-line one. :)

I suggest if you have a lot more than one line use a notepad window instead.

- Nick Gammon

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

Posted by Shadowfyr   USA  (1,788 posts)  Bio
Date Reply #7 on Mon 28 Oct 2002 06:54 PM (UTC)
Message
Hmm. Ok.. Maybe later. As for the notepad idea.. That is relaively useless for the kind of stuff I would like to put on such a bar. lol
Top

Posted by Ovvi   Poland  (13 posts)  Bio
Date Reply #8 on Fri 01 Nov 2002 04:43 AM (UTC)
Message
I have idea :-)

Is this possible to resize status bar? I mean to change location to anywhere of my screen and to change size to more than one line.

Ovvi
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #9 on Sun 03 Nov 2002 08:52 PM (UTC)
Message
If you click on the left-hand edge of it you can drag it to:


  • Dock at the top of the window
  • Dock at the bottom of the window
  • Make a floating window


I just noticed then that if you release it in the middle of the main window the entire window seems to go grey, so my advice is -- don't do that.

- Nick Gammon

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

Posted by Poromenos   Greece  (1,037 posts)  Bio
Date Reply #10 on Tue 05 Nov 2002 04:41 PM (UTC)
Message
You have a slight bug there :) Oh, by the way, until you can ge webdings to work, just change "g" to "l". Looks almost like a status bar. "#" is nice too.
Anyway, sometimes, when you remove your equipment, you have more hp/mana/move than your max, and in that case the bar expands. you should put this line there:

'The next line is the one to use.

if pc > 10 then pc = 10

for count = 1 to pc
world.Info "l"
next

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
Top

Posted by Vaejor   (120 posts)  Bio
Date Reply #11 on Mon 11 Nov 2002 04:29 AM (UTC)
Message
Here's something I threw together to make a single function that maintains all the info bar data in a good order. It is especially useful if you want to use data from several different places but keep everything in a consistant order.

The programming looks pretty nasty, but it works pretty well.

I ended up using arial narrow with the letter "l" to do the bars since it was smaller and could get more on in the same space for slightly more accurate monitoring.

The only required variable is info_data, and only required code outside of the primary function is the ReDim info_data(2). Everything else is included for demonstration purposes only.

Dim info_data
Dim hpbar_hp
Dim hpbar_hp_max
Dim hpbar_hp_perc
Dim hpbar_sp
Dim hpbar_sp_max
Dim hpbar_sp_perc
Dim hpbar_extra1
Dim hpbar_extra2

ReDim info_data(2)
' These should be set in triggers, here's some data to play with though
hpbar_hp = 75
hpbar_hp_max = 100
hpbar_sp = 25
hpbar_sp_max = 125

hpbar_hp_perc = Fix((hpbar_hp * 100) / hpbar_hp_max)
hpbar_sp_perc = Fix((hpbar_sp * 100) / hpbar_sp_max)

' If you have multiple entries, set them up first so it knows your preferred order
write_info "hp_bar", ""
write_info "hp_bar2", ""

' Change data in any order, it will keep them in the same order from when you first requested each
write_info "hp_bar2", "@color:black@@font:arial/10/0@Extra: " & hpbar_extra1 & "/" & hpbar_extra2
write_info "hp_bar", "@color:black@@font:arial/10/0@HP: @bar:25/" & hpbar_hp_perc & _
    "/red/gray@@color:black@@font:arial/10/0@  SP: @bar:25/" & hpbar_sp_perc & _
    "/blue/gray@"


' @font:name/size/stylecode@
' @color:name@
' @bar:length/percentage/coloron/coloroff@

' 2 spaces between each section
Sub write_info(ByVal strType, ByVal strData)
  Dim i
  Dim split_data
  Dim j
  Dim str1
  Dim str2
  Dim k
  Dim strBar
  Dim l
  Dim m

  For i = 1 To UBound(info_data) Step 2
    If (strType = info_data(i)) Then Exit For
  Next

  If (i > UBound(info_data)) Then
    i = UBound(info_data) - 1
    If (info_data(1) <> "") Then
      i = i + 2
      ReDim Preserve info_data(i + 1)
    Else
      i = 1
    End If
  End If

  info_data(i) = strType
  info_data(i + 1) = strData

  world.InfoClear
  For i = 1 To UBound(info_data) Step 2
    split_data = Split(info_data(i + 1), "@")
    For j = 0 To UBound(split_data)
      If (j Mod 2 = 0) Then
        If (split_data(j) <> "") Then world.Info split_data(j)
      Else
        str1 = Split(split_data(j), ":")(0)
        str2 = Split(split_data(j), ":")(1)
        Select Case (str1)
          Case "font"
            If (UBound(Split(str2, "/")) <> 2) Then
              world.Note "-----"
              world.Note "write_info : Error in font data - '" & str2 & "'"
              world.Note "-----"
              Exit For
            End If
            world.InfoFont Split(str2, "/")(0), CInt(Split(str2, "/")(1)), CInt(Split(str2, "/")(2))
          Case "color"
            world.InfoColour str2
          Case "bar"
            If (UBound(Split(str2, "/")) < 3) Then
              world.Note "-----"
              world.Note "write_info : Error in bar data - '" & str2 & "'"
              world.Note "-----"
              Exit For
            End If
            strBar = ""
            For k = 1 To CInt( Split(str2, "/")(0) )
              strBar = strBar & "l"
            Next
            world.InfoFont "Arial Narrow", 11, 1
            world.InfoColour Split(str2, "/")(2)
            l = CInt( Split(str2, "/")(1) )
            If (l > 100) Then
              l = 100
            ElseIf (l < 0) Then
              l = 0
            End If
            m = CInt( Split(str2, "/")(0) )
            k = Round( m * l / 100 )
            world.Info Left(strBar, k)
            world.InfoColour Split(str2, "/")(3)
            world.Info Left(strBar, m - k)
        End Select
      End If
    Next
    world.Font "arial", 10, 0
    world.Color "black"
    world.Info "  "
  Next


  Set strType = Nothing
  Set strData = Nothing
  Set i = Nothing
  Set split_data = Nothing
  Set j = Nothing
  Set str1 = Nothing
  Set str2 = Nothing
  Set k = Nothing
  Set strBar = Nothing
End Sub
Top

Posted by StefanWulph   USA  (35 posts)  Bio
Date Reply #12 on Mon 03 Feb 2003 04:01 AM (UTC)
Message
Hello all.
Uhmm nice examples of the hitbars Mr Gammon, Vaejor and Shadowfyr. BUt i only have one thing to ask.. WHat are the triggers for them. Nobody gives the proper triggers to use for their scripts. So if you could PLEASE give examples of the triggers too. It'd be greatly appreciated, Thanks..
A confused Wulph
Stefan Wulph
Top

Posted by Shadowfyr   USA  (1,788 posts)  Bio
Date Reply #13 on Mon 03 Feb 2003 08:09 AM (UTC)

Amended on Mon 03 Feb 2003 08:33 AM (UTC) by Shadowfyr

Message
Well StefanWulph.. In the case of my suggestion, it requires two subroutines in VBScript that are part of my own version of such a bar. The triggers I use for mine are included within that plugin, which you can download from www.magnumsworld.com/muds.

However, since I don't use the infobar itself, but generate my own inline bar, most of the code wouldn't help much. It is a good source of examples for the trigger I use. If you do want to use the HSLtoRGB(Hue, Sat, Lumin) feature to adjust the color by percentage it is a must though, since Mushclient has no such converter built into it.

Put simply. You could either adapt the trigger and text it displayed to match the line you want to replace and use it as is, or use the trigger and HSLtoRGB code and scrap the rest in favor of something that used the InfoBar. ;) Since I already had mine working, and I had some issues with the way the InfoBar works, I never bothered to code a version that used it.


However, to more specifically answer you, the trigger I am using works off a lines like:

HP: [50/100] CONC: [100/400]
HP: [50/100] CONC: [100/400] Opponent: Wounded

So my trigger looks like this:

<trigger
   enabled="y"
   match="HP: [(.*)/(.*)]  CONC: [(.*)/(.*)](.*)"
   name="HitBar"
   omit_from_log="y"
   omit_from_output="y"
   sequence="1"
   regexp="y"
   script="HealthDisp"
  >
</trigger>


I chose to use a regular expression to avoid some of the issues that could come up otherwise. Hmm... Although, I should have used match="^HP: [(\d+)/(\d+)] CONC: [(\d+)/(\d+)](.*)" in order to avoid it working on stuff someone dropped in channels and to make sure that 'HP: [1/3]' worked, but 'HP: [a/b]' wouldn't. But that would be overkill, just adding the ^ to it would fix the channel spoofing issue. ;)

In simplest terms you could manage with:

<trigger
   enabled="y"
   match="HP: [*/*]  CONC: [*/*]"
   name="HitBar"
   omit_from_log="y"
   omit_from_output="y"
   sequence="1"
   script="HealthDisp"
  >
</trigger>

sub HealthDisp (name, output, wilds)
  pc = CInt ((CInt (wilds(1)) / CInt (wilds(2))) * 10)
  Hue = 120 * pc
  Sat = 255
  Lumin = 60 * pc + 68
  color = HSLtoRGB(Hue, Sat, Lumin)
  DoGauge " HP: ", pc, 100, color, "maroon"

  pc = CInt ((CInt (wilds(3)) / CInt (wilds(4))) * 10)
  Hue = 120 * pc
  Sat = 255
  Lumin = 60 * pc + 68
  color = HSLtoRGB(Hue, Sat, Lumin)
  DoGauge " HP: ", pc, 100, color, "maroon"
end sub

'Color spectrum is:
'  0 = Red
' 60 = Yellow
'120 = Green
'180 = Cyan
'240 = Blue
'300 = Magenta
'360 = Red

function HSLtoRGB (Hue, Sat, Lum)
  dim rm1, rm2, Temp, Temp2, Red, Green, Blue
  Lum = Lum / 255 '** Get these back to a %. Hue is an arc from 0 to 360, so we don't touch it.
  Sat = Sat / 255
  if Sat = 0 then
    Temp = Lum * 255 '** Satuaration of 0 means it is gray, so all colors are a % of the maximum.
    Red = Temp
    Green = Temp
    Blue = Temp
  else
    if Lum <= 0.5 then '** Haven't a clue about the rest of this, I just know it works. lol
	rm2 = Lum + Lum * Sat
    else
	rm2 = Lum + Sat - Lum * Sat
    end if
    rm1 = 2 * Lum - rm2
    Temp = rm1
    Red = FindColor(Temp, rm2, Hue + 120)
    Temp = rm1
    Green = FindColor(Temp, rm2, Hue)
    Temp = rm1
    Blue = FindColor(Temp, rm2, Hue - 120)
  end if
  Red = Cint(Red) '** Stick it all together into a single hex string.
  Temp = Hex(Red)
  if len(Temp) < 2 then
    Temp = "0" + Temp
  end if
  Temp2 = Temp
  Temp = Hex(Green)
  if len(Temp) < 2 then
    Temp = "0" + Temp
  end if
  Temp2 = Temp2 + Temp
  Temp = Hex(Blue)
  if len(Temp) < 2 then
    Temp = "0" + Temp
  end if
  Temp2 = Temp2 + Temp
  HSLtoRGB = Temp2
end function

function FindColor (rm1, rm2, rh)
  if rh > 360 then
    rh = rh - 360
  else
    if rh < 0 then
	rh = rh + 360
    end if
  end if
  if rh < 60 then
    rm1 = rm1 + (rm2 - rm1) * rh / 60
  else
    if rh < 180 then
	rm1 = rm2
    else
	if rh < 240 then
        rm1 = rm1 + (rm2 - rm1) * (240 - rh) / 60
      end if
    end if
  end if
  FindColor = rm1 * 255
end function


That would produce two guages based of the current and maximum values for HP and CONC that change color as those stats dropped. Yours would be different of course, but this is basically all that is needed to do so. Assuming I didn't screw something up that is. ;)
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #14 on Mon 03 Feb 2003 09:03 AM (UTC)

Amended on Mon 03 Feb 2003 09:04 AM (UTC) by Nick Gammon

Message
I didn't show the actual trigger because it would depend a great deal on the prompt, and it was pretty simple, you just need 6 wildcards for HP/Total HP, Mana/Total mana, Move/Total move.

eg. something like this:

If the prompt was:

<80/10 hp 10/50 m 30/80 mv>

Then your trigger would be:

<*/* hp */* m */* mv> *

The final * would be the rest of the line, eg. your command.

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


83,031 views.

This is page 1, subject is 3 pages long: 1 2  3  [Next page]

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.