[Solved] Have a variable every 100 add 1 to another variable?

hello I have a variable called fruitscore that adds 1 to another variable called compcounter for every 100 of fruitscore. how to I do that in 1 event and not have to add an event every 100, 200, 300 etc?


Do one of these two solutions help?

  • Start compcounter at -1.
  • Check whether mod(fruitscore, 100) = 0 (with a trigger once) and increment compcounter by 1.


  • make compcounter = trunc(fruitscore/100)

thanks for reply the first solution I’m not sure exactly how to do that also what is mod?
the second solution I tried adding

but comes up you must enter a number?

Mod is short for modulo

Try trunc(Variable(fruitscore)/100). I was using pseudo code.

thanks ok that works but for some reason the compcounter starts at 1 and not 0?


I had meant for you to use compcounter = trunc(…) as an action, not a condition.

However, you may have unwittingly identified a third, even better way - modify that condition just a tad by making it " < trunc(Variable(fruitscore)/100)". That should work for you.

It also means if score jumps from say 98 to 120, compcounter will still get incremented just once. It’ll also cover a sudden big score change, like from 20 to 550.

1 Like

that worked perfectly and with multiples of 100 thanks for your help!