Widget: IdleBuilder 2

Widget: IdleBuilder 2

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

Moderator: Moderators

chlue
Posts: 101
Joined: 28 Dec 2005, 20:48

Widget: IdleBuilder 2

Post by chlue »

I want to advertise the latest version of the IdleBuilders2 widget.
The original IdleBuilder is from Ray; see here.

Image Image Image

Some highlights:
- moddependent config stored in widget_data.lua
- ingame changing of config via Tweakmode (STRG+F11)
- premade config for EE 0.173 and BA 4.7

Interface:
F: Factories
M: MobileUnits
G: GuardingUnits
The number indicate how many units are in that category

Mouseclick on Unitpic:
Left: select
middle: select and center
right: send unit to assist nearst factory (on factories this does nothing) or assign a task defined by the rules in the config function.

Mouseclick on Button:
Left: toggle visibility of that category
middle: select nearst unit of that category
right: select radom unit of that category

Tweakmode:
Left: toggle ignorestate for this unitid. Select Unit
middle: select and center Unit
right: Hide from view for this seasson. The widget will max use 60% of screenwidth, so if you hide one, you see another one, if there are more units than place on the screen.

You can use this commands ingame:
/luaui autobuild <new time>
/luaui v_pos <new spacing from bottom>

Please report Bugs and Featurerequests here.
If you encounter a Bug giving an error msg please include the line from \Spring\infolog.txt

-- edit 23.07.2007
Lastest version is 2.3
Image
Last edited by chlue on 23 Jul 2007, 02:24, edited 1 time in total.
semi
Posts: 69
Joined: 30 Mar 2007, 20:42

Post by semi »

Feature request:

Instead of showing the same type of builder many times, show just one icon with a count. With that some way to cycle selection may be needed.

Then at least you would have a chance to see each different type of builder instead of a full width of level 1 kbot builders :)
EmMeister
Posts: 4
Joined: 18 Mar 2007, 07:08

Post by EmMeister »

Then at least you would have a chance to see each different type of builder instead of a full width of level 1 kbot builders :)
How many idle builders do you usually have?
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

Can you do some debugging? The script tends to flip out and kill Lua especially when you're speccing.
chlue
Posts: 101
Joined: 28 Dec 2005, 20:48

Post by chlue »

Damn I hoped it is errorfree.

Can you post the errors it drops in infolog.txt?

The only problem i am currenty aware is, that it can produce errors, if you spec a mod you have never played before. (So there is no stored config.) Using this widget when you are spec is probably useless anyway, so it would be better to disable it for that.

Easiest way to fix: (Line 154-159 in gui_idle_builders2.lua)

Code: Select all

154 function widget:Initialize()
155	local _, _, spec = Spring.GetPlayerInfo(Spring.GetMyPlayerID())
156	if spec then
157		-- widgetHandler:RemoveWidget()
158		return false
159	end
Simply remove the -- in line 157 and the widget will disable itself if you are spec.

Instead of showing the same type of builder many times, show just one icon with a count. With that some way to cycle selection may be needed.
I don't think this is usefull. If you have so much idle builders, than it is better to hide them by clicking on the green buttons on the left. The idea is, that you assign the builders you currently don't need to assist something. The third row keeps track of units who are assisting something (and are waiting), so there is an easy way to find them, if you need them again.
User avatar
NOiZE
Balanced Annihilation Developer
Posts: 3984
Joined: 28 Apr 2005, 19:29

Post by NOiZE »

