Page 1 of 3
NanoButtons Gadget - new version 1.1
Posted: 09 Oct 2007, 19:20
by BigHead
All new buttons visible and enabled:
Changelog 1.0 -> 1.1
- new Attack ON/OFF button
- buttons can be hidden
- AIs have all options set to ON by default
- Repeat is back
- cancels Guard order if unit is out of range
- much faster (nano updates are spread among 32 frames instead of 1)
Changes to UI:
This gadget hides maneuver, patrol, fight and repeat buttons and adds four new ones:
Attack ON/OFF - Attacks units with lowest maxHP first.
Repair ON/OFF - Repairs most damaged units first
Reclaim ON/OFF - Reclaims most expensive corpses/features first (eg: commander).
Assist ON/OFF - Auto-assists
both factories and new buildings
Features:
- 4 new buttons - described above
- Inteligent priority management - described above
- does not override your commands - nano is controled only if idle
-
Repair and reclaim are ON by default - nano turret is a turret and turrets operate automatically. Try it - it's really cool. Besides repairing and reclaiming cost you nothing (unlike assisting). This can be changed easily by modifying defaultRepair = ON to OFF.
- doesn't reclaim allied dragon teeths etc.
- cpu friendly
Recommended settings:
Repair - ON and visible. Unfortunately there's no way to prevent nanos from repairing units that are being reclaimed. Otherwise there'd be no reason to leave it visible.
Reclaim - ON and visible.
Assist - OFF and visible.
Attack - OFF and hidden. I think this should be left to players skill.
Pro tip:
Hold shift when clicking on a button to switch all buttons with one click.
Edit:
The bad:
Auto-repair repairs units being reclaimed. I was unable to find any suitable call-out. It's possible to do but it would have an impact on performance. Unless trepan comes into this thread and says something like "lua has been able to do so for a very long time" I can't do anything about it.
Notes:
- It's simply cool

- If you're not a modder and just want to test it see
this thread for help on using gadgets.
Download:
http://www.unknown-files.net/3700/NanoButtonsGadget_11/
Posted: 09 Oct 2007, 19:34
by MelTraX
What's so bad about the ImmobileBuilder widget that comes with Spring?
Maybe it could prioritize better but that's all I can think of..
Posted: 09 Oct 2007, 19:39
by BigHead
I don't remember me saying it's bad. This gadget wasn't created to replace that widget. It's purpose is to remove commands that have no sense for a static non-combat unit and replace them with a single button which does what you would expect it to do.
Posted: 09 Oct 2007, 19:44
by MelTraX
Ah, I see.. So this is another step towards your more user-friendly Spring? You have my full support then

