- Home /
Dividing two variables
Hi guys, trying to get this to work, not sure if anyone can help but I'm trying to divide two static variables (integers) from separate scripts here.
I get the error: BCE0049: Expression 'Money.MoneyCount / Prices.CostPrice' cannot be assigned to.
static var AmountCanBuy : int;
var HasSlots : boolean;
function Purchase (){
if (CoatSlots.CoatSlots < CoatSlots.CoatSlotsMax){
HasSlots = true;
}
if (HasSlots == true){
Money.MoneyCount/Prices.CostPrice = AmountCanBuy;
}
}
Ahhhh, yes, I see. Stupid mistake, thank you for clearing that up for me!
Answer by flamy · May 24, 2012 at 01:00 PM
AmountCanBuy=Money.MoneyCount/Prices.CostPrice;
left hand side shd be the variable to which you are saving the result. and right hand side the expression that yields result. this is the basics of arithmetic operation.
Your answer
Follow this Question
Related Questions
Problems with variables across scripts 0 Answers
Access variables,method from a Mono Behaviour without static use. -1 Answers
How to make a variable for color affect another object 1 Answer
Problem Setting Data Onto Another Script 1 Answer
non-static variable behaving like static (C#). Very confused. 2 Answers