"a variable of name '0' does not exist in this context"

So I set ‘number’ of the parent Sprite to ‘0’ and somehow the clones tried to fetch the variable with name ‘0’
https://snap.berkeley.edu/snap/snap.html#present:Username=angzarr_812new&ProjectName=Snake%20bot

Alright, so in your program you have this:

Snake bot script pic

What that does is ask the other clones not for the variable “number”, but rather takes the value of “number” - that is 0 - and asks the other clones for the variable 0. You need to ringify the “number” variable to avoid having it be evaluated and then given to the ask block.

Snake bot script pic (1)

PS: This was the kind of error you were getting:

Ah! thanks

Now my problem is that the Snake will not move after the berries have been generated
Edit: I mean I fixed it but now it wont move

I don’t see a snake sprite in the first place.

its a clone

Instead of asking the other clones for a variable, you instead might want to use this instead

Snake bot script pic

You can get here by first selecting the sprite in the second input, then when you open the first menu, there will be a “number” option. Select that, then drop (my [other clones V]) into the second slot.

You have to clone a sprite.

lol I forgot that existed
I mean I didn’t forget but it didn’t work when I used it with script variables ((number)) @> then forgot all about it

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