Help with the coordinates on my grid block

What’s problem you are encountering?

On certain numbers there are extra coordinates, ex: 11x11 should be 121 yet I get 144 spots. the first set of numbers it does this is with is 11 to 31 before randomly working again after 32 and before 11.

What have you tried that didn’t work?

I’ve deleted the extra number that was being created but then it made where only 11 to 31 would work. Id put an if to check if its between or equal to 11 and 31 then delete it but I don’t know if its a larger issue that makes more numbers down the line not work.

Post a project example, link, or screenshot:

again, the if (11>size<31) worked on the deleting part, but I’m worried its not full proof and will break again on larger numbers.

Hi, in this project, i rewrite this part:

see inside

into this part:
image

A few constructive remarks:

Find better names for your variables… Ex: the var “A” doesn’t mean anything, nb coordinate is more representative in this case.

This is not a local var:


Use this instead:

Block variables lets you create a variant of script
variables for this block: A script variable is created when a block is called, and it disappears when that call
finishes. What if you want a variable that’s local to this block, as a script variable is, but doesn’t disappear
between invocations? That’s a block variable. If the definition of a block includes a block variable, then every
time that (custom) block is dragged from the palette into a script, the block variable is created. Every time that
copy of the block is called, it uses the same block variable, which preserves its value between calls. Other copies
of the block have their own block variables.

Hope it help !

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.