[SCR] [X3:TC/AP] [v1.9.8.12] [03/23/14] Galaxy Explorer

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

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

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle »

gnasirator wrote:Hmm seems, like there's still a signal link active for SIGNAL_ATTACKED.

I don't know, how to fix this for good. ... I can't think of a way to automatically remove those links if a ship which was used as an explorer before now does something else ...
maybe someone else has an idea (Bullwinkle?)
As you say, signals are more tenacious than most other ways of running scripts.

I see that you connect SIGNAL_ATTACKED in .scanEnemies. You have a commented-out line directly below it (test code?) that should restore the signal. So use that when the player turns off Galaxy Explorer.

HOWEVER, I think that you should really be using secondary signals here. As far as I can tell, secondary signals are preferred. So use Add/Remove Secondary Signal... instead of "Connect Ship Command/Signal".

Regarding fixing explorers that have already been created, I do not know your code well. What if you were to loop through all explorers and Set the Command/Signal behavior to default? You could do that in the setup file to clear the potentially bad signals.

Then re-apply the new secondary signal map in .scanEnemies. Then clear the secondary signal map when the player turns off Galaxy Explorer on that ship.

As a bonus, you can remove all secondary signal maps with a single command (Global secondary signal map: remove signal), which may be useful in the future.

Does that help?



@PromX: You can use Super Script Killer (SSK) to fix your Hyperion.
  • (Undock any docked fighters before you use the hotkey).
User avatar
PromX
Posts: 123
Joined: Thu, 21. Feb 08, 23:39
x4

Post by PromX »

DrBullwinkle wrote:@PromX: You can use Super Script Killer (SSK) to fix your Hyperion.
  • (Undock any docked fighters before you use the hotkey).
Yeah, i'll try that right away. Thank you :)
gnasirator
Posts: 1114
Joined: Mon, 13. Dec 04, 16:15
x3tc

Post by gnasirator »

Then clear the secondary signal map when the player turns off Galaxy Explorer on that ship.
That's exactly, what I find difficult to do. I would have to globally loop through all player owned ships and check if the explorer script is running, else disconnect the signal?!
OR start a restore.signal thread on every explorer, checking every second if the explorer main script is running ...
I'll find a way.

The rest is no problem.
User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle »

gnasirator wrote:
Then clear the secondary signal map when the player turns off Galaxy Explorer on that ship.


That's exactly, what I find difficult to do.


If you do it when the player turns Galaxy Explorer Off, then it is just:

RefObj-> Remove secondary signal:...



To remove a single primary signal then:

RefObj-> set ship command/signal [SIGNAL] to global default behavior




If you do it globally (with secondary signals), then:

Global secondary signal map: remove signal...




Apparently you can do it globally for primary signal maps as well:

global script map: remove: key=[COMMAND_WHATEVER], class=[Ship], race=[Player], script='script', prio=0
gnasirator
Posts: 1114
Joined: Mon, 13. Dec 04, 16:15
x3tc

Post by gnasirator »

Sure, that is not the problem.
The problem would be to catch the moment the explorer script stops working.

The only way I can think of is by checking regularly if the script is still active.
Or is there a signal_stopped which I could use?
User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle »

Don't you know when the player clicks the Off button?
gnasirator
Posts: 1114
Joined: Mon, 13. Dec 04, 16:15
x3tc

Post by gnasirator »

actually, no. As far as I know, 'command -> stop' simply quits the execution of the script stack in task 0.
So I can't react to this event in task 0. I only could run another task that does.
And here is the question, how to catch the moment the player stops task 0 in a most efficient way.
User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle »

Oh, that.

I solved that problem in Drone Carrier Software by running a task on $PageID on the drones. So they always maintain their behavior, no matter what the player commands them to do on task 0.
Teladidrone
Posts: 644
Joined: Tue, 24. Aug 04, 11:41
x3tc

Post by Teladidrone »

