Page 1 of 1

[SOLVED]Switchable menu option for a script

PostPosted: Tue Jan 14, 2020 6:20 am
by Grey-Wolf
Hello,
I made an ENTER script that gives the player a reward crate of goodies and equip if he manages to kill all the monsters in a map.
I'd like to make it an optional feature, and since making a menu option that gives a token item only works if it's done after loading a map, I figured that CVARS are my best bet for this purpose. I've never played around with Cvars much, so I'm a little lost on how I should do this in a "clean" way. Any advices?

Re: Switchable menu option for a script

PostPosted: Tue Jan 14, 2020 9:25 am
by Jarewill
Might I ask what exactly do you mean by the "clean" way?

As for how to do it, let's start with a CVARINFO; that's where all the CVARs will be stored.
As for the menu option, MENUDEF is the way to do it.

Now, I had problems with MENUDEF the first time I tried it, so I'll post an example below:
Spoiler:

And in the ACS script, you will want to have this check:
Code: Select allExpand view
If(GetCVar("cvar_name")==1){insert code here}

Hope this helps.

Re: Switchable menu option for a script

PostPosted: Wed Jan 15, 2020 7:23 am
by Grey-Wolf
Jarewill wrote:Might I ask what exactly do you mean by the "clean" way?

"Clean" as in "without weird hacks and coded as a gentleman would", lol.

Grey-Wolf wrote:Hope this helps.

It did, thank you very much!