It's not really clear what you are describing. Having said that, there are several issues.
Plataformas references Function.Param(1) but you aren't passing in any parameters. Chances are your calculation will be negative.
Tipo_proxima_Plataforma gets a random value from 0 to 27, but you are only decoding five items (or are there more off the screen?).
You can always use Browser.Log to log to the Console, so you can see what is happening in the code.