EnglishGermanFrenchRussianPolishItalianSpanish
Log inRegister
 
[LIB] Tertiary Signals (v3)
Post new topic Reply to topic Goto page 1, 2  Next
View previous topic :: View next topic
Author Message
Gazz





Joined: 13 Jan 2006
Posts: 12407 on topic
Location: Bavaria
Thank you for registering your game
modified
PostPosted: Sun, 31. May 09, 17:49    Post subject: [LIB] Tertiary Signals (v3) Reply with quote Print

.
According to Cycrow, "Secondary signal attacked was fixed in 2.5"

I have not tested this, yet, but most likely this library is no longer needed.





Secondary SIGNALS do not work. (at least not for SIGNAL_ATTACKED)
I tried and tried for about 12 hours but eventually gave up.
A seconday SIGNAL_ATTACKED fires... sometimes. Or rather once in a blue moon. On some ships.
According to Cycrow they fire before primary signals (which work perfectly fine) so since they not always fire before, they are apparently broken.


No point in crying about it so... here's a library for I guess...
Tertiary Signals


Download: ZIP



Currently only 4 events are checked:

!ship.signal.attacked
!ship.signal.attacked.ts
!ship.signal.attacked.bigship
!ship.signal.attacked.khaakth

Two lines have to be added to the corresponding Egosoft scripts. (see next post)
Only necessary if you want to support additional signals.


Usage:
Code:
@ = [THIS] -> call script 'lib.gz.tertiary.signal.handler' :  attacker / call script name=$attacker  action=$action  !ship.signal script name=$Script.Name


$Script.Name is simply the name of the !signal script you wish to attach your script to. It is also the global variable name of where the values are stored.

You configure things by directly calling the library.

Action can have 3 string values.
  • "add"
    The script name supplied as "attacker" is added to the list.
    It will be executed everytime the parent script runs.

    Example:
    Code:
    @ = [THIS] -> call script 'lib.gz.tertiary.signal.handler' :  attacker / call script name='plugin.case.of.beer.attacked'  action='add'  !ship.signal script name='!ship.signal.attacked'

    Now 'plugin.case.of.beer.attacked' is always called before the actual !ship.signal.attacked is fully executed.

  • "remove"
    The script name supplied as "attacker" is removed from the list.

    Example:
    Code:
    @ = [THIS] -> call script 'lib.gz.tertiary.signal.handler' :  attacker / call script name='plugin.case.of.beer.attacked'  action='remove'  !ship.signal script name='!ship.signal.attacked'

    'plugin.case.of.beer.attacked' is detached from this signal script.

  • "print"
    All scripts attached to this "name" (like 'SIGNAL.ATTACKED.ALL') are printed to a logfile.


The global variable "SIGNAL.ATTACKED.DEBUG" can be null (=off) or integer.
This is the number of the logfile that the library will print to.

All relevant actions can be logged so if you "lose" a tertiary signal, it will show in the logs as being executed.


All rules for normal signals apply.
If your custom signal script has a duration (any kind of wait...) then all further signals to this ship are blocked.
Avoid this unless you are absolutely sure that this is what you want to achieve.


_________________
My complete script download page. . . . . . Xai-Corp MSCI List is scripter's friend. I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.


Last edited by Gazz on Fri, 16. Oct 09, 13:18; edited 11 times in total
Back to top
View user's profile Send private message Visit poster's website
Gazz





Joined: 13 Jan 2006
Posts: 12407 on topic
Location: Bavaria
Thank you for registering your game
modified
PostPosted: Sun, 31. May 09, 17:49    Post subject: Reply with quote Print

Currently 4 events are supported:

!ship.signal.attacked
!ship.signal.attacked.ts
!ship.signal.attacked.bigship
!ship.signal.attacked.khaakth

Two lines (001-002) have to be added to the corresponding Egosoft scripts.



Looks like this:
Code:
Script !ship.signal.attacked


001   $Script.Name = get script name
002 @ = [THIS] -> call script 'lib.gz.tertiary.signal.handler' :  attacker / call script name=$attacker  action=$action  !ship.signal script name=$Script.Name
003   
004   * try a defensive move
005   if [THIS] -> is in active sector
006   |$littleship = [THIS] -> is of class Little Ship
007   |do if [THIS] -> is of class M6
*snip*



_________________
My complete script download page. . . . . . Xai-Corp MSCI List is scripter's friend. I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.


