gromit190 Posted January 13, 2017 Share Posted January 13, 2017 Hi, I'm trying to read out the current task of an AI group. I've the Controller for it, but I can't see a way to read the tasks for this controller (doc). I can only see how to set it, not get it. local controller = Group.getByName("SomeGroup"):getController() controller:getTheTasksOrSomething() Anyone tried this before? Autonomous ground AI project Link to comment Share on other sites More sharing options...
Stonehouse Posted January 13, 2017 Share Posted January 13, 2017 Someone else may give you a better answer but looking through a _G dump from about 6 months ago you seem to be only able to set the task and not interrogate the controller to find out what it's current task is. There is hasTask but I think that is a Boolean to determine whether they have one or not. Is there another way of looking at it? ie spawn them with the appropriate task and then when an event/trigger condition happens give them a new one linked to the event? Otherwise you might need to have a table to record the task they are spawned with and then update it when they are given a new one. Probably worth doing a new _G dump using mist (see mist.debug.dump_G) ["Controller"] = table: 0000000061537EC0 { ["Controller"]["isTargetDetected"] = "function: 0000000061538410, C function", ["Controller"]["pushTask"] = "function: 00000000615380A0, C function", ["Controller"]["__eq"] = "function: 000000006153D1D0, defined in (24-30)", ["Controller"]["popTask"] = "function: 0000000061538140, C function", ["Controller"]["className_"] = "Controller", ["Controller"]["getDetectedTargets"] = "function: 00000000615384B0, C function", ["Controller"]["setTask"] = "function: 0000000061537F10, C function", ["Controller"]["resetTask"] = "function: 0000000061538000, C function", ["Controller"]["setOption"] = "function: 0000000061538280, C function", ["Controller"]["__index"] = table: 0000000061537EC0 already defined: ["Controller"], ["Controller"]["setCommand"] = "function: 00000000615381E0, C function", ["Controller"]["Detection"] = table: 0000000061538370 { ["Controller"]["Detection"]["VISUAL"] = 1, ["Controller"]["Detection"]["DLINK"] = 32, ["Controller"]["Detection"]["OPTIC"] = 2, ["Controller"]["Detection"]["RWR"] = 16, ["Controller"]["Detection"]["IRST"] = 8, ["Controller"]["Detection"]["RADAR"] = 4, }, ["Controller"]["__tonumber"] = "function: 000000006153D2C0, defined in (48-50)", ["Controller"]["__lt"] = "function: 000000006153D270, defined in (40-46)", ["Controller"]["parentClass_"] = table: 000000006153D360 already defined: ["Unit"]["parentClass_"]["parentClass_"], ["Controller"]["tonumber"] = "function: 000000006153D310, defined in (52-54)", ["Controller"]["__le"] = "function: 000000006153D220, defined in (32-38)", ["Controller"]["hasTask"] = "function: 0000000061538190, C function", ["Controller"]["setOnOff"] = "function: 0000000061537F60, C function", ["Controller"]["__newindex"] = "function: 000000006153D3B0, defined in (63-65)", ["Controller"]["knowTarget"] = "function: 0000000061538550, C function", }, Link to comment Share on other sites More sharing options...
gromit190 Posted January 19, 2017 Author Share Posted January 19, 2017 Thanks for the reply. Even though it seems we can't figure out which tasks the group currently have, all I really need is to know if the group is stopped or not. To do that I'm simply compare the position of a unit in the group over a small time. I've got what I need for now. Autonomous ground AI project Link to comment Share on other sites More sharing options...
sunski34 Posted January 19, 2017 Share Posted January 19, 2017 Hi, the best way is to record tasks when setting them with controler. Regards Sunski Link to comment Share on other sites More sharing options...
gromit190 Posted January 20, 2017 Author Share Posted January 20, 2017 Hi, the best way is to record tasks when setting them with controler. Regards Sunski Thanks! But even then, would you be able to tell which task is active for the group? If you assign three tasks to the group, how would you read out the current state? Autonomous ground AI project Link to comment Share on other sites More sharing options...
nbolton Posted August 27, 2020 Share Posted August 27, 2020 FYI, hasTask always returns true even when the task wasn't set correctly (at least when sending a FireAtPoint task to an MLRS M270). The fix for this seems to be to call setTask with a 1 second wait time. Link to comment Share on other sites More sharing options...
Recommended Posts