• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Cannot assign to "100" - its a constant

  • Thread starter Heretic Game Studios
  • Start date
H

Heretic Game Studios

Guest
Hello GMC Community,

I am getting an error when I compile my game that states:


In Script script6 at line 2 : Cannot assign to "100" - it's a constant

Compile Failed - Please check the Compile window for any additional information

Here is script6:

if place_meeting(x,y,obj_bub)
{
(100 * score_multiplier) += score_total;
}

anyone know this is happening?
 

Surgeon_

Symbian Curator
You wrote the assignment backwards.

(100 * score_multiplier) += score_total; basically translates to "increase 100*score_multiplier by score_total", which makes no sense.

You should change it to score_total+=(100 * score_multiplier); which means "increase score_total by 100*score_multiplier".
 
I

icuurd12b42

Guest
it's
variable = new value...
not
new value = variable

This is like pouring coffee cups into coffee ;)

score_total = (100 * score_multiplier);
you are using this +=
score_total += (100 * score_multiplier);

so make sure the variable was initialised to 0 before adding to it.
 
Top