healthbars widget (v7) *Jan. 4 08* - Page 2

healthbars widget (v7) *Jan. 4 08*

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

Moderator: Moderators

User avatar
Neddie
Community Lead
Posts: 9406
Joined: 10 Apr 2006, 05:05

Post by Neddie »

It should only be shown when the two differ, logically...
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Post by jK »

new version :idea:
User avatar
BrainDamage
Lobby Developer
Posts: 1164
Joined: 25 Sep 2006, 13:56

Post by BrainDamage »

file broken, here it tries to download "download.php" instead of the widget

EDIT: now works
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

I can not use this widget (latest version) because it take 10 to 20 seconds to initialize here, which often times me out during loading.

If, in Initialize, I comment this out, it loads instantly:

Code: Select all

  if (UnitDefs[1].height == nil) then
    for udid, ud in ipairs(UnitDefs) do
      ud.height = Spring.GetUnitDefDimensions(udid).height+20
    end
  end
I take it this triggers Spring to load all unit models.

Any chance you could make it lazy load these heights so it initializes within reasonable time?

(This is on Win XP Prof SP2 on an AMD 3200+ @ 2 GHz, 1G RAM, 7600 GT)

EDIT: tested with XTA v9 mod on Bluebend map.
Last edited by Tobi on 23 Aug 2007, 23:54, edited 1 time in total.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Moreover, can't modders put height specifications into 3DO models now? I could have sworn that was possible.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Post by jK »

I already surround it with "if (UnitDefs[1].height == nil)", so it is only executed once (multiple widgets need this code). I don't like lazy loads, but I already thought about to spread the work on multiple gameframes. And you aren't the first, who complained about timeouts/long loading times, but 10-20secs are WOW, normally it should take 2-3secs.

Btw, in the next Spring release the loaded variable should be directly provided by the engine, so we wouldn't need that code anymore >_>

PS: the newest release should be bug free <_<
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Cool, I will be testing it shortly.

Hrmm... question...

If two Widgets exist (oh, say... if I bundled my mod with this Widget)... and I changed something (oh, say, I made the length of the delay more than 5 seconds)... what will happen?

Crash? Two Widgets both running the same code, simultaneously? Will my Widget take precedence over a user's version?
MelTraX
Posts: 470
Joined: 02 Jan 2007, 16:18

Post by MelTraX »

I'm pretty sure the users widget will just overwrite the mod widget with the same name..
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

That's better than a crash, and it requires a user to have installed their own Widget, to boot, which I suspect most don't. I can live with that.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

<tries it>

Hmm. It works for me, and I think it's fine, even with the stuff that isn't strictly necessary. Not bad at all. A little bit bigger than is maybe ideal, but if that is the only thing I can find to whine about, then it must be pretty good ;)

Only real trouble is that I need to re-adjust all the heights of my S3Os, to keep it well above the units... and that causes it to clip into my NanoBlobs-style teamcolor dots. Which, as we all know, I'm not terribly attached to.

I don't suppose that I could get an alpha, teamcolored icon, just above the rest of this? Just a very small square one- nothing very large- it'd replace the teamcolor dots.

Then I'd be pretty much feature-complete, for what I'd like players to see, between this and other stuff that's already available, and I'd be all done with the teamcolor thing, unless I change my mind and add it to the S3Os... or get the dynamic-icon thingy, which I have described so vaguely that I'm not surprised there's been no interest.

<ducks objects thrown by grumpy coders> Sorry... just... uh, that one thing? It'd mean I could cut a fairly high-poly Piece out've every model, among other benefits...
User avatar
Pendrokar
Posts: 658
Joined: 30 May 2007, 10:45

Post by Pendrokar »

Request: Can you make a bar for features/wrecages that show the remaining resources in % that are being reclaimed and if reclaiming has stopped in the middle of it then the bar should slowly hide(% var stays)?
It's good that there are no features or wrecages that have both M and E in em!
User avatar
REVENGE
Posts: 2382
Joined: 24 Aug 2006, 06:13

Post by REVENGE »

Pendrokar wrote:It's good that there are no features or wrecages that have both M and E in em!
What?

Look at the fortification walls in BA for wreckage, and the bigass rock in the middle of Sypor for a feature.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Post by jK »

Sorry, but this would slow down the widget as hell, already the health bars of fortification walls were a problem (I speeded it up now).
Also into my mind it is more an engine issue, because imo the wreckage model should bind to the ress and health of the wreckage (atm it is bind to health only).
User avatar
LordMatt
Posts: 3393
Joined: 15 May 2005, 04:26

Post by LordMatt »

The version on UF still gives the error:

Code: Select all

Failed to load: unit_healthbars.lua  (Include() could not load 'LuaUI/headers/billboard.lua'
)
in infolog.txt

Edit: Change "include('headers/billboard.lua')" to "include('Headers/billboard.lua')" for proper linux case compatability.
User avatar
ginekolog
Posts: 837
Joined: 27 Feb 2006, 13:49

Post by ginekolog »

this widget screwed up original health bars, even with disabled widget i could not see original health bars, so i had do delete it.

Its alsto a bit slow on mass of units... but on fast pc its very good.
User avatar
Pendrokar
Posts: 658
Joined: 30 May 2007, 10:45

Post by Pendrokar »

ginekolog wrote:this widget screwed up original health bars, even with disabled widget i could not see original health bars, so i had do delete it.

Its alsto a bit slow on mass of units... but on fast pc its very good.
disable and F9?
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Post by jK »

ginekolog wrote:this widget screwed up original health bars, even with disabled widget i could not see original health bars, so i had do delete it.

Its alsto a bit slow on mass of units... but on fast pc its very good.
It doesn't screw your original healthbars. Spring 75b2 has a typo, it doesn't initialize a value (which should be zero), so if your ram has something different than a zero at that position, you can't see any healthbars and some widgets don't work. The healthbars widget has a fix, so you always see the healthbars (even if the orig. don't work) and it was my first impulse to write this widget (I only get in <20% of all matches the orig. healthbars). So it is a fix for ppl who has this problem.

And the slow down with mass of units should be around ~15-20% (tested with 440 corsol), and it shouldn't slow down if there are less units on the screen.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

That and the widgets prettier and shows more data
User avatar
TheFatController
Balanced Annihilation Developer
Posts: 1177
Joined: 10 Dec 2006, 18:46

Post by TheFatController »

Is it possible to make the % text hide-able, I'm happy with just the graphical bars and really not too concerned what the numerical percent of health etc. is, so it would be a nice optional speed increase :)
User avatar
TechnoTone
Posts: 165
Joined: 23 Aug 2005, 22:02

Post by TechnoTone »

You can remove the text on the bars by changing line 35:

Code: Select all

local drawBarTitles = true
to

Code: Select all

local drawBarTitles = false

To remove the % values you'd have to change line 401:

Code: Select all

glDrawFuncAtUnit(unitID, true, DrawUnitInfos, unitID, height, true, canStockpile, reloadTime, primaryWeapon)
to

Code: Select all

glDrawFuncAtUnit(unitID, true, DrawUnitInfos, unitID, height, false, canStockpile, reloadTime, primaryWeapon)
and line 416:

Code: Select all

DrawFeatureInfos(featureID, 70, true, wx,wy,wz)
to

Code: Select all

DrawFeatureInfos(featureID, 70, false, wx,wy,wz)
Post Reply

Return to “Lua Scripts”