Blocked in <run_script/>?

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

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

Post Reply
Vectorial1024
Posts: 224
Joined: Mon, 30. Jul 18, 04:16
x4

Blocked in <run_script/>?

Post by Vectorial1024 » Wed, 7. Aug 19, 19:02

Hey there,

I;m developing a mod, and I decided to use <run_script/> as a substitute for the MD <include_actions/> stuff in the AI-script context. However, once I load my mod, I keep getting this error:

Code: Select all

[=ERROR=] 129852.71 Error on AI director import: Script context order.dock on entity 0x15cf6 'Idmanckuttall' is blocked in run_script but no called script is running
The approx way I want my mod to work is that
  • I make an aiscript called "foo"
  • I patch orders.dock.xml so when a ship docks, it <run_script/>'s "foo"
  • "foo" is executed, and returns a value
  • orders.dock regains control and handles the result from "foo"
However, it seems that this approach does not work, as this will magically jam ships attempting to dock in midair, their icons glitching and vibrating on the map.

Any ideas?
The future awaits.

X4 Foundations mods:
Civilian Fleets: Managing your civilian ships has never been easier.
Station Logistics: Managing your station networks has never been easier.
Scrap Delivery Coordination: No more starving scrap processors.

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Re: Blocked in <run_script/>?

Post by UniTrader » Wed, 7. Aug 19, 19:32

short explanation of blocking actions:

in short blocking actions are commands in a script which take time to perform (like wait, move_* or run_script - anything which can have a sinceversion attribute). they are also the points in a script where the script state might be saved, and in the savegame you will only find the info what type of blocking action the script was and what number it was. So if you add or remove Blocking Actions you will mess up the whole logic in the game because you randomly jump forward or backward in it.

To resolve this you have to increase the Version Number in the root node (its assumed to be 1 if not defined) and mark all your new Blocking Actions with a sinceversion="##". Also you cannot remove a blocking action, rather you have to skip it by adding a chance="0" attribute (so its still present, but the game will always skip it)
The only problem is that this also might open a can of worms, because if Ego ever decides to change a Script your users will have problems. My suggestion to avoid this as much as possible is to keep your changes small (for example redirect an early run_script to a wrapper script which calls the original function and then your new or copied and modified code so you dont have to worry about such interference)
if your script is removed the game will just return to the original call you replaced


ALL THAT ASIDE I THINK YOUR ACTUAL ISSUE IS: (only noticed after a second read) you just named the Script to call rather than passing it as string, or resulting in a string, so the game tries to run a null script (the call should look like <run_script name="'foo'" …… and you likely didnt put the required ' ' there)
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

Vectorial1024
Posts: 224
Joined: Mon, 30. Jul 18, 04:16
x4

Re: Blocked in <run_script/>?

Post by Vectorial1024 » Wed, 7. Aug 19, 20:37

I double checked, it's definitely not the ' ' issue.

Had several ships standing by before I activated the mod in one of my test saves. I order them to dock: no problem, they dock, and undock smoothly with no problems. And I look at my other ships that were doing AutoTrade at that time: all stopped working and stood there mid-air when they tried to dock.

So the script has no logic problems. Just that things get complicated when I try to apply the code.

Guess I just need to port everything back to MD scripts then. Having a sinceversion hack is not quite sustainable, now that EgoSoft is gonna push v3.0 soon. And the MD system seem to be more "fault-tolerant", if you know what I mean.
The future awaits.

X4 Foundations mods:
Civilian Fleets: Managing your civilian ships has never been easier.
Station Logistics: Managing your station networks has never been easier.
Scrap Delivery Coordination: No more starving scrap processors.

Post Reply

Return to “X4: Foundations - Scripts and Modding”