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.

ACS beginner logic questions

Postby Elias79 » Sat Apr 13, 2019 1:34 am

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 :)
Joined: 30 Jan 2017

Re: ACS beginner logic questions

Postby Cherno » Sat Apr 13, 2019 2:55 am

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
User avatar
Joined: 06 Dec 2016

Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests