Thanks for all your answers! Very welcoming. :-)
Offline
What are the good practices under Snap! 4.0 for dealing with pre-conditions? And in BYOB 3.1.1? In BYOB 3.1.1 I would use on of the debug blocks to enter debug mode before reporting some invalid result, in the case of reporters, or simply stopping, in the case of commands.
Offline
MMSequeira wrote:
custom blocks are not localizable.
Is there a Google translate API that could be used?
Offline
MMSequeira wrote:
What are the good practices under Snap! 4.0 for dealing with pre-conditions? And in BYOB 3.1.1? In BYOB 3.1.1 I would use on of the debug blocks to enter debug mode before reporting some invalid result, in the case of reporters, or simply stopping, in the case of commands.
You could write an ASSERT block with a Boolean input that gives the error message if the input is false.
Truth is, though, we don't encourage our students to do that sort of sanity checking, because we are targeting non-computer-scientists, and I think teacher rigidity about proper programming style is the second biggest turnoff in traditional intro CS education (after Java syntax). We don't even give error messages based on user-declared input slot types. Better a few errors than students deciding this field isn't for them.
They can learn defensive programming later on, from someone else.
Offline
1) What's the cloud thing meant to do? It doesn't work at the moment.
2) How come the http block only works in the snap.berkley.edu domain?
Last edited by joefarebrother (2012-11-15 15:16:58)
Offline
joefarebrother wrote:
1) What's the cloud thing meant to do? It doesn't work at the moment.
2) How come the http block only works in the snap.berkley.edu domain?
1) Exactly what you observed - It doesn't work at the moment.
2) Some kind of XSS protection, I'd guess
Offline
Dreammod & nXIII,
Any progress on a BYOB to Snap! converter? I should have some cycles this weekend to start getting involved with this effort. Is one of you (nXIII?) on the verge of having a complete implementation? Or does it make sense for both efforts to move forward in parallel?
In case either of you wants that complex test case I mentioned, here's the library: http://www.newlifeinteractive.com/technologies/gameblocks/GameBlocks_v0.2.1.zip.
I have some video tutorials on YouTube I can share if you want to see how the blocks actually work, but none of this is public yet. I think there are performance issues that should be addressed before this library would be doing anyone any favors. :-)
Thanks,
Offline
alloplastic wrote:
Dreammod & nXIII,
Any progress on a BYOB to Snap! converter? I should have some cycles this weekend to start getting involved with this effort. Is one of you (nXIII?) on the verge of having a complete implementation? Or does it make sense for both efforts to move forward in parallel?
In case either of you wants that complex test case I mentioned, here's the library: http://www.newlifeinteractive.com/technologies/gameblocks/GameBlocks_v0.2.1.zip.
I have some video tutorials on YouTube I can share if you want to see how the blocks actually work, but none of this is public yet. I think there are performance issues that should be addressed before this library would be doing anyone any favors. :-)
Thanks,
You can try out the converter here. The "download" checkbox is a convenience for Chrome users which will save the .xml file automatically. (The other stuff is for debugging )
Last edited by nXIII (2012-11-15 22:00:12)
Offline
nXIII,
Wow, it worked really well. About 98% of the code came through just fine. The only issue I saw was that some of the list argument slots in my custom blocks didn't come through quite right. I see text like "% list of sprite names" instead of an active slot for the variable "list of sprite names."
Here are screen-grabs of blocks with this problem:
http://www.newlifeinteractive.com/technologies/gameblocks/img/Hide_Sprites_Block.png
http://www.newlifeinteractive.com/technologies/gameblocks/img/Launch_On_Sprites_Block.png
And here's one where the list slot ("costumes") was converted correctly:
http://www.newlifeinteractive.com/technologies/gameblocks/img/Cartoons_Play_Block.png
There are some other problems caused by my library's use of deprecated blocks like "object" and "the script." I have a Snap! question about how to migrate such code to the new block set... but I'll put that into a separate post.
Thanks for sharing the converter. I'm sure that there are other developers out there like me who will be thrilled to have a migration path to Snap!
Offline
So, here's my question on Snap!
A key feature of BYOB for my game blocks library is the ability to run code on a sprite other than the one in which the script appears. This allows for an NPC conversation or cut-scene to be coded in the flow of a single script. It also allows for blocks like "launch on sprites" that create basic particle effects or convenience blocks like "hide sprites" for changing game levels.
My question is how might this be accomplished in Snap? I see an input slot for an "Object," and the slot looks a lot like the default sprite, but I don't see how to fill that slot with a reference to a sprite. Does it only accept code objects? I see that I can put a "ringed" item in there like a code block.
One trick my BYOB library uses is iterating through a list of sprite objects by name. The code is something like "Run [The Script] of [object <sprite name>]," as pictured here:
http://www.newlifeinteractive.com/technologies/gameblocks/img/Hide_Sprites_Block.png
Is there any way to accomplish the same sort of remote-control of multiple sprites in Snap?
Offline
alloplastic wrote:
deprecated blocks like "object" and "the script."
The OOP features that were added in BYOB 3.1 aren't in Snap! yet and probably won't be until 4.1, so hold off on converting OOP projects.
But THE SCRIPT should (@nXIII) be converted to a ring in Snap!.
Offline
bharvey wrote:
alloplastic wrote:
deprecated blocks like "object" and "the script."
The OOP features that were added in BYOB 3.1 aren't in Snap! yet and probably won't be until 4.1, so hold off on converting OOP projects.
But THE SCRIPT should (@nXIII) be converted to a ring in Snap!.
It is converted to a ring…
The most frequent "obsolete" block is (attribute) OF (object), which usually has a script inside of it.
Last edited by nXIII (2012-11-17 11:02:28)
Offline
nXIII wrote:
joefarebrother wrote:
2) How come the http block only works in the snap.berkley.edu domain?
It's an XMLHttpRequest thing.
Is it possible to use some other object than XMLHttpRequest since you only need to read the files contents not execute any scripts on the page?
Offline
joefarebrother wrote:
nXIII wrote:
joefarebrother wrote:
2) How come the http block only works in the snap.berkley.edu domain?
It's an XMLHttpRequest thing.
Is it possible to use some other object than XMLHttpRequest since you only need to read the files contents not execute any scripts on the page?
That's not the reason it's blocked, but the only real alternative to a direct XMLHttpRequest is an one to a server on the same domain which would just echo the contents of the URL (or CORS, but only if the specific server allows it).
Last edited by nXIII (2012-11-17 11:59:39)
Offline
nXIII wrote:
joefarebrother wrote:
nXIII wrote:
It's an XMLHttpRequest thing.Is it possible to use some other object than XMLHttpRequest since you only need to read the files contents not execute any scripts on the page?
That's not the reason it's blocked, but the only real alternative to a direct XMLHttpRequest is an one to a server on the same domain which would just echo the contents of the URL (or CORS, but only if the specific server allows it).
hmm. I wonder if it would be that much strain on the servers. It is, after all, literally one line of PHP required:
<?php echo file_get_contents('http://www.' . $_GET['url']); ?>
But how expensive is file_get_contents() and how many would use block at once? It would be useful, though...
How likely is it that this will be implemented?
Offline
joefarebrother wrote:
nXIII wrote:
joefarebrother wrote:
Is it possible to use some other object than XMLHttpRequest since you only need to read the files contents not execute any scripts on the page?
That's not the reason it's blocked, but the only real alternative to a direct XMLHttpRequest is an one to a server on the same domain which would just echo the contents of the URL (or CORS, but only if the specific server allows it).
hmm. I wonder if it would be that much strain on the servers. It is, after all, literally one line of PHP required:
Code:
<?php echo file_get_contents('http://www.' . $_GET['url']); ?>But how expensive is file_get_contents() and how many would use block at once?
Wouldn't this then basically turn the server into a proxy?
It would probably be worth at least adding mime-type checks to ensure you're not returning a binary image or something that Snap! won't like...
Offline
nXIII wrote:
It is converted to a ring…
Ah, sorry, I should have known better. Decades ago, my brilliant mentor Ralph Gorin told me, "Never believe anything a user says"!
PS It's very hard to post a reply to a message that includes an embedded Snap! project.
@jfb, blob: Jens says we'll use CORS to solve the HTTP: block problem. I am trying to avoid learning the details, trusting that he'll make it all happy.
Offline
bharvey wrote:
@jfb, blob: Jens says we'll use CORS to solve the HTTP: block problem.
To Jens, then: if I understand it correctly, doesn't CORS have to be enabled on any servers you want to make requests to?
Offline
blob8108 wrote:
bharvey wrote:
@jfb, blob: Jens says we'll use CORS to solve the HTTP: block problem.
To Jens, then: if I understand it correctly, doesn't CORS have to be enabled on any servers you want to make requests to?
Yeah, the server at the request URI has to send the Access-Control-Allow-Origin header.
Last edited by nXIII (2012-11-17 16:30:39)
Offline
nXIII wrote:
blob8108 wrote:
bharvey wrote:
@jfb, blob: Jens says we'll use CORS to solve the HTTP: block problem.
To Jens, then: if I understand it correctly, doesn't CORS have to be enabled on any servers you want to make requests to?
Yeah, the server at the request URI has to send the Access-Control-Allow-Origin header.
Awww, that's what I thought. There's no way of doing it from one domain to any domain, then.
Offline
bharvey wrote:
PS It's very hard to post a reply to a message that includes an embedded Snap! project.
Agreed. You need to add a built-in URL shortener to Snap! to compress those crazy URLs.
P.S. Can we please stop adding exclamation points to Snap!?!
Offline
Hardmath123 wrote:
P.S. Can we please stop adding exclamation points to Snap!?!
I tried that one already. Apparently the exclamation mark is part of Snap!'s name.
Offline
blob8108 wrote:
Hardmath123 wrote:
P.S. Can we please stop adding exclamation points to Snap!?!
I tried that one already. Apparently the exclamation mark is part of Snap!'s name.
I'm gonna start calling it Snap*CLICK* if this keeps up.
Offline
Hardmath123 wrote:
I'm gonna start calling it Snap*CLICK* if this keeps up.
I believe the correct pronunciation would be "Snap-bang" if you're not happy with the intended staccato "Snap."
Okay, look, Jens doesn't like it either (although he did at the beginning), but the point is that there are about a zillion things called "snap," including half a zillion computer-related things, and the exclamation point is supposed to make this one stand out from the crowd. And it's also supposed to be onomotopoetic, because of the sound the blocks make as they snap together. Aren't those things worth the occasional awkwardness of a sentence that ends with "Snap!"?
Offline