A few (more) scripting questions

The place to discuss scripting and game modifications for X²: The Threat.

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

Bhruic
Posts: 222
Joined: Thu, 22. Jul 04, 01:40
x3tc

A few (more) scripting questions

Post by Bhruic » Mon, 17. Jan 05, 00:11

My understanding of how a few areas of scripting works is still a little fuzzy.

1) Is "Script Priority" a decorative function, or is it a useful one? For example, if I set a script to priority "37", what relevance would that have, assuming one didn't issue a specific check for that priority? Does a higher priority script "override" a lower one (or vice versa)?

2) Is there any way to stop a script in progress? From the description, it appears that "interrupt script" only pauses a currently running one, and it will resume when your script finishes.

3) For signals, is the script re-called every time the signal is active? For example, using SIGNAL_ATTACKED, does every shot that hits the target ship trigger the signal? Or is it only sent for the original shot?

Bh

stella
Posts: 1004
Joined: Tue, 17. Feb 04, 18:41
x2

Post by stella » Mon, 17. Jan 05, 10:45

1) afaik, yes. A hiugher script priority woll override a lower one

2) If the script is actually in progress, then the code in that script is actually being executed. A "return" will exit it. Note, that it will be exited, not suspended.

3) search me :wink:
Attack enemies in radius -here

User avatar
LV
Sith Lord
Posts: 8255
Joined: Wed, 6. Nov 02, 20:31
x3tc

Re: A few (more) scripting questions

Post by LV » Mon, 17. Jan 05, 13:52

Bhruic wrote:My understanding of how a few areas of scripting works is still a little fuzzy.

3) For signals, is the script re-called every time the signal is active? For example, using SIGNAL_ATTACKED, does every shot that hits the target ship trigger the signal? Or is it only sent for the original shot?

Bh
every shot iirc correctly, the way i handle this is to call the new script and immiediatly link the ships !signal.attacked back to the origional one while the script runs, if the object still exists after its run i re-link to the !signal attacked script i made :)
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

User avatar
Burianek
Posts: 2981
Joined: Mon, 29. Dec 03, 03:29
x3tc

Re: A few (more) scripting questions

Post by Burianek » Mon, 17. Jan 05, 20:09

Bhruic wrote:My understanding of how a few areas of scripting works is still a little fuzzy.

1) Is "Script Priority" a decorative function, or is it a useful one? For example, if I set a script to priority "37", what relevance would that have, assuming one didn't issue a specific check for that priority? Does a higher priority script "override" a lower one (or vice versa)?
Higher priority script calls do overwrite lower priority scripts.
2) Is there any way to stop a script in progress? From the description, it appears that "interrupt script" only pauses a currently running one, and it will resume when your script finishes.
Interrupt adds a script to the "stack" of scripts running on an object, so does a simple script call. When the script on the top of the stack terminates, it drops down and begins to execute the script underneath it (that was on hold).
To completely wipe the stack clean and 'break' a ship in the middle of it's orders, start a new script with a higher priority in the task where the old script/scripts are running. (The main task is task 0) Unfortunately, there is no 'null' or 'stop' function call, so you'd have to write your own for that. I am 80% sure that if you use the start script in task with prio function it will place the script in the 'root' position of the stack and wipe out any old commands there. To be honest, this is dangerous to use however, as you have to guarantee that whatever script you're terminating will terminate cleanly and won't leave any artefacts left over. I almost always just use interrupt, and let it go back to whatever it was doing when I'm done with what I wanted to interrupt for.
3) For signals, is the script re-called every time the signal is active? For example, using SIGNAL_ATTACKED, does every shot that hits the target ship trigger the signal? Or is it only sent for the original shot?
I honestly am not sure. It would be easy enough to check by attaching a signal that writes a message to the screen and then attacking the ship and seeing when you get the messages. I would've guessed it will only send one at the beginning of the battle, but I'm not sure.
Cheers.
"Nature's first green is gold" . . . stay golden.

Return to “X²: The Threat - Scripts and Modding”