The question thread

The question thread

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

Moderator: Moderators

Post Reply
User avatar
Hobo Joe
Posts: 1001
Joined: 02 Jan 2008, 21:55

The question thread

Post by Hobo Joe »

So, I'm just getting into LUA, learning what I can from mixed tutorials, guides, and wikis. But inevitably along the way I'm gonna have questions that are a little harder to answer myself (I'm sure other people will too). So here's where we can all ask random lua questions. I'd appreciate any help.

So my question right now is, how can I use Spring's area command(a la area reclaim etc) for my own widget?
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: The question thread

Post by knorke »

So my question right now is, how can I use Spring's area command(a la area reclaim etc) for my own widget?
no idea but maybe look at a widget that does something similiar and see if you can figure it out. for example the "factory guard" widgets makes builders guard factorys (orly) by giving them waypoints...i am sure giving reclaim commands is done in a similiar way.
So here's where we can all ask random lua questions
Thats fail i think. I hate megathreads like http://springrts.com/phpbb/viewtopic.php?f=14&t=7571 because they are impossible to browse, search and any information in them is lost. Better have specific threads with good titles.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: The question thread

Post by jK »

Hobo Joe wrote:So here's where we can all ask random lua questions.
I like the idea. makes answering questions much easier, also there are quite less real lua questions in this forum, so perhaps a thread like this may be able to change this.
Hobo Joe wrote:So my question right now is, how can I use Spring's area command(a la area reclaim etc) for my own widget?
That's easy. See the wiki:
http://springrts.com/wiki/Lua_CMDs#CMD.RECLAIM
-> CMD.RECLAIM is type of CMDTYPE.ICON_UNIT_FEATURE_OR_AREA
CMDTYPE.ICON_UNIT_FEATURE_OR_AREA
expect 1 parameter in return (unitid or Game.maxUnits+featureid)
or 4 parameters in return (mappos+radius)
So instead of giving the featureid, just give the mappos + the radius,
i.e. Spring.GiveOrderToUnit(unitID, CMD.RECLAIM, {mapx,mapy,mapz,radius}, {})
User avatar
Hobo Joe
Posts: 1001
Joined: 02 Jan 2008, 21:55

Re: The question thread

Post by Hobo Joe »

jK wrote:
Hobo Joe wrote: That's easy. See the wiki:
http://springrts.com/wiki/Lua_CMDs#CMD.RECLAIM
-> CMD.RECLAIM is type of CMDTYPE.ICON_UNIT_FEATURE_OR_AREA
CMDTYPE.ICON_UNIT_FEATURE_OR_AREA
expect 1 parameter in return (unitid or Game.maxUnits+featureid)
or 4 parameters in return (mappos+radius)
So instead of giving the featureid, just give the mappos + the radius,
i.e. Spring.GiveOrderToUnit(unitID, CMD.RECLAIM, {mapx,mapy,mapz,radius}, {})

Thanks a lot! I checked the wiki, but I missed that somehow.


@ knorke it's not meant to be something you browse through to find random answers, but somewhere you ask and it gets answered specifically. If we're lucky things that aren't in the wiki that are answered will be put there afterwards. :)
Post Reply

Return to “Lua Scripts”