[solved] Run an ACS script at a CVAR change?

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!)
User avatar
Jekyll Grim Payne
Global Moderator
Posts: 1116
Joined: Mon Jul 21, 2008 4:08 am
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)

[solved] Run an ACS script at a CVAR change?

Post by Jekyll Grim Payne »

I have a custom CVAR. Is it possible to run an ACS script when the value of this variable changes?

I know I can make a looped script that checks for that CVAR continuously but AFAIK it can be a bit expensive to run a check like that every tick so I was wondering if there's a more efficient way.
Last edited by Jekyll Grim Payne on Sun Aug 26, 2018 4:34 am, edited 1 time in total.
Blue Shadow
Posts: 5032
Joined: Sun Nov 14, 2010 12:59 am

Re: Run an ACS script at a CVAR change?

Post by Blue Shadow »

No, there isn't.
User avatar
solarsnowfall
Posts: 1581
Joined: Thu Jun 30, 2005 1:44 am

Re: Run an ACS script at a CVAR change?

Post by solarsnowfall »

Jekyll Grim Payne wrote:I know I can make a looped script that checks for that CVAR continuously but AFAIK it can be a bit expensive to run a check like that every tick...
As programmer I can appreciate an utter sense of complete austerity when it comes to managing resources. My understanding of ACS tells me, though, that you really don't need to worry about something like a single variable check per tic. When last I ran into any sort of limit by way of accidentally writing an infinite loop, the internal limitation is something like 500,000 commands per tic. I don't know if that's changed since I was last writing ACS, but unless the stack size of ACS has been seriously curtailed, I don't think you have anything to worry about.
User avatar
Jekyll Grim Payne
Global Moderator
Posts: 1116
Joined: Mon Jul 21, 2008 4:08 am
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)

Re: Run an ACS script at a CVAR change?

Post by Jekyll Grim Payne »

Well, I found a way to do it differently, so that specific problem isn't relevant to me anymore, but I'm happy to hear that anyway. Thanks :)
User avatar
Enjay
 
 
Posts: 26633
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: Run an ACS script at a CVAR change?

Post by Enjay »

Jekyll Grim Payne wrote:Well, I found a way to do it differently...
Argh! Any chance you could finish off the thread and let people know what your solution is? It might help someone.

The number of times I've seen someone ask a question, get suggestions and then say "never mind, I solved it my own way" without telling anyone what their own way was. Image
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: [solved] Run an ACS script at a CVAR change?

Post by Matt »

what Enjay said. Not even code, just a brief summary of the concept would be appreciated.

Return to “Scripting”