Classed key bindings

Classed key bindings

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

Moderator: Moderators

Post Reply
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Classed key bindings

Post by trepan » 20 Sep 2006, 08:14

Another key binding feature has been added to SVN.
The bindunittype keyword can be used to bind a
keyset to a class of units that you define. You can
also setup the order that will be used to cycle through
the list of unit types that meet your requirements. Here
is an example:

http://trepan.homelinux.net/spring-diffs/advkeys.txt

P.S. That example file is my working test config, so
you'll have to excuse me if it's a little sloppy / incomplete.
The other feature demonstrated at the end of the file is the
positional icon access (using iconpos)
0 x

User avatar
LordMatt
Posts: 3393
Joined: 15 May 2005, 04:26

Post by LordMatt » 20 Sep 2006, 17:43

Please forgive my ignorance, but does that mean we could assign a key combination to select particular kinds of units (e.g. ctrl + alt + r selects all rockos on screen)?
0 x

User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Post by knorke » 20 Sep 2006, 19:39

// setup the build categories
keysym build_energy b3
keysym build_mex b2
keysym build_builder b1
keysym build_factory b0
I think its like hotkeys for buildings? Like you select a builder, press M and can place a Mex. No need for scrolling through the list.
0 x

User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh » 20 Sep 2006, 19:48

If nothing else, this oughtta be extremely useful to the AI folks. Cool :-)
0 x

trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan » 20 Sep 2006, 21:38

Yup, that's a fairly good description. It doesn't just work for builders
making buildings though, the same bindings also apply to factories
making units (ex: selecting an advanced kbot factory and hitting the
stealth binding will send out a spy bot).

Also note that the same mex build binding will produce a Moho mex
for adv builders, and a normal mex for simpler builders.
I think its like hotkeys for buildings? Like you select a builder, press M and can place a Mex
0 x

User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k » 21 Sep 2006, 08:24

How are the units assigned to the keys, e.g. how does Spring know what is a powerplant?
0 x

User avatar
FireCrack
Posts: 676
Joined: 19 Jul 2005, 09:33

Post by FireCrack » 21 Sep 2006, 08:51

KDR_11k wrote:How are the units assigned to the keys, e.g. how does Spring know what is a powerplant?
Things like this in the posted file

Code: Select all

bindbuildtype &build_energy {
  req    totalEnergyOut > 1.0
  sort   not needGeo
  sort   -minWaterDepth
  sort   techLevel
  sort   totalEnergyOut
}
0 x

User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Post by knorke » 21 Sep 2006, 22:32

Will you be able to "cycle" through the buildings?
Like Windmill, Tidal, Solar and Adv. Solar are bound to the same hotkey and by pressing "E" (for energy, example) you can switch..
0 x

trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan » 21 Sep 2006, 22:36

You could already cycle through the building types, this
classing system just makes it easier to setup the bindings.

The "sort" property in bindbuildtype determines the order
of the cycling.
0 x

Post Reply

Return to “Lua Scripts”