I didn't do a complete test, but here is what I did
(My signal does a few things, but I put a logbook print at the top of it, whilst doing theses tests)
The script that I'm using to be 'fired' is... plugin.sfm.ship.signal.attacked, which I made in the exscriptor (hence why it probably has a name longer then the in game script editor allows - although I have not had any issues with that in the past, and I would like to think that it is not correlated with signals)
Test 1. On my Boron SF, it was running my SFM command. I set the PRIMARY signal_attacked to the custom script, it didn't fire.
I tried to fire it by huge amounts of friendly fire, and then by fly commands -> send signal signal_attacked null null null null
Test2. On my flak frigate (that is set to Standby -made for easier testing). Set it to the the primary signal. Did not fire
I tried to fire it by huge amounts of friendly fire, and then by fly commands -> send signal signal_attacked null null null null
Test3 Set it to an NPC goner ship (the flagship goner one, it was close and it's slow). Set the primary signal, it did not fire
I tried to fire it by huge amounts of friendly fire, and then by fly commands -> send signal signal_attacked null null null null
Test4. The goner ship again, I returned the primary to it's default behaviour. Then I my script as a secondary signal (and I set the primary signal to !lib.interupt as a precaution, which is just a return null script)
Viola!! It worked.
I shot at it a few times and the signal fired.
?Test5? I used the my plugin.sfm.signal.attacked (but with out the logbook print) as the primary signal on my SFM transports. And I was observing one when it was attacked (with extra information on). The script priority was at 0, and the signal.attacked script was NOT running on it. (And it was being attacked by pirate ships, and was destroyed about after about 40 seconds, during which time the signal never appear to fire)
On a final note, I'm 99% sure my signal script works, as it used to work before (I think I may have had it as a secondary signal back then thou) and I have made no changes to it for quite some time.
I've yet to completely test this in all it's variations (pri + sec, just pri, just sec, + on npc, on pc, on player, on task 0 inactive etc.), but I found the results odd as Gazz made his tertiary signal scripts because the primaries worked but not the secondaries, but for me it seems the other way around

(A quick run down of what my script does is, fighter drones, run away to homebase/random npc station). My script does NOT return right away, as it does fly tasks. (It was meant to replace the original primary signal)
@ladyboy w.r.t Arguments
Scripts can have arguments, and it is one method of passing information to scripts (the second being global/local variables / other in game passable information. e.g. object names)
They are passed each time you call the script
e.g.
<return> = <object> -> call script 'script' : <arg1> 2 3 4 5
In the main script
$ret = [THIS] -> call script 'yourscript_2' : $targ
Then in the second script, it will have a variable called $targ, which will be the same value which you just passed it from the main script.
However, if you want e.g. some script to run on $targ. Then some time later, a DIFFERENT script that is completely isolated from the first to also run on $targ, then you should use a local/global variable.
e.g. On each of the different scripts you have something like this
Code: Select all
$targ = get global variable 'ladyboy.var'
if not $targ -> exists
$targ = Ask player, select a ship (i forgot the syntax for this command, but its under Other commands)
if $targ -> exists
* save the $targ information for use next time
set global variable 'ladyboy.var' to value $targ
else
return null
end
end