Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

GMLive.gml

Livecoding for GameMaker: Studio / GameMaker Studio 2 · By YellowAfterlife

[Fixed] Repeat Block Oddity

A topic by VacantShadeGames created Oct 18, 2019 Views: 159 Replies: 1
Viewing posts 1 to 2
(1 edit)

So, GMS syntax will allow this with no problem:

repeat( 0 ){ do_something() }

with the result being that the function is not called, it simply skips over the block.


However, if you run GMLive in the script, it will instead always perform the block 1 time, even if your repeat value is 0.

I came across this because, whether good practice or not, I often use repeat blocks with variables, for example:

repeat( n_times ){ do_something() }

and that n_times can sometimes be 0.


An easy way to circumvent the issue is just to wrap any repeat blocks like that with an if statement to insure the value is above 0, but a fix to the extension to be in line with typical GMS syntax would be more convenient.

Developer

Hello! This is fixed in today's release (1.0.22)