Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

Is there a Modulus Operator?

9 years ago

I can't seem to get it to work because using the '%' symbol screws with all my other variables.

If there isn't, is there a way to divide two numbers and take the remainder? (Ex: 10 % 7 = 1 Remainder 3)?

Is there a Modulus Operator?

9 years ago

There's no decimals used, so nope.

Otherwise you could do (10/7 - 1) * 7, and get 3.

Why do you need it?
 

Oh nvm, apparently you can use this:

[Dividend-{(Dividend/Divisor)*Divisor}]

So, 27 % 16=

27- {(27/16)*16}

27-{1*16}

Answer= 11

Is an example.

Is there a Modulus Operator?

9 years ago

Thanks! I needed it for a variable that triggers different events periodically in the game, and having a modulus was the easiest way to do it.

Really appreciate it, Killa - you're a bona fide scripting guru, haha.

Is there a Modulus Operator?

9 years ago

Don't praise me too much, I stole the formula after a quick google search, haha.

Is there a Modulus Operator?

9 years ago
I shall praise your mad google searching skills instead then XD