[Discussion] Generic X3TC S&M questions II
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 13244
- Joined: Fri, 13. Jan 06, 16:39
The first script editor screen - the one you always skip over - has a haaaaaalp page with all those commands.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
-
- Posts: 7232
- Joined: Fri, 9. Apr 04, 21:19
This is also a very good "idiots" guide by Cycrow. . . .
http://cycrow.thexuniverse.us/scripts/help/
I'm happy calling it that because I myself have used it liberally to learn the basics!!
Another question from me.
Ideally I want to try and return an array of all the missiles fired by the player in sector, those that are still active / in the air, ie on their way to the target.
I was going to treat them the same way I'd recall say an array of all of a certain ship type such as an M5 but have become a bit confused about missiles.
"Missile" appears to be a perfectly valid object type (It's whats returned when I query a missiles type after all) and yet its not on the list of object types called by the script editor. . . pretty sure anyway, I did go through the list very slowly about 3 times thinking "I must just be missing it. . . . "
http://cycrow.thexuniverse.us/scripts/help/
I'm happy calling it that because I myself have used it liberally to learn the basics!!
Another question from me.
Ideally I want to try and return an array of all the missiles fired by the player in sector, those that are still active / in the air, ie on their way to the target.
I was going to treat them the same way I'd recall say an array of all of a certain ship type such as an M5 but have become a bit confused about missiles.
"Missile" appears to be a perfectly valid object type (It's whats returned when I query a missiles type after all) and yet its not on the list of object types called by the script editor. . . pretty sure anyway, I did go through the list very slowly about 3 times thinking "I must just be missing it. . . . "

"Shoot for the Moon. If you miss, you'll end up co-orbiting the Sun alongside Earth, living out your days alone in the void within sight of the lush, welcoming home you left behind." - XKCD
-
- Posts: 472
- Joined: Sun, 3. Jan 10, 22:15
-
- Posts: 13244
- Joined: Fri, 13. Jan 06, 16:39
No can do.Bishop149 wrote:Ideally I want to try and return an array of all the missiles fired by the player in sector, those that are still active / in the air, ie on their way to the target.
You have to check every single ship and grab the missiles incoming to it.
Missiles do have a race, though.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
-
- Posts: 7232
- Joined: Fri, 9. Apr 04, 21:19
-
- Posts: 2033
- Joined: Wed, 29. Jun 05, 01:45
Interesting fun fact:
Everyone knows that scripts that run on objects, stop when the object is destroyed. OOOOooOOOrrr do they!!
The statement is partially true (I thought I'd stress test it)
A script STARTED on an object, will terminate when the object dies.
A script that was started on a different object (ship2), that is told to call another script on the first object (ship1), will not stop if ship1 dies.
i.e.
i start on ship2
(no start) $ship -> call script
Ship 1 dies
But the script on ship2 is still running. and [THIS] has become an unknown object.
Any way, I hope this isn't too confusing...
Here are the scripts I used:
I called script2 globally, then called script 3 globally
script2 calls (not starts) a script on my target, then script 3 blows up the target, some seconds later, script 2 should send a second message (and it actually does send it)
Script a....test2
001 $var = get player tracking aim
002 @ = $var -> call script 'a....testmsg' :
003
004
005 return null
Script a....test3
001 $var = get player tracking aim
002 $var -> destruct: show no explosion=[FALSE]
003
004
005 return null
Script a....testmsg
001 $time = playing time
002 $msg = 'start' + $time + [THIS]
003 [THIS] -> send incoming message: text=$msg temporary=[FALSE]
004
005 @ = wait 10123 ms
006 $time = playing time
007 $msg = 'finish' + $time + [THIS]
008 [THIS] -> send incoming message: text=$msg temporary=[FALSE]
009
010
011
012 return null
output was
1. start447Terracorp...freighter
2. finish457UnknownObject
(I'm guessing unknown object means dead object)
Everyone knows that scripts that run on objects, stop when the object is destroyed. OOOOooOOOrrr do they!!
The statement is partially true (I thought I'd stress test it)
A script STARTED on an object, will terminate when the object dies.
A script that was started on a different object (ship2), that is told to call another script on the first object (ship1), will not stop if ship1 dies.
i.e.
i start on ship2
(no start) $ship -> call script
Ship 1 dies
But the script on ship2 is still running. and [THIS] has become an unknown object.
Any way, I hope this isn't too confusing...
Here are the scripts I used:
I called script2 globally, then called script 3 globally
script2 calls (not starts) a script on my target, then script 3 blows up the target, some seconds later, script 2 should send a second message (and it actually does send it)
Script a....test2
001 $var = get player tracking aim
002 @ = $var -> call script 'a....testmsg' :
003
004
005 return null
Script a....test3
001 $var = get player tracking aim
002 $var -> destruct: show no explosion=[FALSE]
003
004
005 return null
Script a....testmsg
001 $time = playing time
002 $msg = 'start' + $time + [THIS]
003 [THIS] -> send incoming message: text=$msg temporary=[FALSE]
004
005 @ = wait 10123 ms
006 $time = playing time
007 $msg = 'finish' + $time + [THIS]
008 [THIS] -> send incoming message: text=$msg temporary=[FALSE]
009
010
011
012 return null
output was
1. start447Terracorp...freighter
2. finish457UnknownObject
(I'm guessing unknown object means dead object)
-
- Posts: 1962
- Joined: Tue, 8. Jan 08, 18:19
-
- Posts: 13244
- Joined: Fri, 13. Jan 06, 16:39
Of course scripts on Object 2 do not automatically terminate when Object 1 is destroyed.
Some scripts "deal with" many objects so it would get silly pretty quickly if the script would terminate as soon as any of the queried objects was destroyed. =P
That's what (if) exist is for and it should be used liberally.
Some scripts "deal with" many objects so it would get silly pretty quickly if the script would terminate as soon as any of the queried objects was destroyed. =P
That's what (if) exist is for and it should be used liberally.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
There is no sense crying over every mistake. You just keep on trying till you run out of cake.