Checking whether an order was directly issued by player

The place to discuss scripting and game modifications for X4: Foundations.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

azaghal
Posts: 438
Joined: Wed, 21. Mar 07, 13:19
xr

Checking whether an order was directly issued by player

Post by azaghal »

Is there any way to detect via standard (-ish) modding API whether a particular order in the ship queue has been issued manually by the player?

For some context, currently I am playing with the Report current status mod enabled, and have started to look into whether I could make it always report status for the final manually-issued order in the queue (so only if it has been explicitly issued by a player). The idea behind this is to make manual ship management and reporting a bit smoother by not having to mess with the order parameters at all times. Some of the use-cases I have for this are:
  • Explorer ships, and wanting them to report back to me once they have gone through all the queued commands.
  • Helper ships that I might use for (manual) mining and courier missions (like tell the scout to dock at mission destination, get notified, then hop over to take care of walking sim mechanic).
  • Taking specific ships out of trouble by having them dock at friendly station until the hostiles are gone (tell them to dock, continue on with my activity, get notified that they are docked, then I can check if it is safe for them to go back to their duty).
  • Transport ships that are taking care of various missions or manual ware transfers or sales (particularly early game when you queue up a bunch of trade commands, and want to get notified once the ships are idle once more).
azaghal
Posts: 438
Joined: Wed, 21. Mar 07, 13:19
xr

Re: Checking whether an order was directly issued by player

Post by azaghal »

So, to answer my own question (and for anyone who might be wondering the same), the game does not seem to expose the required parameter through the (Mission Director) XML scripting language. The Lua bindings (FFI's or whatever) do seem to support an additional parameter for marking the order as auto-generated, and this is what seems to be used inside of Lua code (there are references to istemporder in the Order struct, and FFI function for creating order that lets you defined order as temporary (in the map_menu.lua):

Code: Select all

uint32_t CreateOrder3(UniverseID controllableid, const char* orderid, bool defaultorder, bool isoverride, bool istemp);
Too bad - would be nice if MD supported setting this in some shape or form as well.

P.S.
As a side-note Mycu ended up implementing the feature I was interested in the Report current status mod, so here's a shout-out for that :)
User avatar
ChemODun
Posts: 634
Joined: Mon, 12. Feb 07, 21:58
x4

Re: Checking whether an order was directly issued by player

Post by ChemODun »

Temporary orders - yes, I agree, it's mostly not generated by player.
But if order is not temporary, it is not mean that it is not generated by scripts ... unfortunately
Multiply entropy by absolute zero

Freedom in space

Return to “X4: Foundations - Scripts and Modding”