The most reliable way would be to start a dummy on task 0 (doing nothing in an infinite loop just to "stay there" and let the player know the ship is... well... exploring) while the actual explorer script runs on a higher task and periodically checks if its dummy is still alive.

If not you know the explorer job has terminated (because the player ordered it to end or started another command on 0, or something else issued a new command to the ship, whatever) and you can do a proper cleanup before finally terminating your explorer work in a way you fully control.
gnasirator
Posts: 1114
Joined: Mon, 13. Dec 04, 16:15
x3tc

Post by gnasirator »

ah okay interesting way of doing this.

Think I'll make a cleanup script then, which periodically checks if the main task is still running and does the clean-up if not.

Thanks!
nap_rz
Posts: 1383
Joined: Sun, 25. Dec 05, 10:42
x3tc

Post by nap_rz »

download link is gone? :?
gnasirator
Posts: 1114
Joined: Mon, 13. Dec 04, 16:15
x3tc

Post by gnasirator »

fixed
rand__
Posts: 154
Joined: Mon, 3. Sep 12, 13:53
x4

Post by rand__ »

Did the cleanup script ever come to fruition?

I have the same issue on my current Player Ship and its annoying the hell out of me... :p

But i suppose i can simply get B's linked fix script - or just use another ship - time to upgrade maybe;)
gnasirator
Posts: 1114
Joined: Mon, 13. Dec 04, 16:15
x3tc

Post by gnasirator »

jeah, time to upgrade your ship. ;)
sorry but I'm currently very low on free time. I haven't done anything yet.
I'll release it as soon as it's done.
cryptonite1
Posts: 90
Joined: Sat, 1. Jun 13, 20:06
x4

Post by cryptonite1 »

ok, does using this cost you money?

well i had 3.6 million before i went to bed with 3 explorers on SETA X10, when i wake up, i have 15000 left...

I installed the "spawn satellite" file, and set the satellites to "spawn" instead of the need to "buy" as intended, assuming there shouldn't be any cost at all now, but I may be wrong?

is there a "pilot salary" for this similar to other "automated scripts" like MK3 or CLS?

couldn't find the answer on the OP page, and didn't see no "read me", thanks
gnasirator
Posts: 1114
Joined: Mon, 13. Dec 04, 16:15
x3tc

Post by gnasirator »

spawned sats cost 1.5x the price of bought ones.
Compensation for the spawning advantage.

Nothing in space is for free ;)
cryptonite1
Posts: 90
Joined: Sat, 1. Jun 13, 20:06
x4

Post by cryptonite1 »

ok got it thanks
cryptonite1
Posts: 90
Joined: Sat, 1. Jun 13, 20:06
x4

Post by cryptonite1 »

one more awkward behavior im experiencing is i set the "explore hostile sectors" to YES but whenever the explorer goes into a hostile sector for example a Xenon sector, he starts retreating upon entering the sector and goes through the gate he entered from, keeps doing this over and over at the same gate/sector.

into xenon => retreating => back out => into xenon

this is the cycle.

did i set something wrong? or?
gnasirator
Posts: 1114
Joined: Mon, 13. Dec 04, 16:15
x3tc

Post by gnasirator »

Hmm, could it be that through the xenon sector is the only way out of that part of the galaxy?
And that there are xenon ships next to the gate?
Explorers flee as soon as they get close to xenon ships. always. maybe that's why he retreats into the gate back into the safe sector.

And if there's no other way than to go back into the xenon sector, the explorer gets stuck between those two.

That's how it could happen. Usually, explorers are smart enough to avoid situations like this but it is VERY difficult to program the AI to behave correctly under all circumstances. Simply because there are so many different possible situations.
nap_rz
Posts: 1383
Joined: Sun, 25. Dec 05, 10:42
x3tc

Post by nap_rz »

my explorer seem inconsistent with his job as satellite dropper, sometimes he will drop satellites in some sectors sometimes he don't.

maybe you need to add function like drop satellites in x sectors, in which we can explicitly order which sectors to be mapped with satellites.

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”