From ACS to ZScript

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
gwHero
Posts: 360
Joined: Mon May 08, 2017 3:23 am
Graphics Processor: Intel with Vulkan Support
Location: The Netherlands

From ACS to ZScript

Post by gwHero »

So I started creating a game with the GZDoom engine some while ago. Concerning scripting I used ACS right from the start because I had experience with it from a previous project and since I had not been modding for 2 years I didn't know ZScript even existed.

At this moment the game itself is far from finished but some key functionality like a weather & daylight system is mostly programmed and working, including preserving and restoring necessary values (in world variables mostly) when travelling between the maps inside a hub. But of course not all is programmed yet.

In the past months I also learned that ZScript is becoming more and more interesting so in the meantime I converted all Decorate actors to ZScript and also added some ZScript code like an adjusted version of shadowsprites (credits to Nash for the original version).

So I was thinking: should I give it a try to move significant parts of the ACS code to ZScript, even when not all ACS features are covered (just see how far I would get), or should I wait until more functionality is added to ZScript; with the risk of letting the ACS library growing so large I would probably never make the step to convert it...

What I would like to know is how other modders are dealing with this; are more people in doubt whether they should move from ACS to Zscript or not; I'm interested in opinions pro and con as well as some advise, certainly from people who already have some experience in moving from ACS to Zscript.

EDIT: what the hack, I just started converting acs/sbarinfo to zscript; first attempts are encouraging.
Last edited by gwHero on Sat Nov 04, 2017 4:55 am, edited 1 time in total.
User avatar
gwHero
Posts: 360
Joined: Mon May 08, 2017 3:23 am
Graphics Processor: Intel with Vulkan Support
Location: The Netherlands

Re: From ACS to ZScript

Post by gwHero »

One interesting aspect is that when some parts of ACS can be moved to ZScript but other parts not (yet), the situation can arise that it would be almost desirable to parse certain information from ZScript to ACS. This week _mental_ exposed reading lump content features to ZScript, which I tried with enthousiasm but had to put aside for my mod for the time being since I wouldn't know how to parse the lump content to my ACS scripts (returning variables or parsing arguments to scripts from ZScript or storing values in CVar's is AFAIK restricted to numeric content, nor does a global shared space between ACS and Zscript exist). Of course the ideal situation would be that all code could be converted, but if that's not the case, what could you do in the meantime?
ZippeyKeys12
Posts: 111
Joined: Wed Jun 15, 2016 2:49 pm

Re: From ACS to ZScript

Post by ZippeyKeys12 »

CVars can have strings I believe and you can return a string, boolean or name with ScriptCall otherwise I think you're screwed :cry:
User avatar
gwHero
Posts: 360
Joined: Mon May 08, 2017 3:23 am
Graphics Processor: Intel with Vulkan Support
Location: The Netherlands

Re: From ACS to ZScript

Post by gwHero »

ZippeyKeys12 wrote:CVars can have strings I believe and you can return a string, boolean or name with ScriptCall otherwise I think you're screwed
Hey thanks! I didn't know I could write string CVar's; I must have totally overlooked that. Well that's something.
ScriptCall only goes from ACS to ZScript and not vice versa I believe.

I hope I can transfer most code to zscript, but string CVar's could be an option if I should need it . So it looks I'm not totally screwed :)
ZippeyKeys12
Posts: 111
Joined: Wed Jun 15, 2016 2:49 pm

Re: From ACS to ZScript

Post by ZippeyKeys12 »

ScriptCall will return a value from ZScript to ACS. Not sure if I'm misunderstanding you though, so sorry if this post is useless. :?
User avatar
gwHero
Posts: 360
Joined: Mon May 08, 2017 3:23 am
Graphics Processor: Intel with Vulkan Support
Location: The Netherlands

Re: From ACS to ZScript

Post by gwHero »

Ah no, it's absolutely not useless. You might have a point here. I've tried ScriptCall a couple of days ago, but did not try to return a value.
Don't worry, all help is always welcome!
Thank you!
User avatar
gwHero
Posts: 360
Joined: Mon May 08, 2017 3:23 am
Graphics Processor: Intel with Vulkan Support
Location: The Netherlands

Re: From ACS to ZScript

Post by gwHero »

Okay,
I can now advise everyone who is in doubt like I was one week ago to migrate your ACS to ZScript. For new projects it's clear you should do it, but also for WIP.
It certainly takes some time to figure things out, but once started you won't regret. I've already migrated most hud related stuff, and I'm now busy with the gameplay.
User avatar
Major Cooke
Posts: 8070
Joined: Sun Jan 28, 2007 3:55 pm

Re: From ACS to ZScript

Post by Major Cooke »

ACS still has some value with map control. Eventually though, some ACS exposure will be done that'll allow replacing it (almost) entirely.
User avatar
gwHero
Posts: 360
Joined: Mon May 08, 2017 3:23 am
Graphics Processor: Intel with Vulkan Support
Location: The Netherlands

Re: From ACS to ZScript

Post by gwHero »

Major Cooke wrote:ACS still has some value with map control. Eventually though, some ACS exposure will be done that'll allow replacing it (almost) entirely.
I agree. Some stuff will indeed be impossible at the moment. But actually, once I gave it a good thought, I was surprised to see how much I already can migrate to ZScript. Well, if I can move most of the game control to ZScript I'll be happy; it's no problem to have some ACS scripts left that are triggered by line specials or ZScript classes/actors.

Return to “Scripting”