I'm an idiot.Naffarin wrote: Yes, i was afraid of the performance hit. Have you thought of gathering buying/selling stations only once in a while (maybe once a game day) instead of putting it together every sector (if i understand the main function correctly)?
Since stations are not fluctuating that much, even with the god module active, this might ease the load a bit.
I thought for some reason I needed to use the matrix sort function to rank order every station in the list of potential stations. That's simply not true. I only need to rank order the first x+1 rows, where x is the number of traders assigned to the station. (In other words if there's only one other trader working for the station, I only have to worry about the two best stations to go to, since if one gets excluded, I only need one other. I don't have to worry about whether station 23 is better than station 24, etc.)
That will optimize the station picking logic dramatically. (and is a simple fix I'll put into the next release)
And, I want to build the list of stations every sector, since I update ware prices every sector, so that ships can switch target stations enroute to better stations. (If you're enroute to a station 2 sectors away to buy energy for 14 and all of a sudden energy becomes available for 12 1 sector away, you're gonna switch) So I want to keep it running and rebuilding the station list every sector. Plus, if you don't check periodically you run into potential problems (all of a sudden I lost my docking rights to Paranid stations, but my target station is Paranid, do I keep going or do I intelligently switch? etc.)
I love the discussion though, keep it coming. Ideally we can take the best of your excellent scripts and merge them with the mediocrity of mine and come up with a sum greater than its parts. (or something equally poetic)
Cheers.