Last edited by Gazz on Tue, 2. Jun 09, 19:37; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website
Gazz





Joined: 13 Jan 2006
Posts: 12407 on topic
Location: Bavaria
Thank you for registering your game
PostPosted: Sun, 31. May 09, 17:49    Post subject: Reply with quote Print

** reserved **


_________________
My complete script download page. . . . . . Xai-Corp MSCI List is scripter's friend. I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
Back to top
View user's profile Send private message Visit poster's website
LV
Sith Lord




Joined: 06 Nov 2002
Posts: 6359 on topic
Location: The Dark Side
Thank you for registering your game
PostPosted: Mon, 1. Jun 09, 10:15    Post subject: Reply with quote Print

spooky i worked this out myself as well yesterday testing S.Sigs on medusa but it wasn't 100% that they were forked (99.9)




i'll take a look at this later


_________________
LV's TC Scripts
Readme's For All My Scripts


I felt a great disturbance in the forum, Like millions of voices cried out in terror, then were silenced

si tacuisses, philosophus mansisses
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Gazz





Joined: 13 Jan 2006
Posts: 12407 on topic
Location: Bavaria
Thank you for registering your game
PostPosted: Mon, 1. Jun 09, 10:26    Post subject: Reply with quote Print

If "the proper way" doesn't work out (and I have tried for several days, all in all) you can still use this one.
Worst case you have to hack a few more stock !signal scripts but once they are updated, everyone can access them.

That was the main problem in Reunion. Once someone messed with the !signal script, noone else could.
I could have written this for Reunion if I had needed it back then. Without all the debug code it's what... 50 lines for the whole thing?


Alas, there is no object class and race filter, like with real secondary signals.
While I could have done that, too, I opted to keep it simple and solid instead.
Put the filtering at the start of the called signal script and call it good.


_________________
My complete script download page. . . . . . Xai-Corp MSCI List is scripter's friend. I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
Back to top
View user's profile Send private message Visit poster's website
Logain Abler





Joined: 31 Oct 2005
Posts: 2253 on topic
Location: Norwich, UK
Thank you for registering your game
PostPosted: Tue, 2. Jun 09, 12:37    Post subject: Re: [LIB] Tertiary Signals Reply with quote Print

Gazz wrote:
Secondary SIGNALS do not work.


Hi All,

I’m using the Killed & Change Sector signals in my SSDN.

The Killed is used to keep track of kills & loses and the Change Sector is used as part of enemy tracking.

Everything looks to work fine Exclamation is this just relating to the Attacked signal or should I be worried:?:

Cheers.

LA

As always great work Gazz


_________________
Freight Distribution Network|Strategic Sector Defence Network|Production Modules|Capital Ship Energy Cell Generator
Back to top
View user's profile Send private message Send e-mail
Xenon_Slayer
EGOSOFT
EGOSOFT



Joined: 09 Nov 2002
Posts: 10740 on topic
Location: Camping the North Gate of Black Hole Sun
Thank you for registering your game
PostPosted: Tue, 2. Jun 09, 12:53    Post subject: Reply with quote Print

Can someone post an example of what is not working properly please.

Back to top
View user's profile Send private message Send e-mail
Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)



Joined: 15 Nov 2004
Posts: 20457 on topic
Location: London
Thank you for registering your game
PostPosted: Tue, 2. Jun 09, 13:32    Post subject: Reply with quote Print

secondary signals work fine, its just a problem with SIGNAL_ATTACK


_________________
My Scripts | MY X3TC Scripts | X3 Plugin Manager | Custom Gui
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Gazz





Joined: 13 Jan 2006
Posts: 12407 on topic
Location: Bavaria
Thank you for registering your game
PostPosted: Tue, 2. Jun 09, 16:44    Post subject: Reply with quote Print

Xenon_Slayer wrote:
Can someone post an example of what is not working properly please.


Code:
$Ship -> add secondary signal: signal=SIGNAL_ATTACKED, script='test.1', prio=0, name='sig.attack.1'

global secondary signal map: add signal=SIGNAL_ATTACKED race=null class=Ship script='test.1' prio=0 name='sig.attack.2'

Both of these show the same behaviour with SIGNAL_ATTACKED.

The primary SIGNAL_ATTACKED always fires when it's supposed to.
The secondary should fire right before but instead it fires rarely while the primary works.

On (object class) freighters it fires often, on fighters sometimes, on big ship never (never saw it happen).


