Page 1 of 1

Widget that show how many units left to MAX-Unit...

Posted: 16 Sep 2009, 05:03
by R-TEAM
Hi,

if i play in LAN with my little bit old second-PC i set the max units
variable low enough to deal with the cpu power he have ... ;)

But found it is a bit frustrating if you build a large army and then -
nothing more - stop - no go .... have reached the max ... :(

It would be nice show a widget the units left (or the actual number)
to planing this better ...

Like ->
I have set max 500 Units - if i have 450 the widget show a message:
"Only 50 units left !" ...
By a max of 1000 units the border should hit at 100 left...
(if the number bigger - the number of fabrics that build units is bigger too imho - so the amount of planed/in production units is higher)

Regards
R-TEAM

Re: Widget that show how many units left to MAX-Unit...

Posted: 16 Sep 2009, 09:55
by hoijui
Ctrl-A

Re: Widget that show how many units left to MAX-Unit...

Posted: 16 Sep 2009, 10:02
by manolo_
nice widget hoijui^^

Re: Widget that show how many units left to MAX-Unit...

Posted: 16 Sep 2009, 17:11
by Pendrokar
hoijui wrote:Ctrl-A
What if you forgot how many there could still be?

Re: Widget that show how many units left to MAX-Unit...

Posted: 16 Sep 2009, 17:22
by MelTraX
Alt-Tab

Re: Widget that show how many units left to MAX-Unit...

Posted: 16 Sep 2009, 21:52
by KDR_11k
ctrl-shift-escape

Re: Widget that show how many units left to MAX-Unit...

Posted: 16 Sep 2009, 22:13
by MelTraX
OK, I feel bad for giving you a stupid answer:

Code: Select all

function widget:GetInfo()
  return {
    name    = "Max Units Warning",
    desc    = "Outputs a warning in the console if you use 90% of the max units.",
    author  = "MelTraX",
    date    = "2009-09-16",
    license = "Public Domain",
    layer   = 1,
    enabled = false
  }
end

function widget:UnitCreated()
  local max = Spring.GetModOptions()['maxunits'] or 500
  local current = #Spring.GetTeamUnits(Spring.GetMyTeamID())
  if max * 0.9 == current then
    Spring.Echo(string.format('You have %d units. The maximum unit count is set to %d.', current, max))
  end
end
Yes, it's not pretty but it's better than nothing.

Re: Widget that show how many units left to MAX-Unit...

Posted: 17 Sep 2009, 03:10
by R-TEAM
Hi,

Thanks MelTraX ;)

And Thanks hoijui, but if you have a slow cpu and many,many Units and hit ctrl-alt .........
;)

Regards
R-TEAM

Re: Widget that show how many units left to MAX-Unit...

Posted: 17 Sep 2009, 03:41
by lurker
doesn't tell you max units?

Re: Widget that show how many units left to MAX-Unit...

Posted: 17 Sep 2009, 08:42
by hoijui
i have s slow CPU too.. but as i dont check num-units every few secs, it is ok.
The problem with Ctrl-Alt is rather, that you have to be very carefull to not accidentialy issue an order :D
happend to me once; big @#%@$%@#$ moment!