When i want to hide the commander in a corner being cloaked, hold fire, hold position, it will start doing something so it will uncloak :(
chlue
Posts: 101
Joined: 28 Dec 2005, 20:48

Post by chlue »

Noize I am pretty sure, the widget will not do something with the normal config.

But if you set autobuild to a value other than 0, the widget will check idle units and after the idletime is over it will build some semirandom stuff. If you don't wan't this then edit the configfile and make sure there is some "IdleTime = 0" or just enter "/luaui autobuild 0" ingame.

If you never set this value, then you probably use my first release of this widget and should upgrade, to get the new features (stored moddependent ingame changeable config). My first release has "autobuild = 10" set.
User avatar
NOiZE
Balanced Annihilation Developer
Posts: 3984
Joined: 28 Apr 2005, 19:29

Post by NOiZE »

well i want the other units to autobuild stuff, if i am too busy, but not the commander.
Tim-the-maniac
Posts: 250
Joined: 22 Jul 2006, 19:58

Post by Tim-the-maniac »

Set him to wait (W)
User avatar
NOiZE
Balanced Annihilation Developer
Posts: 3984
Joined: 28 Apr 2005, 19:29

Post by NOiZE »

Tim-the-maniac wrote:Set him to wait (W)
that might do the trick, thanks.
User avatar
LordMatt
Posts: 3393
Joined: 15 May 2005, 04:26

Post by LordMatt »

In my opinion, autobuilding (aside from upgrading mex) steps over the line of good sportsmanship.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Post by Forboding Angel »

For TA maybe, not for EE or Fun:TA though. Those mods are designed to be very easy on the resourcing side.
User avatar
Dragon45
Posts: 2883
Joined: 16 Aug 2004, 04:36

Post by Dragon45 »

Generally a good practice is to have the builder icons be "stacked" (one picture with numbers on the picture to cycle) once there is some combination of too many builders or too many different types of builders.
User avatar
LordMatt
Posts: 3393
Joined: 15 May 2005, 04:26

Post by LordMatt »

Dragon you better come on the lobby and play when finals are over. OR ELSE! 8)
User avatar
ginekolog
Posts: 837
Joined: 27 Feb 2006, 13:49

Post by ginekolog »

This one does not work for me, so i still use rays script. When i deactivate rays and turn on yours, it just does nothing. No indication of idlers.

Doing sth wrong here?
chlue
Posts: 101
Joined: 28 Dec 2005, 20:48

Post by chlue »

ginekolog wrote:This one does not work for me, so i still use rays script. When i deactivate rays and turn on yours, it just does nothing. No indication of idlers.

Doing sth wrong here?
It's hard to give an advise to you with this information. You should look in your 'infolog.txt' file in your spring directory if there are any errors. If everything works right you should see some output like this:

Code: Select all

Modname: BA47.sd7
Dataset 1 : Expand_and_Exterminate_v_0.173.sd7
Dataset 2 : CvC 0.4.sd7
Dataset 3 : BA47.sd7
Dataset 4 : 1944publicalpha_v0.01b3h.sd7
Loading Dataset 3
Stored config detected and loaded
If you see any lua errors instead then post them here, please.

If there is something wrong with your config, you can try deleting the file '\LuaUI\Config\widget_data.lua'. If you do this you will lose at least the configuration of the widgets 'FPS' and 'Message Separator', too. So you should make a backup of this file if you use a lot of other widgets.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

I often disable the widget since I think it causes crashes and I haven't crashed out of midgame since I disabled it whereas previously I often crashed out during longer games. Since it sometimes happened when the enemy was destroying my base I think it may be related to destroyed units not being registered as such. It's pretty rare though, no idea how you can reproduce it.

Also once I had a crash when trying to make a builder patrol. It'd mess up its patrol queue (making the patrol return to its current position between patrol orders despite a move order being queued before the first patrol order), not move at all and after a while crash the game. Can't reproduce that one either.
chlue
Posts: 101
Joined: 28 Dec 2005, 20:48

Post by chlue »

KDR_11k wrote:I often crashed out during longer games. Since it sometimes happened when the enemy was destroying my base I think it may be related to destroyed units not being registered as such.

Also once I had a crash when trying to make a builder patrol.
KDR_11k do you use the autobuild stuff? The autobuildstuff is a bit strange in my opinion. It is writen by Ray and i don't really understand how it works and left it mainly untouched. It uses the varaibles 'idleTime' and 'iconunit' which get never deleted and iconunit gets updated only in 'widget:DrawScreen()'. So they may cause some problems in the 'widget:update()' function, expecially if the framerate drops under the simulationrate of 32? frames per second. Maybee you can try adding 'if iconunit == nill then break end' in the fourth line of the update function. But as I allready said, I don't really understand that part and I am not really familiar with tables and garbage collection.

But from my understanding it should be impossible to crash the game with a widget. the worst thing I encountered is the generation of so many error msg's, that the whole lua-stuff stops working and you get a huge infolog file. Maybee Trepan could add some enlightment here.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

I managed to stacktrace one of those crashes, it was caused by Lua. I've disabled the autobuild (changed that idletime variable or so) and played Gundam (which has no profile and no autobuildable stuff).
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan »

How about feeding those stacktraces to the devs? ;-)
(especially if you have already run them through the converter)
Post Reply

Return to “Lua Scripts”