- Home /
HELP!! expecting :, found ';' problem
Ok, I wrote a javascript that could switch my flashlight on and off and I get this ERROR message,
Assets/Scripts/Player/Flashlight.js(19,29): BCE0044: expecting :, found ';'.
and here's the script:
var FlashLight_On = true; var intensity : float;
function Update () {
if (FlashLight_On == true) {
light.intensity == 3.1;
if (Input.GetKeyDown(KeyCode.L)) { FlashLight_On == false; } }
else (FlashLight_On == false); {
light.intensity == 0.0;
}
}
I have no idea what's wrong with my script.
BCE0044: expecting :, found ';'.
The two answers will fix your problem, but you're getting the error because you're trying to assign the 'false' value to 'FlashLight_On' with '==', when you need to use a single '='.
Answer by azzogat · Jan 16, 2011 at 10:43 AM
This should work just fine. Looks prettier too :) .
var FlashLight_On = true; var intensity : float;
function Update(){
if (FlashLight_On) light.intensity = 3.1; else light.intensity = 0.0;
if (FlashLight_On&&Input.GetKeyDown(KeyCode.L)) { FlashLight_On = false; } }
Answer by Paulius-Liekis · Jan 16, 2011 at 10:39 AM
Use "=" instead of "==" in the assignments?
Your answer
Follow this Question
Related Questions
custom function syntax error 1 Answer
scripting problem with if statements 1 Answer
error with script plz help! 2 Answers
HELP ME PLEASE!----------------------------!? 1 Answer
An EOF Problem :( 1 Answer