Standard sell ware script crashes

The place to discuss scripting and game modifications for X²: The Threat.

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

demner
Posts: 31
Joined: Sat, 13. Mar 04, 16:24
x3tc

Standard sell ware script crashes

Post by demner »

I have an infinite loop sell ware script that basically looks like this:

while 1
wait for 10000 ms
log #1, 'calling standard'
call script ship.cmd.sellware.std
log #1, 'finished standard'
end

This works 99.9% of the time, but occasionally the game hangs. I know it's this script since if I deassign all of my ships from it, the game never hangs.

When I look in the log, I see 'calling standard' and 'finished standard' lots of times (as expected - shows the script is working). But the last line in the log is always 'calling standard' (showing that the standard script is the last thing to be called before the hang).

It's difficult to tell exactly when the standard script crashes, but it appears to be when the supply station has 0 quantity (not often - maybe at the end of the factory cycle?).

Any suggestions? Is this a known bug?
User avatar
JustHere4Coffee
Posts: 1075
Joined: Wed, 6. Nov 02, 20:31
x2

Post by JustHere4Coffee »

for bug info/reporting, try the tech-support forum - except of course that scripting is unsupported

um... why do you need to have an infinite sell script anyway? and won't the constant re-calling of this script be interrupting your ship's trading runs? you're pausing 10 seconds between calls, last time I watched a ship i'd changed/reassigned a sellware command to, it took it 5 seconds just to get it's bearings and decide where to try and dock next! I'm assuming you're trying to always get the absolute top price for your wares, well if you keep making your ships stop en-route, then you're more likely to lose sales I'd have thought...
demner
Posts: 31
Joined: Sat, 13. Mar 04, 16:24
x3tc

Post by demner »

I did originally post this to the tech support forum, and now it says moved even though it's in the tech support forum... Strange.

Anyway, the reason I wrote this script was to try to sell to a trading station for max price (rather than let the trading station ships buy for max price). It didn't work, but in the meantime I noticed the buggy behaviour and figured I'd report it.
User avatar
JustHere4Coffee
Posts: 1075
Joined: Wed, 6. Nov 02, 20:31
x2

Post by JustHere4Coffee »

I wouldn't call this a bug in the program though ;) anyway, the scripting engine is officially unsupported so bug reports on it are unlikely to get much response from the techs :)

and it HAS been moved - the little thing that says "moved" redirected you to the scripting forum
demner
Posts: 31
Joined: Sat, 13. Mar 04, 16:24
x3tc

Post by demner »

The custom scripts may be unsupported, but the scripts provided by Egosoft (like the standard sell ware script) should be supported, even when a bug is found by the user scripting engine.

In fact, the custom scripting engine is probably a great place to stress test a standard script by doing pretty much exactly what I did.
User avatar
JustHere4Coffee
Posts: 1075
Joined: Wed, 6. Nov 02, 20:31
x2

Post by JustHere4Coffee »

let's be fair, it was your nonstandard use of the script that caused it to fold - if you put in infinite-loop detection the game would probably have kept going just fine, it was just you forcing it the script to run in situations it wasn't designed for that probably caused the lockup :D
demner
Posts: 31
Joined: Sat, 13. Mar 04, 16:24
x3tc

Post by demner »

But it isn't really a non-standard use - it's just called lots of times with 10 seconds between calls. It would be the same if I did it manually, but much less boring :D

The situation that causes the standard script to lock up obviously doesn't happen very often because it took multiple ships running the script for a medium term period of time for the lockup to occur. But that implies that in rare cases the standard script does crash, and it would probably crash if it was run from a script or manually.
User avatar
Some Strange Man
Posts: 2997
Joined: Sat, 20. Mar 04, 20:50
x3

Re: Standard sell ware script crashes

Post by Some Strange Man »

demner wrote:It's difficult to tell exactly when the standard script crashes, but it appears to be when the supply station has 0 quantity (not often - maybe at the end of the factory cycle?).

Any suggestions? Is this a known bug?
Since you have a hunch as to what causes the crash:

Code: Select all

while 1
  label: check
  wait for 10000 ms
  $check = $station -> getvolume of ware $ware
  if check == 0 
     goto check
   end
  log #1, 'calling standard'
  call script ship.cmd.sellware.std
  log #1, 'finished standard'
  end
demner
Posts: 31
Joined: Sat, 13. Mar 04, 16:24
x3tc

Post by demner »

Actually, I didn't have much luck tracking down the source of the problem. The script I posted was a snippet of the actual script that seemed to best show that the standard sell ware script crashed (which I figured out would be useful for tech support). The actual script was quite a bit more involved and did much of the type of checking that you suggested. But the script still crashed.

Bottom line is, the script didn't do what I hoped it would do, so I didn't need it, and removed it. But I figured I'd post it in the tech support forum to let them know there was a bug in their script. But they moved it to this forum so obviously don't care :shock:

Return to “X²: The Threat - Scripts and Modding”