Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

Javascript syntax errors with basic expressions

$
0
0
The error I get is Scripts/Gamble.js(17,23): BCE0044: expecting ), found '='. if I double up that equals sign I get Scripts/Gamble.js(13,18): BCE0034: Expressions in statements must only be executed for their side-effects. var balance : float = 0.0; var payOut : float = 0.0; var betAmount : float = 100.0; var profitOnWin : float = 0.0; var rollUnderToWin : float = 0.0; var diceNumber : float = 50.0; var totalWin : float = 0.0; public var winChance : float = 0.0; function FixedUpdate (){ totalWin == payOut*betAmount; profitOnWin == totalWin-betAmount; rollUnderToWin == winChance; if (winChance == 50.0){ payOut == 1.98; } if (winChance == 25.0){ payOut == 3.96; } if (winChance == 10.0){ payOut == 9.9; } // //if button press, call function DiceRoll } function DiceRoll (){ diceNumber == Random.Range(0.0,100.0); if (diceNumber <= winChance){ GUI.Label(screenRect, "You Win!"); //add profit to balance balance+=profitOnWin; } if (diceNumber >= winChance){ GUI.Label(screenRect, "You Lose!"); //subtract betAmount from balance balance-=betAmount; } } I have no idea what I'm doing wrong with the syntax here, I've been making adjustments for hours and can't get it.

Viewing all articles
Browse latest Browse all 7934

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>