Trigger "buildiconsfirst"

Trigger "buildiconsfirst"

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

Moderator: Moderators

Post Reply
MelTraX
Posts: 470
Joined: 02 Jan 2007, 16:18

Trigger "buildiconsfirst"

Post by MelTraX »

I'd like to trigger buildiconsfirst (the action triggered by the page number button) through Lua and I have no idea if it's possible and if it is how I would do it.

My best guess is that it has to be given as an order to a unit but since it doesn't have a command ID I don't know how.

I hope I'm just dumb and it's really easy.

I could also bind it to a key with lua, select a unit, simulate that key, unselect and unbind but I didn't find a way to simulate keystrokes either and this wouldn't be exactly the cleanest solution.
Gnomre
Imperial Winter Developer
Posts: 1754
Joined: 06 Feb 2005, 13:42

Re: Trigger "buildiconsfirst"

Post by Gnomre »

This worked in 0.76, I haven't tried it in 77 but I don't see any reason why it'd have changed:

Spring.SendCommands({"buildiconsfirst"})

I don't know if it takes a param though, never tried it. It should be easy to bind it however.
MelTraX
Posts: 470
Joined: 02 Jan 2007, 16:18

Re: Trigger "buildiconsfirst"

Post by MelTraX »

Omg, I feel stupid... I just never tried the obvious because I thought SendCommands("foobar") only works if /foobar works, but I guess I was wrong.

Thanks, it works like a charm.
Post Reply

Return to “Lua Scripts”