Hat block in sprite extension not runs


#1

Hi, I´ve put an event (hat) block in a sprite extension, but never runs. Even if I code this:

OnRun
(args, app, device, block) => {
// TODO
console.log(“run”);
return true;
}

I appreciate your help. Thanks, regards.


#2

That code is for live mode, correct? That may be your problem.


#3

@Best_codes No, this time is a sprite extension. Regards!


#4

Consider using a JavaScript Function, @astoctas:
https://www.w3schools.com/js/js_functions.asp
Put your function definition in the “Common code settings” section of the extension builder:
image

That works for me.


#5

@Best_codes but i am doing as simple as that

How could I make it work?


#6

Hat blocks don’t return values…


#7

@Best_codes. so how can i make it work? Thanks!


#8

Well, what do you want to do with it? @astoctas


#9

@Best_codes. I want to execute blocks under this one if a condition is true, like documentation

So does “When click in green flag”


#10

I’m working on it…


#11

@astoctas wouldn’t this code work?
image


#12

@Best_codes I guess that an event block is just like a “forever and if” but how can I code this in an extension?


#13

I’m working on an extension that does that. When I’m done, I’ll take some screenshots and send them to you. @astoctas


#14

Any news about this? Regards!


#15

Still working on it. I’ve been really busy with other stuff too. Sorry.