Author Topic: HUD - Colour Ranged numbers  (Read 9751 times)

ULTRA Random ViruS

  • Posts: 924
  • Turrets: +4/-101
    • ZdrytchX's reference website
HUD - Colour Ranged numbers
« on: March 25, 2014, 02:13:11 pm »
Say, does anyone know how to colour lagometers, I want it particularly so I'll be able to create a function that puts an alerting red colour on my screen whenever ping exceeds 400 (because unlagged ceases to exist beyond that).
This is the default HUD function that's available to me, given from Meisseli's Hud for 1.1:
Code: [Select]
   //LAGOMETER
    itemDef
    {
      name "lagometer"
      rect 596 25 32 20
      style WINDOW_STYLE_EMPTY
      visible 1
        cvartest meis_infopanel
        showCvar { 1 }
      decoration
      forecolor 0.8 0.8 1.0 1.0
      textscale 0.3
      textalignx 1
      textaligny 0.5
      ownerdraw CG_LAGOMETER
    }
And What I want to do, is give it colour ranges using this function:
Code: [Select]
addColorRange <rangestart> <rangeend> <r> <g> <b> <alpha/transparency>but it doesn't seem to work for this one if I shove it in the lagometer draw function.

The attachment below is what my hud currently looks like on an impure server*:
(Note: I'm drawing fake ping using a custom client command)

From left to right, top to bottom of the top right of the screen:
Speed [Fake Graph] FPS
Inter/Extrapolation Ping
Clock
« Last Edit: March 25, 2014, 02:26:03 pm by ULTRA Random ViruS »

/dev/humancontroller

  • Posts: 1033
  • Turrets: +1002/-383
Re: HUD - Colour Ranged numbers
« Reply #1 on: March 26, 2014, 07:43:54 am »
Say, does anyone know how to colour lagometers, I want it particularly so I'll be able to create a function that puts an alerting red colour on my screen whenever ping exceeds 400 (because unlagged ceases to exist beyond that).
[...]
What I want to do, is give it colour ranges using this function:
Code: [Select]
addColorRange <rangestart> <rangeend> <r> <g> <b> <alpha/transparency>but it doesn't seem to work for this one if I shove it in the lagometer draw function.
unfortunately, there is no such functionality implemented in the cgame module, ie., lagometer colorizing cannot be done by editing HUD files. pingtime-based (or any other programmed) conditional HUD drawing is also not implemented. you'll need to edit the code of the cgame module and compile it; see the CG_DrawLagometer() function in the cg_draw.c file.

ULTRA Random ViruS

  • Posts: 924
  • Turrets: +4/-101
    • ZdrytchX's reference website
Re: HUD - Colour Ranged numbers
« Reply #2 on: March 26, 2014, 03:10:21 pm »
It works for health bars though.

What else would it work for without changing the cgame code?

/dev/humancontroller

  • Posts: 1033
  • Turrets: +1002/-383
Re: HUD - Colour Ranged numbers
« Reply #3 on: March 26, 2014, 08:21:20 pm »
It works for health bars though.

What else would it work for without changing the cgame code?
surprizingly, only health, ammo and clips. see the CG_GetValue() function. it would need to return a ping value if
Code: [Select]
ownerDraw == CG_LAGOMETER(refer to the CG_DrawLagometer() function for the method to get the value).

ULTRA Random ViruS

  • Posts: 924
  • Turrets: +4/-101
    • ZdrytchX's reference website
Re: HUD - Colour Ranged numbers
« Reply #4 on: March 27, 2014, 09:52:42 am »
I probably should start modding again, I haven't touched tremulous code since january :P
Thanks for the assistance  :laugh:

Xenina

  • Posts: 5
  • Turrets: +0/-0
Re: HUD - Colour Ranged numbers
« Reply #5 on: June 13, 2015, 09:45:21 am »
Not many people in the forums. I've only just now downloaded Trem again . . So I hear ya.