# Making a clone run a function from a variable

I have a function that saves a function, along with other data, into a list contained in a variable

There is another function that creates a clone with the needed information.

It runs the script, but on the original object instead of the clone

The issue you're facing goes in line with this topic

And also, you shouldn't need to create variables programmatically, you can just add to a list. If you have a reason to use the create var block, then I'd like to hear why.

To get your script to work, just do this

tell (object [myself]) to (item (3) of (var(ownpart)))


(Sorry, I didn't want to create the script in snap).

And if you're thinking, why would I have to do this? I agree. A sprite should not need to tell itself to run a script from a variable.

I used variable creation instead of lists, because I thought that the lists were the reason the clone didn't move.

(In case you didn't see my edit)

Oh, and if you're using this, you don't need to create variables, you can use a list.

The variables do make the project simpler and smaller though, so I'm going to keep them

Just to let you know, jens doesn't like the create variables library. He's only keeping it for libraries that require global/local variables. I can tell that your use can be done without it, so it might be better.

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