Thanks again for the awesomely quick reply and wonderful feedback. I wish I could understand it better. Sorry I'm slow and thanks for your patience. I don't mean to question your knowledge or your experience, I only try to probe further so that I can understand better.
O.K., so the first thing was that I needed spaces around my parens and brackets, like geever said, and then it would run, Thanks geever.
However the code in the onClick event of the checkboxes didn't seem to work. Does my code in onClick over ride the checkbox's code? Does the checkbox's onClick event work? I'm lost on why it's not working. Here is what I did:
checkbox effects_box
{
current *cvar:snd_volume
pos "85 170"
size "20 18"
image "ui/checkbox_blue"
onClick { if ( *node:this@current < 1 ) { *cvar:snd_volume = 0.5 }
if ( *node:this@current > 0 ) { *cvar:snd_volume = 0.0 }
}
}
Duke, I am sorry man, that went right over my head.
Why is there a big difference with playing sound at 0.0 and not playing it at all? Do you think I should release those resources instead of using them at an imperceptible level?
Are you saying I should use *cvar:snd_init = 0.0 instead of *cvar:snd_volume = 0.0 in the checkboxes onClick event? Is that what you meant by split the enabling cvar and handle it in the code?
Side Note: I didn't touch the sound_init checkbox code but when I hit it in the game it shuts off the sound like I would expect but when I re-check it, it doesn't come back on. Does it work right on your copies? Maybe I just broke mine.If you wanna run the same event as it would run on clicking you can call *node:thatnode@onClick.
Ok, I understand the calling the onClick event to trigger it, and that is cool, but I am like majorly lost on the thatnode part. I think I tried *node:parent.effects_box, and *node:options.options_sounds.effects_box and *node:effects_box, all with the @onClick and it wouldn't parse. The Console said it had no clue what I was talking about and I responded, yeah that apparently makes two of us. I don't know if I had a typo or if it's just my syntax but the console didn't like my node paths.
Btw. using the same cvar for the checkbox and the volume bar is not a nice solution. I suggest using a different one for checkboxes.
You are most likely right in this opinion, and I don't mean to question your knowledge or experience, but why? From my newbish position I am getting interaction with the bar and checkbox simply in response to the value of the cvar. Since I am still confused on what I am doing, it is nice to tie it in that way. The user clicks on the bar and if the value is higher than 0.0 and the checkbox is unchecked then the checkbox becomes checked, and also if the bar's value is 0.0 the checkbox becomes unchecked. No additional coding required. This also occurs when the checkbox is checked or unchecked, the bar is changed to reflect the status. Though I still don't understand why the music volume is being set to what appears to be 0.1 instead of 1.0. What am I missing by doing this? Why do you feel that it's not a nice solution? What benefit do I get by using a new cvar for the checkboxes?
You can save them to other cvars..
(Assigning a value to a cvar also creates it if didn't exist.)
I am still pending on this as I can't get my onClick event to work, but I was wondering if this would carry over after I exit the game? For example I have it set to 0.23 and then click on the checkbox. The checkbox saves the 0.23 to the
*cvar:previous_sound_setting = *node:thatnode@current
where thatnode is the path to the relevant bar. Then I play and exit out with the sound off. Later that day I get back on the game but this time want sound so I click the checkbox which fires for example, the code:
*cvar:snd_volume = *cvar:previous_sound_setting
Will the *cvar:previous_sound_setting still be set to 0.23?