Script to only run on first use?
#1
Let's say I want a script to run on AC startup, but only the first time you run AC with the script installed.

I want to be able to have a script with set defaults that are there when you first use it, but I don't want the settings to be reset after you restart AC. (sort of like the quick setup menu when you first opened AssaultCube)

Is this possible? If so, how?
Thanks given by:
#2
if (checkalias thealiasyouwant) [ ] [ thealiasyouwant = [thedefault] ]

The first pair of brackets [ ] is empty, because if the alias already exists we don't want to overwrite it.
Thanks given by:
#3
Gibstick is right - that'll probably be the way you want to go - but in case you actually mean doing stuff only if saved.cfg doesn't exist - which is what triggers that initial setup-menu you spoke of:
add2alias delayed_firstrun [ echo "I'm doing some stuff of my own here!" ]
Naturally you'd probably want to call your own CubeScript-block (read alias) from it - just replace the (bracketed) CubeScript-block by your alias name:
add2alias delayed_firstrun my_firstrun
Another good alias to hook into is the mapstartonce, do that from autoexec.cfg and you can then use Gibstick's snippet to check whether you need to run your script or not.
my_setup = [
    my_setupOK = 1
    my_var_001 = 1
    my_var_002 = 2
    echo "done MY setup"
]
check_my_setup = [
    if (checkalias my_setupOK) [ ] [ my_setup ]
]
// the following is a handy shortcut:
addOnLoadOnce check_my_setup
HTH
Thanks given by:
#4
Gibstick was right, but that will be nice to know as well. Thanks :)
Thanks given by: