Discuss Scratch

Hardmath123
Scratcher
1000+ posts

Snap! user discussion

nXIII wrote:

But…messages are events. If you want to pass arguments or blocks or switch on values or whatever, use custom blocks or LAUNCH (depending on which evaluation model you want).

<I receive ___?> isn't what broadcasts are for, either. For example, the SAY block will (confusingly) never run here:

when ⚑ clicked
forever
broadcast a
broadcast b

when clicked
forever
if <I receive [a]?>
say [This will never run]

However, if you use an event hat block, it will work as expected:

when ⚑ clicked
forever
broadcast a
broadcast b

when I receive [a]
say [This will run]
How did you get the flag icon?

Passing arguments to events is a feature I would like. The difference between events and procedures (AFAIK) is that you can subscribe to events from multiple places, while you can only define a procedure once. So many difference scripts can handle onmousemove on the same element in JS. But you do need arguments to onmousemove, otherwise you won't know where the mouse is. (Yes, I know you should use addEventListener, I was giving an example.)
aolinger
Scratcher
2 posts

Snap! user discussion

How to build a while (expression) {} block?
Hi Snap users and devs,

After a very nice meetup with german speaking Scratch users (including Jens, the main dev of Snap) last weekend, I've tried to build a while control structure with a new block in Snap! 4.0 and I'm stuck.
My fellow colleague Carlos, a PhD in CS, tried to help and we parsed the reference manual for a clue, but didn't nailed the answer.
Please have a look at This demo project as it's difficult to explain the problem without an example.

We guessed that the problem resides in the fact that the global variable n used in the boolean expression isn't linked to the lambda action.

Thanks for any clues,

Alex Olinger, ICT teacher in Luxembourg, trying to convince other teachers of the beauty of Snap!
email removed by moderator - please don't share personal contact details on the forums!

Last edited by sparks (May 16, 2013 22:06:47)

Hardmath123
Scratcher
1000+ posts

Snap! user discussion

You need to use the call block to evaluate the condition: http://tinyurl.com/snap-while-fix

So an unevaluated boolean input gives you a lambda to use in your block's script; you need to call it (i.e. run and evaluate) to get the boolean value (this way the value changes each time you call it rather than evaluating once).

Last edited by Hardmath123 (May 16, 2013 20:23:42)

xly
Scratcher
100+ posts

Snap! user discussion

bharvey wrote:

joefarebrother wrote:

really slow

On my phone, too. But all that will change since we sent Jens an Android tablet.

I've two Android Tablets, but none of them works for Snap!
The issue is that Android virtual keyboard is not activated, and thus no information can be entered into the value slots
When you use a real external keyboard, then Snap! can be used “normally”.
bharvey
Scratcher
1000+ posts

Snap! user discussion

xly wrote:

Android virtual keyboard is not activated, and thus no information can be entered into the value slots

We know about this. It's an Android bug, and Jens has been trying to find a workaround. Meanwhile, if the input you want is a number, choose “input sliders” from the tools icon on the tool bar.

Other than that, though, how's the speed?

nXIII
Scratcher
1000+ posts

Snap! user discussion

Hardmath123 wrote:

How did you get the flag icon?
OS X: Edit – Special Characters… – search for “flag” – drag it or double-click it.
Windows: …why are you using Windows? Regardless: Alt Num2 Num6 Num9 Num1
Linux: You might be able to use the compose key; otherwise, use a character map or a unicode input mode.

Passing arguments to events is a feature I would like.
Yeah, sorry, that wasn't very clear. Good idea: passing arguments to events. Bad idea: passing arguments to events by using lists for event names and listening for <any event>.

The difference between events and procedures (AFAIK) is that you can subscribe to events from multiple places, while you can only define a procedure once. So many difference scripts can handle onmousemove on the same element in JS.
I see the difference between events and procedures more as one of who provides their implementation—procedures are intended to implement a specific behavior, whereas events are intended to allow users to define custom behavior. They don't always need to allow multiple subscriptions, though it's arguably best if they do; e.g., the old JS event model (on* properties/attributes) vs. the W3C one (add/removeEventListener).

nXIII · GitHub
aolinger
Scratcher
2 posts

Snap! user discussion

Hardmath123 wrote:

You need to use the call block to evaluate the condition: http://tinyurl.com/snap-while-fix

So an unevaluated boolean input gives you a lambda to use in your block's script; you need to call it (i.e. run and evaluate) to get the boolean value (this way the value changes each time you call it rather than evaluating once).

Wow, thanks for the explanations and the fix!

Have a great weekend,

Alex

Hardmath123
Scratcher
1000+ posts

Snap! user discussion

aolinger wrote:

Hardmath123 wrote:

You need to use the call block to evaluate the condition: http://tinyurl.com/snap-while-fix

So an unevaluated boolean input gives you a lambda to use in your block's script; you need to call it (i.e. run and evaluate) to get the boolean value (this way the value changes each time you call it rather than evaluating once).

Wow, thanks for the explanations and the fix!

Have a great weekend,

Alex

You too.
xly
Scratcher
100+ posts

Snap! user discussion

@Jens & bharvey & others

I am starting to publish some of my Snap! projects.
See : http://www.xleroy.net/Snap!/Snap!.html
Read introduction screen.
Forward me your remarks as to improve the service.
X. Leroy
xly
Scratcher
100+ posts

Snap! user discussion

I've changed my link to : http://www.xleroy.net/Snap/Snap.html, to avoid problems with !
BoltBait
Scratcher
1000+ posts

Snap! user discussion

Couple of questions:

1. What language is Snap written in… is it flash or HTML5/JavaScript?

2. Is there a Snap “player only” (without editor) for external hosting of snap projects?

3. Can it load (or translate) Scratch projects to Snap?

Last edited by BoltBait (May 21, 2013 22:46:59)


Click to play:
Hardmath123
Scratcher
1000+ posts

Snap! user discussion

1. Html5
2. Technoboy10 made one. It's not hard to hack one yourself.
3. Yes! I wrote a tool in python called snapin8r.
MathWizz
Scratcher
100+ posts

Snap! user discussion

Hardmath123 wrote:

1. Html5
I believe JavaScript would be more correct here, not that HTML5 isn't used though.

running Chromium 42.0.2311.90 with Flash Player 15.0.0.189 on Arch Linux 3.19.5-1-ck
MathWizzJsScratch && sb.js & Amber (coming soon! maybe)
bharvey
Scratcher
1000+ posts

Snap! user discussion

@sparks: C'mon, he's an adult!

Hardmath123
Scratcher
1000+ posts

Snap! user discussion

bharvey wrote:

@sparks: C'mon, he's an adult!
(It's mathwizz, actually.) So are you!
Lucario621
Scratcher
100+ posts

Snap! user discussion

Hardmath123 wrote:

bharvey wrote:

@sparks: C'mon, he's an adult!
(It's mathwizz, actually.) So are you!
I think he was referring to spark's edit to aolinger's post.

@bharvey: He's just trying to keep Scratch safe - even if he is trusted, it's still important to keep a good ‘role model’ so others don't get the idea that it's okay to post emails.
Hardmath123
Scratcher
1000+ posts

Snap! user discussion

Lucario621 wrote:

Hardmath123 wrote:

bharvey wrote:

@sparks: C'mon, he's an adult!
(It's mathwizz, actually.) So are you!
I think he was referring to spark's edit to aolinger's post.
Oh. I thought it was the persistent ignorance of adults…
@bharvey: He's just trying to keep Scratch safe - even if he is trusted, it's still important to keep a good ‘role model’ so others don't get the idea that it's okay to post emails.
*ahem*

Last edited by Hardmath123 (May 22, 2013 00:04:44)

BoltBait
Scratcher
1000+ posts

Snap! user discussion

BoltBait wrote:

Couple of questions:

1. What language is Snap written in… is it flash or HTML5/JavaScript?

2. Is there a Snap “player only” (without editor) for external hosting of snap projects?

3. Can it load (or translate) Scratch projects to Snap?

Hardmath123 wrote:

1. Html5
2. Technoboy10 made one. It's not hard to hack one yourself.
3. Yes! I wrote a tool in python called snapin8r.

Thanks for answering my questions.

Can you link me to snapin8r? I'd like to try playing with some of my projects in Snap.

Also, can you link me to the “player only”? Once I make a snap project, as a test, I'd like to host it on my web site.

If I like Snap, I'll switch over… HTML5 makes much more sense to me than flash. This will make Lightnin very happy, I'm sure!

Last edited by BoltBait (May 22, 2013 01:32:54)


Click to play:
Hardmath123
Scratcher
1000+ posts

Snap! user discussion

BoltBait wrote:

BoltBait wrote:

Couple of questions:

1. What language is Snap written in… is it flash or HTML5/JavaScript?

2. Is there a Snap “player only” (without editor) for external hosting of snap projects?

3. Can it load (or translate) Scratch projects to Snap?

Hardmath123 wrote:

1. Html5
2. Technoboy10 made one. It's not hard to hack one yourself.
3. Yes! I wrote a tool in python called snapin8r.

Thanks for answering my questions.

Can you link me to snapin8r? I'd like to try playing with some of my projects in Snap.
The code isn't public yet, but I can give you a temporary link if you want. Or I could convert a project for you if you give me the link.

You'll need to install Python 2.7.
Also, can you link me to the “player only”? Once I make a snap project, as a test, I'd like to host it on my web site.
You'll need to ask tb10…
If I like Snap, I'll switch over…
Snap! is a lot better for experimenting, but Scratch is faster and it has a huge community to go with it (unlike Snap!).
This will make Lightnin very happy, I'm sure!
You heard nothing from me… (*hides in a corner*).
BoltBait
Scratcher
1000+ posts

Snap! user discussion

You can read his message to me on my profile page. Basically he thinks I should switch to Snap because I complain too much.

Click to play:

Powered by DjangoBB