Release: Smart Select

Release: Smart Select

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

Moderator: Moderators

User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Release: Smart Select

Post by aegis »

Smart Select:
Selects units as you drag the selection rectangle over them and provides realtime selection filters.

http://www.youtube.com/v/5Bgu-3qwR0I

Supported modifier keys:
  • Ctrl: selection rectangle subtracts from existing selection
  • Shift: selection rectangle adds to existing selection
  • Alt: filter selection to only non-builder mobile combat units
  • Space: filter selection to only idle units
  • Z: filter selection to only already-selected unit types
Changelog:
1.0:
  • initial release
1.1:
  • minimap selection now supported
  • removed bug where you were able to select by click+dragging the mouse with a command active
1.11
  • fixed single click selection bug
1.12
  • fixed clicks blocked by other widgets causing units to be selected
1.13
  • no longer select buildings with weapons when alt is held
1.14
  • added lookup table to greatly improve performance when filtering combat units on large selections
1.2:
  • added Z meta key - when held, it filters new selections to only include currently selected unit types. it stacks with shift and alt.
  • when dragging a selection over both mobile units and buildings, just select the mobile units (not the buildings) unless shift is held
  • added options for both of the above additions a config section at the top of the widget file - selectBuildingsWithMobile and sameSelectKey
  • added selection box drawing on map when selecting through minimap
  • fixed minimap selection over sky
  • fixed flickering with some selection types and UnitShapes
1.21:
  • added support for dualscreen minimap
1.22:
  • added support for TraceScreenRay sky patch
1.3:
  • ctrl no longer subtracts from selection when you start with no units selected. this makes it possible to be holding ctrl to assign a unit group while you are dragging to select units
  • widget now works for spectators
1.35:
  • if filters reduced the selection to nothing, now select nothing instead of everything in the box.
  • added an idle unit filter, bound to the space key by default. this removes stationary non-builders and any other mobile or builder unit with orders queued from the potential selection.
1.36:
  • possibly fixed a bug very rarely causing single clicks to fail to select units
TODO:
  • I'm open to suggestions
Attachments
unit_smart_select.lua
(11.3 KiB) Downloaded 153 times
luckywaldo7
Posts: 1398
Joined: 17 Sep 2008, 04:36

Re: Release: Smart Select

Post by luckywaldo7 »

Awesome widget is awesome <:
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Release: Smart Select

Post by aegis »

released 1.1 with minimap selection and a bug fixed.
User avatar
very_bad_soldier
Posts: 1397
Joined: 20 Feb 2007, 01:10

Re: Release: Smart Select

Post by very_bad_soldier »

Adding/removing single units by left-clicking does not work when this is active.
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Release: Smart Select

Post by aegis »

I'll fix that now, seems I broke it in the last update
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Release: Smart Select

Post by aegis »

released 1.11 with TFC's bug fixed

next step is figuring out how to track offscreen selection position on camera angle change without using the terrain as reference point... because TraceScreenRay to terrain does nothing when there's no terrain there.

then I'll make selecting in minimap show a white selection box on terrain
Satirik
Lobby Developer
Posts: 1688
Joined: 16 Mar 2007, 18:27

Re: Release: Smart Select

Post by Satirik »

in photoshop alt = remove from selection and shift add to selection
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Release: Smart Select

Post by aegis »

I know, but in default spring alt does nothing and ctrl inverts selection iirc
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Release: Smart Select

Post by aegis »

bugfix release 1.13:
fixes units being selected when you click on other widgets
fixes buildings with weapons being selected when alt is held
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Release: Smart Select

Post by Forboding Angel »

Image
User avatar
Niobium
Posts: 456
Joined: 07 Dec 2008, 02:35

Re: Release: Smart Select

Post by Niobium »

You should merge the functionality of 'Z selector' into this widget (When Z is held, only units types that existed in original selection are selected), should be easy as its very similar to your combat filter. Good work btw
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Release: Smart Select

Post by aegis »

ah yeah that shouldn't take very much code... right now I'm working on a better way to calculate the original selection point (right now it depends on terrain, so doesn't work if you start your selection in the sky)

I'll see about Z after I get this done
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Release: Smart Select

Post by aegis »

1.2 released:
  • added Z meta key - when held, it filters new selections to only include currently selected unit types. this stacks with shift and alt.
  • when dragging a selection over both mobile units and buildings, only the mobile units are selected (not the buildings) unless shift is held
  • added options for both of the above additions a config section at the top of the widget file - selectBuildingsWithMobile and sameSelectKey
  • added selection box drawing on map when selecting through minimap
  • fixed minimap selection over sky
  • fixed flickering with some selection types and UnitShapes
1.21 fixes dualscreen minimap selection
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Release: Smart Select

Post by aegis »

1.22 released:
added support for this patch to allow TraceScreenRay in sky, which allows realtime selection when the selection rectangle originates in sky as well as ground

just needs dev approval and a new version of spring released before it's fixed ;)

anybody have any suggestions for sweet new features to add or functionality I should refine? I'm open to implementing anything awesome, even if it takes a bit of work.

I was thinking it'd be possible to extend this to area commands as well... I could start with area reclaim, and hook smart area reclaim into this
so dragging your area reclaim would highlight what it was you were going to reclaim, hotkeys could modify for metal/energy/both, and it could have similar behavior to current smart_area_reclaim widget except highlighting features in realtime like this selection engine
(I even know how to implement drawing a real area reclaim command in the middle of the queue now... so I can do smart_area_reclaim without command spam too)
UAF
Posts: 96
Joined: 02 Jan 2008, 19:25

Re: Release: Smart Select

Post by UAF »

Holding shift while clicking a selected unit does not deselect it from the group. This is normal RTS behavior.
I suspect this widget would do it with ctrl, but I still keep trying with shift because that's how it works in most games...
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Release: Smart Select

Post by aegis »

when you click a single unit, this widget doesn't do anything. this widget only kicks in when you drag your mouse. spring has always used control for that.
Satirik
Lobby Developer
Posts: 1688
Joined: 16 Mar 2007, 18:27

Re: Release: Smart Select

Post by Satirik »

aegis wrote:I know, but in default spring alt does nothing and ctrl inverts selection iirc
the default spring works like the selection in windows explorer ... you're making a photoshop like selection, you should use their keys
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: Release: Smart Select

Post by aegis »

*sigh* I'll make it configurable at the top of the widget :P the current buttons (ctrl/shift) were closer to spring's defaults though (ctrl just deselects now instead of fully inverting selection... I made this change because there was no good way afaik to deselect a chunk out of a big section of mixed selected/deselected units)
klapmongool
Posts: 843
Joined: 13 Aug 2007, 13:19

Re: Release: Smart Select

Post by klapmongool »

Hmm, sounds nice. I'm having some problems getting it to work though (and im a lua noob/normal user). The functions described above don't work, yet when the widget is enabled the normal keys Do I have to add the keys i want to use in? In the user config section?
User avatar
Gota
Posts: 7151
Joined: 11 Jan 2008, 16:55

Re: Release: Smart Select

Post by Gota »

definitely add the reclaim thing you offered,sounds very convenient.
Post Reply

Return to “Lua Scripts”