Script Variable from .cfg
Moderator: Moderators
-
omniscient
- Major General
- Posts: 694
- Joined: Tue Sep 16, 2003 12:02 am
Script Variable from .cfg
is it possibel to make a script variable varied by a value in a config file? if so, how?

-
omniscient
- Major General
- Posts: 694
- Joined: Tue Sep 16, 2003 12:02 am
-
omniscient
- Major General
- Posts: 694
- Joined: Tue Sep 16, 2003 12:02 am
-
omniscient
- Major General
- Posts: 694
- Joined: Tue Sep 16, 2003 12:02 am
You could do this in the cfg file:
set "test_variable" "2"
Then in your script you could do:
set "test_variable" "2"
Then in your script you could do:
Code: Select all
while(getcvar test_variable != "2")
waitframe
iprintlnbold_noloc "Yay you execed the fancy cfg file!!"
-
omniscient
- Major General
- Posts: 694
- Joined: Tue Sep 16, 2003 12:02 am
-
omniscient
- Major General
- Posts: 694
- Joined: Tue Sep 16, 2003 12:02 am
-
omniscient
- Major General
- Posts: 694
- Joined: Tue Sep 16, 2003 12:02 am
I ahte to bring this back but could i do:
set "test_variable" 2
Then in the script :
would that work
set "test_variable" 2
Then in the script :
Code: Select all
while(getcvar test_variable = 2)
waitframe
iprintlnbold_noloc "Yay I execed the fancy cfg file!!"

-
dcoshea
- Colour Sergeant
- Posts: 94
- Joined: Thu Mar 04, 2004 3:00 am
- Location: Sydney, Australia
- Contact:
The thing is, you detect that the player hit the key when the value of the variable CHANGES - so you'd initialize the variable to some value, say 0:omniscient wrote:I ahte to bring this back but could i do:
set "test_variable" 2
Then in the script :
would that workCode: Select all
while(getcvar test_variable = 2) waitframe iprintlnbold_noloc "Yay I execed the fancy cfg file!!"
Code: Select all
setcvar "test_variable" 0Code: Select all
while (1) { // loop forever
while (getcvar "test_variable" == 0) {
waitframe
}
// we got here because the variable is no longer 0
local.newval = getcvar "test_variable"
iprintln_noloc "the variable changed to " local.newval
// now set the variable back to 0 again, waiting for the next change
setcvar "test_variable" 0
}Regards,
David
-
omniscient
- Major General
- Posts: 694
- Joined: Tue Sep 16, 2003 12:02 am
-
omniscient
- Major General
- Posts: 694
- Joined: Tue Sep 16, 2003 12:02 am
