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
A few (more) scripting questions
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
-
- Posts: 1004
- Joined: Tue, 17. Feb 04, 18:41
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
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
Attack enemies in radius -here
-
- Sith Lord
- Posts: 8255
- Joined: Wed, 6. Nov 02, 20:31
Re: A few (more) scripting questions
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 madeBhruic 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
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
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
-
- Posts: 2981
- Joined: Mon, 29. Dec 03, 03:29
Re: A few (more) scripting questions
Higher priority script calls do overwrite lower priority scripts.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)?
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).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.
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.
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.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?
Cheers.
"Nature's first green is gold" . . . stay golden.