# How do you get the script pic of a script using JS

so i need a block that does this

so if you did this

the sprite would look like

i think there must be a way to do this using JS but i don't know much about how snap!'s internal JS code works, so i cannot figure it out myself.

Javascript Code:

block = block.expression;
if (!block)
return new Costume( newCanvas(new Point( 0, 0), true), "empty");
if (block instanceof Array){
block = block[0];
} return new Costume(block.fullImage(), block.selector);


Use this code to see the script pic, the variable parameter is block.
Or change into any other name, example:

script = script.expression;
if (!script)
return new Costume( newCanvas(new Point( 0, 0), true), "empty");
if (script instanceof Array){
script = script[0];
} return new Costume(script.fullImage(), script.selector);


Now the variable parameter is script, and...
Tada!!! Use this Javascript Code to see the script pic, use this.

thank you so much. this is perfect :)

Well, I can see how this might be handy, especially with the new script builder functions.

@starbox614 I'm so happy to help people, this script is from one of my projects.

?

I'm deleting this post

I meant to reply to the ego-lay_atman-bay's post, so I'm going to delete this post.

I would prefer to have it as a primitive block; I intend to use it elsewhere (not in the script-building functions).