132nd-vWing / OPBR-Brief

Operation Black Rain - Brief and projectpage
0 stars 0 forks source link

Lua-wrapper for dispatching new tasks to the website ATO #19

Open jkhoel opened 5 years ago

jkhoel commented 5 years ago

I think it will be a good idea to write a wrapper that can be used in the various scripts whenever one wants to create a new mission on the ATO.

It should be something like this:

AtoTaskDispatcher(Type as String, Description as String, Coordinates as List)

Where the Type would have to match a type in the list_missiontypes database list, Description would be a free line of text and Coordinates would be an optional array of XYZ coords.

The wrapper should then send the required formatted HTTP request to the API endpoint so that a new task will be created on the ATO for the next cycle

jkhoel commented 5 years ago

Example:

AtoTaskDispatcher("CAS", "IN SUPPORT OF TF SWORD, CONTACT JTAC WARLOC ON PURPLE12. EXPECTED TARGETS: LAVs AND INFANTRY", [1234,1234,0]
jkhoel commented 5 years ago

LUA Classes

AtoDispatcher:createTask("CAS", "IN SUPPORT OF TF SWORD, CONTACT JTAC WARLOC ON PURPLE12. EXPECTED TARGETS: LAVs AND INFANTRY", [1234,1234,0])

Would probably be more correct in terms of LUA.

The function should return the task id or perhaps a task object for later reference:

AtoDispatcher:getTask(taskID) returns type, desc, coords
AtoDispatcher:updateTask(taskID, description, coords) returns the HTTPrequest code or nil
AtoDispatcher:deleteTask(taskID) returns the HTTPrequest code or nil
thebgpikester commented 5 years ago

Definitely a good idea. No idea about writing a class, i'm just a hack. But this is definitely a reusable piece of code that would be a key component going forward.