ACS & Cvars,

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!)
Ultimate Freedoomer
Posts: 186
Joined: Fri Jan 30, 2015 10:32 pm
Discord: Open Source Forever#0483
Twitch ID: https://www.twitch.tv/lyokianh
Location: Pittman Center

ACS & Cvars,

Post by Ultimate Freedoomer »

Question: is it possible to make it so cvars in an ACS script can be called by a CVARINFO variable? I wanted to do an option menu addition for this script:

Code: Select all

#library "herelib"
#include "zcommon.acs"

script "RVMP_PrintTrackName" ENTER
{
	str TrackName = StrParam(s:"RVMP_MIDI_", n:PRINTNAME_LEVEL);
	str AuthorName = StrParam(s:"RVMP_AUTHOR_", n:PRINTNAME_LEVEL);
	int levelid;
	bool ignore;
	levelid = GetLevelInfo(LEVELINFO_LEVELNUM);
	switch(levelid)
	{
		case 1: case 2:	case 3:	case 4:	case 5:	case 6:	case 7:	case 8:	case 9:
		case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17: case 18:
		case 19: case 20: case 21: case 22: case 23: case 24: case 25: case 26: case 27:
		case 28: case 29: case 30: case 31: case 32: case 33: case 34: case 35: case 36:
		case 37: case 38: case 39: case 40: case 41: case 42: case 43: case 44: case 45:
		case 46: case 47: case 48:
	}
	if(!ignore)
	{
		Log(s:"\ckNP: \cl\"", l:TrackName, s:"\"\n\clby ", l:AuthorName);
	}
}
It's the track name script for the Raven Midi Pack, modified to also show the track names for the maps whose tracks weren't replaced. I was going to try & add a menu option to turn the track/composer name display on or off.
User avatar
R4L
Posts: 371
Joined: Fri Mar 03, 2017 9:53 am
Discord: R4L#4655
Graphics Processor: nVidia (Modern GZDoom)

Re: ACS & Cvars,

Post by R4L »

If I understand correctly, you can use GetCVar to read the value and then do something based on it.
Ultimate Freedoomer
Posts: 186
Joined: Fri Jan 30, 2015 10:32 pm
Discord: Open Source Forever#0483
Twitch ID: https://www.twitch.tv/lyokianh
Location: Pittman Center

Re: ACS & Cvars,

Post by Ultimate Freedoomer »

Can you make a reference code? The compiler is being dumb,
User avatar
R4L
Posts: 371
Joined: Fri Mar 03, 2017 9:53 am
Discord: R4L#4655
Graphics Processor: nVidia (Modern GZDoom)

Re: ACS & Cvars,

Post by R4L »

Ultimate Freedoomer wrote:Can you make a reference code? The compiler is being dumb,
Something like:

Code: Select all

if (GetCVar("cvarstring") == 1)
{
    do stuff;
}
That's a really simple example that will check if a CVar is enabled or not.

Return to “Scripting”