build costs 1.02 - updated 21 Sep - Page 2

build costs 1.02 - updated 21 Sep

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

User avatar
AndiNo
Posts: 24
Joined: 23 Mar 2009, 09:45

Re: build costs 1.02 - updated 21 Sep

Post by AndiNo »

gui_build_costs.lua
(28.09 KiB) Downloaded 140 times
I made a small change based on Lupus' version of build costs. It prevents the numbers in the build costs display from becoming too large as it was the case if for example the income would be greater than 1000. Now it displays 1k instead of 1000.
I simply changed (line 397 I think)

Code: Select all

str = str .. string.format("%d", n) .. "\255\255\255\255"
to

Code: Select all

  if n >= 10000 or n <= -10000 then
    str = str .. string.format("%.0fk", n/1000) .. "\255\255\255\255"
  elseif n >= 1000 or n <= -1000 then
    str = str .. string.format("%.1fk", n/1000) .. "\255\255\255\255"
  else
    str = str .. string.format("%d", n) .. "\255\255\255\255"
  end
btw: I really like this "addon", it could well be included in Spring :)
User avatar
manolo_
Posts: 1370
Joined: 01 Jul 2008, 00:08

Re: build costs 1.02 - updated 21 Sep

Post by manolo_ »

why include? upload it to jobjol/spring downloader and all player who wants to use have a chance to use it
User avatar
AndiNo
Posts: 24
Joined: 23 Mar 2009, 09:45

Re: build costs 1.02 - updated 21 Sep

Post by AndiNo »

OK, to put it another way: it really fits into the game :) It could have been in the original TA.
User avatar
manolo_
Posts: 1370
Joined: 01 Jul 2008, 00:08

Re: build costs 1.02 - updated 21 Sep

Post by manolo_ »

AndiNo wrote:OK, to put it another way: it really fits into the game :) It could have been in the original TA.
:)
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: build costs 1.02 - updated 21 Sep

Post by smoth »

AndiNo wrote: btw: I really like this "addon", it could well be included in Spring :)
This will not work with many of the new games. It is fine as a widget.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: build costs 1.02 - updated 21 Sep

Post by Forboding Angel »

btw this widget breaks unit guarding.
Post Reply

Return to “Lua Scripts”