Anarkis Gaming Wiki

Documentation Center for our games and mods

User Tools

Site Tools

[ Wiki Home ] - [ Anarkis Gaming Studio ] - [ Forums ] - [ Unending Galaxy Manual ]


help:using_signals

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
help:using_signals [2010/06/25 10:27]
serialkicked created
help:using_signals [2014/04/26 13:25] (current)
Line 1: Line 1:
-his is probably the least understood part of the script ​engineeven the '​senior'​ scripters are doing huge mistakes when dealing with signals. So I guess a reminder is needed here. Let's take a basic ship. When you're running a command on it, this command will have the lowest priority possible (0, zero) which can be interrupted by anything with a priority equal or superior. Eg when the ship is attacked it will run a basic '​counterattack or evade' script with a prio of 99. And if killed, the '​!ship.signal.killed'​ script will interrupt whatever command the ships is currently running with a priority of 10,000. If for a reason you ship is currently running a script with a priority of (let's say) 30 and that you try to interrupt it with a script at a lower script, it won't work. +This is probably the least understood part of the script ​commandsso I guess a reminder is needed here. Let's take a basic ship. When you're running a command on it, this command will have the lowest priority possible (0, zero) which can be interrupted by anything with a priority equal or superior. Eg when the ship is attacked it will run a basic '​counterattack or evade' script with a prio of 99. And if killed, the '​!ship.signal.killed'​ script will interrupt whatever command the ships is currently running with a priority of 10,000. If for a reason you ship is currently running a script with a priority of (let's say) 30 and that you try to interrupt it with a script at a lower script, it won't work. 
  
-You also have to stick to the Egosoft standards, too many times i've seen scripters using custom killed/​attacked/​whatever signals with the wrong priorities and then wondering why the ships aren't responding correctly or are unwilling to die when they are supposed to. So here's the basics, and you HAVE to stick to them:+You also have to stick to the Egosoft standards, too many times i've seen scripters using custom killed/​attacked/​whatever signals with the wrong priorities and then wondering why the ships aren't responding correctly or are unwilling to die when they are supposed to. So here's the basics:
  
   * Signal Attacked -> Prio : 99    * Signal Attacked -> Prio : 99 
Line 9: Line 9:
 Why these values? Well, first of all they are standards. And they are logical, Killed is supposed to interrupt everything, captured is supposed to be stronger than attacked as a newly captured ship is supposed to stop any defensive move. It also means that standard commands must have a priority lower than 99. What happens if you mess up with those settings ? Let's imagine that you use a prio of 100 for both you custom attacked and killed signals. The ship, when supposed to get killed runs the sig.killed, but it's immediately interrupted by the sig.attacked (as it gets attacked at the same time) because it has the same priority. So even if the ship has 0 hull left it won't get destroyed because the attack signal takes place and calls the default '​counter-attack'​ script. It may even leads to a silent infinite loop (won't hang but it will call a script that call a script that call... until the memory is full). Why these values? Well, first of all they are standards. And they are logical, Killed is supposed to interrupt everything, captured is supposed to be stronger than attacked as a newly captured ship is supposed to stop any defensive move. It also means that standard commands must have a priority lower than 99. What happens if you mess up with those settings ? Let's imagine that you use a prio of 100 for both you custom attacked and killed signals. The ship, when supposed to get killed runs the sig.killed, but it's immediately interrupted by the sig.attacked (as it gets attacked at the same time) because it has the same priority. So even if the ship has 0 hull left it won't get destroyed because the attack signal takes place and calls the default '​counter-attack'​ script. It may even leads to a silent infinite loop (won't hang but it will call a script that call a script that call... until the memory is full).
  
-Speaking of signals one of the main addition of the X3:TC scripting engine over the previous version is the addition of the "add secondary signal"​ commands which should always be used, except if you REALLY ​know what you are doing. The purpose of these new commands is to allow various scripts to alter the same signals without compatibility issues. The one and only case where you may not use this command instead of the default "​connect ship command/​signal"​ is when you're making new signals on ships spawned by your own script/​plugin and when this new signal doesn'​t need to call back the default Egosoft signal as you're handling everything yourself ​(which is obviously a rare case).+Speaking of signals one of the main addition of the X3:TC scripting engine over the previous version is the addition of the "add secondary signal"​ commands which should always be used, except if you really ​know what you are doing. The purpose of these new commands is to allow various scripts to alter the same signals without compatibility issues. The one and only case where you may not use this command instead of the default "​connect ship command/​signal"​ is when you're making new signals on ships spawned by your own script/​plugin and when this new signal doesn'​t need to call back the default Egosoft signal as you're handling everything yourself.
  
 Another important note related to signals: X3:TC added a Killed signal to station. As far as i can see it should have been included in X3:R, but it wasn't working for some reason. That is now corrected. ​ Another important note related to signals: X3:TC added a Killed signal to station. As far as i can see it should have been included in X3:R, but it wasn't working for some reason. That is now corrected. ​
  
help/using_signals.1277454446.txt.gz · Last modified: 2014/04/26 12:57 (external edit)