Page 1 of 1

The question thread

Posted: 13 Aug 2010, 09:12
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?

Re: The question thread

Posted: 14 Aug 2010, 15:58
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.

Re: The question thread

Posted: 14 Aug 2010, 17:33
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}, {})

Re: The question thread

Posted: 14 Aug 2010, 19:15
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. :)