This whole issue is practically irrelevant for vanilla games.
Only a few corporation freighters are using a personal secondary SIGNAL_ATTACKED but since it (for some reason) works okay for freighters, there is no discernible "bug".


So as a workaround, this library allows me to add/remove script calls into the primary signal scripts without hacking the !signal scripts (again).
It's not pretty but it works beautifully. =)

Come to think of it, the "name" argument of the library should not be some arbitrary string. It should just be the script name of the !signal script.
(Why didn't anyone tell me that this was a stupid idea!? =)


_________________
My complete script download page. . . . . . Xai-Corp MSCI List is scripter's friend. I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
Back to top
View user's profile Send private message Visit poster's website
Logain Abler





Joined: 31 Oct 2005
Posts: 2253 on topic
Location: Norwich, UK
Thank you for registering your game
PostPosted: Tue, 2. Jun 09, 18:46    Post subject: Reply with quote Print

Cycrow wrote:
secondary signals work fine, its just a problem with SIGNAL_ATTACK


Cool, I can now relax a little, cheers for clearing that up Smile

LA


_________________
Freight Distribution Network|Strategic Sector Defence Network|Production Modules|Capital Ship Energy Cell Generator
Back to top
View user's profile Send private message Send e-mail
Gazz





Joined: 13 Jan 2006
Posts: 12407 on topic
Location: Bavaria
Thank you for registering your game
PostPosted: Tue, 2. Jun 09, 19:39    Post subject: Reply with quote Print

v3 released.

Cleaned up debug functions.

"name" is now the name of the !ship.signal script the user signal is attached to.
This way is far easier to keep track of.


_________________
My complete script download page. . . . . . Xai-Corp MSCI List is scripter's friend. I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
Back to top
View user's profile Send private message Visit poster's website
7ate9tin11s





Joined: 12 Nov 2005
Posts: 614 on topic
Location: Over there!
Thank you for registering your game
PostPosted: Wed, 12. Aug 09, 04:21    Post subject: Reply with quote Print

<necromancy> Skull Arrow Goner Arrow Cool </necromancy>

My apologies for raising the dead, but I had a thought/idea that seems to fit in with this script over writing my own signal handler. I have found the need for a SIGNAL_SPAWNED hook which would be basically the type of hook as this, but on the !job files (and include a local variable flag so it is only ever called once). So I was wondering if you would like to add it to this, or prefer me to write and release it on my own?

Either way is fine by me Very Happy

Back to top
View user's profile Send private message
Gazz





Joined: 13 Jan 2006
Posts: 12407 on topic
Location: Bavaria
Thank you for registering your game
PostPosted: Wed, 12. Aug 09, 08:11    Post subject: Reply with quote Print

Does a SIGNAL_SPAWNED exist? I can't remember seeing it before.


_________________
My complete script download page. . . . . . Xai-Corp MSCI List is scripter's friend. I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
Back to top
View user's profile Send private message Visit poster's website
7ate9tin11s





Joined: 12 Nov 2005
Posts: 614 on topic
Location: Over there!
Thank you for registering your game
PostPosted: Wed, 12. Aug 09, 08:25    Post subject: Reply with quote Print

No it does not for some reason. So I guess it would be a new pseudo signal to be more accurate.

Back to top
View user's profile Send private message
Gazz





Joined: 13 Jan 2006
Posts: 12407 on topic
Location: Bavaria
Thank you for registering your game
PostPosted: Wed, 12. Aug 09, 09:30    Post subject: Reply with quote Print

But that still requires hooking it into... what?

"Tertiary signals" are simply branched off the main signals specifically because secondary SIGNAL_ATTACKED does not work.

SIGNAL_CHANGESECTOR doesn't "work", either.
Well, technically it does but only 30-90 sec after a ship has changed sector. (except for the playership)
That's not particularly useful for doing anything about jumpgate crashes for instance.


_________________
My complete script download page. . . . . . Xai-Corp MSCI List is scripter's friend. I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic Reply to topic Goto page 1, 2  Next
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum
Control Panel
Login Data
The time now is Sat, 21. Oct 17, 17:52

All times are GMT + 2 Hours


Board Security

Copyright © EGOSOFT 1989-2017
Powered by phpBB © 2001, 2005 phpBB Group
Template created by Avatar & BurnIt!
Debug: page generation = 0.57646 seconds, sql queries = 29