Way to make event impassable?

I have very little experience with using the modulus operator in scripting/programming, but this should work:

if $game_variables[#] % 1 == 0

It checks if the remainder of dividing the variable by 1 is 0. If it is 0, then its a whole number. For example: 15 % 1 = 0  however 15.7 % 1 = 7.   So anything that has a remainder is not a whole number.

I really hope that's right, is that right Shaz? Ugh. It should be...
15.7 % 1 would give you 0.7


You could also say if $game_variables[1] == $game_variables[1].to_i


If you want to ensure the value is an integer, just enclose the whole calculation in brackets and add .to_i at the end.
Thank you seita and Shaz, my Chest is now functioning flawlessly. It makes for a very frustrating puzzle experience, but in a good kind of frustrating way.

Topic can be closed for good now. 🙂
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/way-to-make-event-impassable.18589/