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!)

From ACS to ZScript

Postby gwHero » Thu Nov 02, 2017 5:29 pm

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
Be your own Siddhartha
 
Joined: 08 May 2017
Location: The Netherlands
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: Intel with Vulkan Support

Re: From ACS to ZScript

Postby gwHero » Thu Nov 02, 2017 6:25 pm

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?
User avatar
gwHero
Be your own Siddhartha
 
Joined: 08 May 2017
Location: The Netherlands
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: Intel with Vulkan Support

Re: From ACS to ZScript

Postby ZippeyKeys12 » Mon Nov 06, 2017 2:21 pm

CVars can have strings I believe and you can return a string, boolean or name with ScriptCall otherwise I think you're screwed :cry:
ZippeyKeys12
 
Joined: 15 Jun 2016

Re: From ACS to ZScript

Postby gwHero » Mon Nov 06, 2017 6:04 pm

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 :)
User avatar
gwHero
Be your own Siddhartha
 
Joined: 08 May 2017
Location: The Netherlands
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: Intel with Vulkan Support

Re: From ACS to ZScript

Postby ZippeyKeys12 » Tue Nov 07, 2017 1:22 pm

ScriptCall will return a value from ZScript to ACS. Not sure if I'm misunderstanding you though, so sorry if this post is useless. :?
ZippeyKeys12
 
Joined: 15 Jun 2016

Re: From ACS to ZScript

Postby gwHero » Tue Nov 07, 2017 4:17 pm

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
Be your own Siddhartha
 
Joined: 08 May 2017
Location: The Netherlands
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: Intel with Vulkan Support

Re: From ACS to ZScript

Postby gwHero » Sat Nov 11, 2017 11:32 am

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
gwHero
Be your own Siddhartha
 
Joined: 08 May 2017
Location: The Netherlands
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: Intel with Vulkan Support

Re: From ACS to ZScript

Postby Major Cooke » Sun Nov 12, 2017 10:28 am

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
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: From ACS to ZScript

Postby gwHero » Sun Nov 12, 2017 12:25 pm

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.
User avatar
gwHero
Be your own Siddhartha
 
Joined: 08 May 2017
Location: The Netherlands
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: Intel with Vulkan Support


Return to Scripting

Who is online

Users browsing this forum: boris, Vostyok and 1 guest