Page 1 of 1

Trigger "buildiconsfirst"

Posted: 24 Oct 2008, 00:42
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.

Re: Trigger "buildiconsfirst"

Posted: 24 Oct 2008, 00:58
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.

Re: Trigger "buildiconsfirst"

Posted: 24 Oct 2008, 14:26
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.