..
Btw, would it be okay, if I integrate some stuff of your help system into IceUI? I don't really know if it's possible but my initial goal with IceUI was that all GUI stuff would be handled by it so that the player doesn't have to cope with different window systems.. I know, though, that IceUI isn't ready for that yet..
Posted: 09 Oct 2007, 19:47
by BigHead
Of course you can. You might want to play with the drawFrame() function to make the widget follow your window preferences.
Posted: 09 Oct 2007, 19:52
by imbaczek
ideally nanos shouldn't repair stuff that's being reclaimed, guess you could do this too while you're at it. that's one thing immobilebuilders doesn't cover and it sucks when auto-upgrading mexes.
Posted: 09 Oct 2007, 19:59
by BigHead
Now I understand why people got confused. The name of the gadget suggests that nano towers will automatically relaim/repair stuff ... I'll change it :)
imbaczek: I'm not sure if that can be done without a performance impact but I'll try.
Posted: 09 Oct 2007, 20:26
by TechnoTone
imbaczek wrote:ideally nanos shouldn't repair stuff that's being reclaimed, guess you could do this too while you're at it. that's one thing immobilebuilders doesn't cover and it sucks when auto-upgrading mexes.
I think that's more of an engine issue than one for a Lua widget/gadget to handle.
Posted: 09 Oct 2007, 20:34
by BigHead
TechnoTone wrote:I think that's more of an engine issue than one for a Lua widget/gadget to handle.
Good point, maybe it's the patrol command that needs improving. Unit under the patrol command shouldn't repair units being reclaimed generally.
Posted: 09 Oct 2007, 20:38
by SinbadEV
Hidden function of a nano-tower's patrol function is that if you give it a patrol order it will automatically repair/reclaimgarbage/help anything in range... at least it used to be...
If you're messing with the interface already having "Auto-Repair" "Auto-Reclaim" "Auto-Assist Build" and "Auto attempt to reclaim enemies in range" as toggles would be teh awsomes... also getting it to reject build orders that are out of range automatically would be keen.
Posted: 09 Oct 2007, 20:48
by BigHead
Hidden function of a nano-tower's patrol function is that if you give it a patrol order it will automatically repair/reclaimgarbage/help anything in range... at least it used to be...
... and exactly that function will be used by this gadget. I meant other functions than the patrol one when I asked :)
I can see the use for having 3 sepparate "Auto-Repair" "Auto-Reclaim" and "Auto-Assist Build" buttons I'm just not sure if I really want them :)
"Auto attempt to reclaim enemies in range" - This needs a broader discussion. I personally think that it shouldn't be automatized.
Posted: 09 Oct 2007, 21:12
by lurker
A question about the immobilebuilders widget. Am I right in thinking that it allows you to insert orders with shift only because one of the patrol points is exactly on the unit? Because if I reset a nanoturret's order queuem unless I zoom way in and precisely place a patrol point right on top of it, it will never get past the patrol command to other commands again. And I really think that should be changed if I have it right. If it seems so I'll look for the relevant code later.
Posted: 09 Oct 2007, 21:24
by TechnoTone
lurker - the ImmobileBuilders widget gives them a patrol point slightly north-east of their current position. I don't know about shift-clicking to insert orders, I just give my own order then shift-click a patrol order if I want to tell them what to do.
BigHead - I sometimes use the Repeat command to force them to repair or reclaim an area repeatedly. Perhaps you could do a similar thing to implement the toggles that SinbadEV mentions by switching on repeat and then adding a queue with the enabled actions over the area of the nano-tower. For this to work though you'd need to know the nano-range - is that retrievable from LUA? If you could do this it would be pretty sweet!
Posted: 09 Oct 2007, 21:34
by BigHead
If you could do this it would be pretty sweet!
It's possible - unitDef.buildDistance
Posted: 09 Oct 2007, 21:35
by lurker
TechnoTone wrote:lurker - the ImmobileBuilders widget gives them a patrol point slightly north-east of their current position.
The only time I have ever been able to replicate the behavior of the widget is with a patrol point on the exact coordinates of the nanoturret, and a second off of it. Yes it does place one away from it, but is that all it does? If so, why is it so hard for me to get the behavior I want?
Posted: 09 Oct 2007, 21:37
by TechnoTone
Here's the relevant code:
Code: Select all
local function SetupUnit(unitID)
-- set immobile builders (nanotowers) to the ROAM movestate,
-- and give them a PATROL order (does not matter where, afaict)
local x, y, z = Spring.GetUnitPosition(unitID)
Spring.GiveOrderToUnit(unitID, CMD.STOP, {}, {})
Spring.GiveOrderToUnit(unitID, CMD.MOVE_STATE, { 2 }, {})
Spring.GiveOrderToUnit(unitID, CMD.PATROL, { x + 25, y, z - 25 }, {})
end
Posted: 09 Oct 2007, 21:42
by lurker
TechnoTone wrote:Here's the relevant code:
Code: Select all
local function SetupUnit(unitID)
-- set immobile builders (nanotowers) to the ROAM movestate,
-- and give them a PATROL order (does not matter where, afaict)
local x, y, z = Spring.GetUnitPosition(unitID)
Spring.GiveOrderToUnit(unitID, CMD.STOP, {}, {})
Spring.GiveOrderToUnit(unitID, CMD.MOVE_STATE, { 2 }, {})
Spring.GiveOrderToUnit(unitID, CMD.PATROL, { x + 25, y, z - 25 }, {})
end
WTF
Posted: 09 Oct 2007, 21:47
by BigHead
Please use private messages or start a new thread for offtopic chat :)
Posted: 10 Oct 2007, 00:13
by LordMatt
MelTraX wrote:Ah, I see.. So this is another step towards your more user-friendly Spring? You have my full support then

..
Btw, would it be okay, if I integrate some stuff of your help system into IceUI? I don't really know if it's possible but my initial goal with IceUI was that all GUI stuff would be handled by it so that the player doesn't have to cope with different window systems.. I know, though, that IceUI isn't ready for that yet..
MelTraX please make it optional, I like to have all of the buttons that have some functionality for the unit (I can think of using repeat for a nanotower sometime) available.
Posted: 14 Oct 2007, 20:28
by BigHead