ACS beginner logic questions

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
Elias79
Posts: 50
Joined: Mon Jan 30, 2017 6:09 am

ACS beginner logic questions

Post by Elias79 »

1. Can "ENTER" and "ACS_ExecuteAlways" scripts be suspended?
and if not can they be terminated using "terminate;" from within the script?
(i know they can't be terminated using "ACS_Terminate")
2. When exactly can you use the "break;" command?
as so far i have only been able to compile it when used in a ENTER script used in a "while (TRUE)" loop.
3. How far will the "break;" command exit out?
The current block of code (loop or not) or up one level more or out of any other loops in the same script?
4. If calling a script again with "ACS_Execute" before it had time to finish will it fail and let the first run complete?
or will it interrupt the current run and re-run from the start right away?
If there is a wait to for a script to be run again how long and when does it apply?
5. Is there a sane way of interrupting scripts without causing "after effects" like weird glitches and "ghost code"?
6. If you want to be certain a script will stop and run from the start without finishing can this be done from another scripts reliably?
like a "goto" but from another scripts?
7. Are scripts using Delays interruptible or will they delay the termination until current action is completed?

Thanks for any help and yes i do read the wiki :)
User avatar
Cherno
Posts: 1311
Joined: Tue Dec 06, 2016 11:25 am

Re: ACS beginner logic questions

Post by Cherno »

1. Termination of course only makes sense in scripts that have code that runs for more than one tick. Thus, yes, tehy can be terminated at any point via terminate. You could use a workaround for outside termination by calling another ACS script that in thrun switches a bool to false and the looping script, each cycle, checks if the loop is true and if not, terminates itself (the bool would have to be set teh true before the loop is started, of course).
2. In any kind of loop.
3. The current loop. For a nested loop, if called from the inner one, it will end the inner one.
4. Don't know, never used it.
5-7 Not sure
Post Reply

Return to “Scripting”