Discuss Scratch

dawidkrainski
Scratcher
100+ posts

Snap! Team development discussion, vol. 2

Look here
bharvey
Scratcher
1000+ posts

Snap! Team development discussion, vol. 2

dawidkrainski wrote:

Look here
I made a comment on github…

liam48D
Scratcher
1000+ posts

Snap! Team development discussion, vol. 2

On the topic of the “arguments” block.. how did I not know about this?

This shows a list containing just 5:

run ({
say (arguments)
} @addInput :: grey ring) with inputs [5] @delInput @addInput :: control

This throws an error (arguments variable does not exist in this context):

run ({
say (arguments)
} @addInput :: grey ring) @addInput :: control

I don't think that should throw an error, in my opinion.

This throws the same error:

run ({
say (arguments)
} input names: (name) @delInput @addInput :: grey ring) with inputs: [foo] @delInput @addInput :: control

Which is also kind of strange – e.g. if I were to do this:

({
if <<(length of (arguments) :: lists) = [0]> or <not <is (name) a [string v] ? :: operators>>> then
throw [Expected name (string) as first argument] :: control cap
end
} input names: (name) :: grey ring)
Hopefully that fits in the post completely..

..I'd get an error. Instead I have to do this:

({
script variables (name) @delInput @addInput :: grey
if <(length of (arguments) :: lists) = [0]> then
throw [Expected name (string) as first argument] :: control cap
end
set [name v] to (item (1 v) of (arguments))
if <not <is (name) a [string v] ? :: operators>> then
throw [Expected name (string) as first argument] :: control cap
end
} input names: (name) :: grey ring)

And finally, it only works with lambdas. I suppose that makes sense though, as lambdas are really the only place where you could have a variable number of inputs.

202e-202e-202e-202e-202e UNI-CODE~~~~~
dawidkrainski
Scratcher
100+ posts

Snap! Team development discussion, vol. 2

I think it easy to fix. Give me a moment.
dawidkrainski
Scratcher
100+ posts

Snap! Team development discussion, vol. 2

Done, but you have to not use context parameters.
For example:
XXX
run ({say (arguments)
say (a)} input names: (a)(b)(c) @delInput@addInput::ring grey) with inputs: [1] [2] [3]::control

^^^::operators
run ({let (a^) be (item (1) of (arguments))::grey
say (arguments)
say (a)} input names: (a)(b)(c) @delInput@addInput::ring grey) with inputs: [1] [2] [3]::control

Last edited by dawidkrainski (Oct. 1, 2016 09:20:26)

bharvey
Scratcher
1000+ posts

Snap! Team development discussion, vol. 2

I'm so confused. Are you guys declaring a global variable arguments? (And if not how did you make the orange oval?)

Why is Liam making a script variable with the same name as his formal parameter?

And what does Dawid mean by “context parameters”?

And finally, what problem is this solving? Seems to me that instead of this kludge what you really want is to be able to declare an input to a lambda as being multiple, so you can say the equivalent of (lambda args …).

dawidkrainski
Scratcher
100+ posts

Snap! Team development discussion, vol. 2

This line.
By “context parameters” i mean this:
({} input names: (a)(b)(ctx params) @delInput@addInput::ring grey)

Last edited by dawidkrainski (Oct. 1, 2016 09:21:33)

bharvey
Scratcher
1000+ posts

Snap! Team development discussion, vol. 2

dawidkrainski wrote:

This line.
By “context parameters” i mean this:
({} (a)(b)(ctx params)::ring grey)
Oh. I see. If it were me, I'd much rather that when you click on a formal parameter of a lambda, the little rename box had the arrowhead you could click to turn it into the long form input dialog, with the types and bells and whistles, or at least a checkbox for variadic.

Jonathan50
Scratcher
1000+ posts

Snap! Team development discussion, vol. 2

liam48D wrote:

On the topic of the “arguments” block.. how did I not know about this?
There's an “arguments” block!?
This throws an error (arguments variable does not exist in this context):
That happened to me when I tried to pass no arguments to a block like
((foo @addInput :: grey) @addInput)
Jonathan50
Scratcher
1000+ posts

Snap! Team development discussion, vol. 2

Oh, ARGUMENTS is a Snap! variable that is implicitly bound when a procedure is called with more than zero arguments.

Why is it implicit? It means that stuff like


don't work as expected (it outputs “baz baz” instead of “baz bar”).
dawidkrainski
Scratcher
100+ posts

Snap! Team development discussion, vol. 2

Arguments variable is replaced by evaluate function. Look @up.
dawidkrainski
Scratcher
100+ posts

Snap! Team development discussion, vol. 2

Try to use this:
(call ({([] in front of (arguments)::list)} @addInput::ring grey) with inputs: [a] [b] [c]::control)
without declaring arguments variable

Last edited by dawidkrainski (Oct. 1, 2016 09:22:28)

Jonathan50
Scratcher
1000+ posts

Snap! Team development discussion, vol. 2

If I set a variable watcher to a sequence of one or more spaces the watcher displays “0”.
bharvey
Scratcher
1000+ posts

Snap! Team development discussion, vol. 2

Jonathan50 wrote:

If I set a variable watcher to a sequence of one or more spaces the watcher displays “0”.
Yeah, I think there's an open issue about this in Github.

dawidkrainski
Scratcher
100+ posts

Snap! Team development discussion, vol. 2

Hi, my new tool! Block Factory!
It's only prototype, but I think, I done it tomorrow.
To activate, just use
BlockFactoryMorph.openIn(world);

Link

Planned features:
  • Export block to JSON file
  • Make it secure (for now, if done, it can replace e.g. reportJSFunction)

P.S. I'm working on it whole day.

Last edited by dawidkrainski (Oct. 1, 2016 20:08:21)

bharvey
Scratcher
1000+ posts

Snap! Team development discussion, vol. 2

dawidkrainski wrote:

Block Factory!
So, the point of this is to avoid having to make a Snap! block that does CALL (JSFunction…)?

I'd rather have a block that takes a spec, color, shape, and script, and registers the new block without user interaction. I'd use that often!

dawidkrainski
Scratcher
100+ posts

Snap! Team development discussion, vol. 2

It can help to register “native” blocks without doing this steps:
  • Register block to SpriteMorph.prototype.blocks
  • make function in Process.prototype.<selector>
  • and add it to blockTemplates
and easy load it next time
bharvey
Scratcher
1000+ posts

Snap! Team development discussion, vol. 2

dawidkrainski wrote:

It can help to register “native” blocks without[…]
I guess the question I'm asking is why registering a native block is better than wrapping a Snap! custom block around it, e.g., as in the RGB library.

I mean, I see why it's a terrific exercise to practice doing things in Morphic! I don't mean to insult your work. Just trying selfishly to figure out if it's useful for me.

liam48D
Scratcher
1000+ posts

Snap! Team development discussion, vol. 2

Just ran into this..

Cubeupload is dead and tinypic is also dead :(

EDIT: Here's the project, if anyone's curious.

Last edited by liam48D (Oct. 3, 2016 20:07:07)


202e-202e-202e-202e-202e UNI-CODE~~~~~
-stache-
Scratcher
500+ posts

Snap! Team development discussion, vol. 2

liam48D wrote:

EDIT: Here's the project, if anyone's curious.
Oh you already made that

Last edited by -stache- (Oct. 3, 2016 20:20:25)



3x3 pb: 13.240
3x3 avg: ~21-26

Powered by DjangoBB

Standard | Mobile