I am trying to make a level select screen but use variables to set all the levels icons out at a certain distance apart. I am using the script:
when gf clicked set [how many levels v] to [10] add (object [allSprites v]) to [placer v] delete (1 v) of [placer v] go to x: (-210) y: (150) script variables (a) (b) (c) (d) set (a) to [-180] set (b) to [150] set (c) to [1] set (d) to [0] repeat until < (d) = [1] > run ( go to x: (a) y: (b) of (item (c) of [placer v] ) if < < (a) = [210] > and < (b) > [-150] > > set (a) tp [-210] set (b) to ((b) - (60)) else if <(a) = [210] > stop script else set (a) to ((a) + (60)) end end if <not < (c) + (how many levels)>> set (c) to ((c) +(1) else set (d) to [1] end endthe run doesn't work in scratchblocks but it says run (the script go x a) y b)) of item (c) of [placer v].
Offline
the bit with the smilies was meant to say
go to x:(a) y:(b)
Offline
Well, first, are you thinking that after the ADD ... TO (PLACER) block you've added several items, each of which is a sprite? You've actually just added one item, a list of sprites, and when you do the DELETE you're deleting the entire list.
If I'm understanding the intent correctly, PLACER should be a variable, not a global list, and you should SET (PLACER) TO ... to get the list of sprites.
I think that explains the crash. But also, I think that you want to say
RUN [ (GO TO X: ( ) Y: ( ) ) OF (ITEM ...) ] WITH INPUTS (A) (B)
because the variables A and B aren't going to be accessible to the other sprite.
Offline