Discuss Scratch

Dale_Mahalko
New to Scratch
68 posts

Snap! user discussion

Okay, whoops, I didn't see delete in the Open box. Though that is a weird UI design. “To delete something, go to the Open menu”..
bharvey
Scratcher
1000+ posts

Snap! user discussion

Dale_Mahalko wrote:

Though that is a weird UI design. “To delete something, go to the Open menu”..
Agreed. This will improve when the new back end and new web site are finished.

Dale_Mahalko
New to Scratch
68 posts

Snap! user discussion

Trying to figure out how to store polyphonic music notes in lists as a “player piano” type scroll. This probably is not a good idea as there is no way (that I can find) to insert data fields between already existing fields, so I can't insert or delete if the notation is not correct.

Also the script editor is probably going to gag on a scroll containing a few hundred note lists in a single huge object like this

note-octave/(sharp/flat)/length in beats/instrument

http://i.imgur.com/mFafKe1.png

I don't know of a way to edit a list of lists of lists of music notes outside the browser, and then paste it in.


Dale_Mahalko
New to Scratch
68 posts

Snap! user discussion

Also I suppose I should explain the padding. I want all cells for the music notes to be arranged vertically so I can easily see the beat timing. If I don't pad the cells that aren't actively playing notes, then all the small cells end up on the same line and it is very hard to visualize what I am doing…

http://i.imgur.com/0DFKx5y.png
bharvey
Scratcher
1000+ posts

Snap! user discussion

If you make a CSV file, e.g., in a spreadsheet, you can convert it to a list of lists this way:

1. Make a global variable and leave its watcher on the stage.
2. Right-click the watcher and select “import.”
3. Load your file.

You now just have a large text string. To convert it to a list of lists, do this:

The hard-to-read character in the second input slot of the first SPLIT block is a comma.

Dale_Mahalko
New to Scratch
68 posts

Snap! user discussion

hmm, I guess in-Snap music isn't going to work as I was expecting. There are only four “waveform instruments”, I don't have access to MIDI instruments, and I can't set an imported sound sample as an instrument and play it at different speeds to simulate notes.

Also trying to use the waveform instruments at high speeds, just results in a very loud popping/clicking noises.

http://snap.berkeley.edu/snapsource/dev/snap.html#present:Username=lhs-dmahalko&ProjectName=Instrument%20popping%20noise

dev_in_spain
New to Scratch
4 posts

Snap! user discussion

bharvey wrote:

Hi, welcome!

We have ways to do more or less what you want, without any need to modify the Snap! source code. But you may not be satisfied with our solution because it's possible (by design!) for students to “escape” into the full Snap! environment.

To hide primitives, right-click (control-click, however your computer does secondary click) on the grey background of the palette (the area at the left where the available blocks are listed) and choose “hide primitives.” (You have to do this in each of the eight palettes.) Alternatively, you can hide primitives one by one, by right-clicking on a particular block in the palette and choosing “hide.” When you save a project, the hidden status is saved with it, so when students load the project they will see the reduced palette you've set up.

But of course a student can right-click on the palette and choose “show primitives.” Our idea is that students understand that games have rules, and that a reduced-palette project is a game, in which they are to solve a puzzle under constraints. And we really hate the idea of limiting students' being in control of their tools.


Thanks, for the welcome and the great information. I see in the Hour of Code (http://snap.berkeley.edu/hoc/#1) that you have a similar approach, was that a custom built project, or is something like that potentially configurable? Is that source code available? My aim is to provide a minimalistic UI similar to the HoC that I have mentioned earlier.


As for sharing projects, by default when someone opens a shared project it starts in presentation mode, in which only the stage (at double size) is visible. We haven't implemented a separate viewer because it wouldn't really be able to eliminate much of the Snap! code; in order to interpret scripts and run animations, you need the scheduler, the interpreter, the Morphic widget manager, etc. You can add “&hideControls” to the URL of the shared project to hide the buttons above the stage, making it harder to get out of presentation mode, but of course this isn't a real security feature because someone who wants to read the code can just load the project and delete that part of the URL.

One thing you should know is that if you run your own copy of Snap! it will be unable to save projects to our cloud storage back end, which accepts connections only from snap.berkeley.edu and our official mirror sites. This restriction isn't because we want to discourage people modifying the code; there are several fantastic Snap! mods that we love, but they run their own back ends. We just don't want people to use our online storage for things other than Snap! projects.

I hope this helps.

Thanks, we have our own backend to store the results, and to use them to present the results again. So we will do some hefty customizations if need be to handle pairing down the UI and saving to our backend etc.

Thanks again
bharvey
Scratcher
1000+ posts

Snap! user discussion

Dale_Mahalko wrote:

Also trying to use the waveform instruments at high speeds, just results in a very loud popping/clicking noises.
There's a pending pull request fixing this, I think. We know that music isn't in great shape; Javascript doesn't give us very good access to MIDI. Someday…

Dale_Mahalko
New to Scratch
68 posts

Snap! user discussion

I made a simple hexadecimal to binary converter. As usual I am sure this is far from ideal, but it works.

http://snap.berkeley.edu/snapsource/dev/snap.html#present:Username=lhs-dmahalko&ProjectName=Hexadecimal%20string%20to%20binary%20v0.1

I can see the result value on the stage, but I can't figure out how to actually copy the result to the clipboard so that I can paste it into Notepad. There is an Export option when I right-click on the output string on the stage, but this just opens a new blank tab in Chrome. If I click on it in the variable list, it shows the data as a tool tip but again I can't copy it to the clipboard.

Is there a way to insert the output into an editable list box that I can then Copy to the clipboard in the UI?

,

(Yes, I'm using this as a real world utility language for work…)

RegQueryValue: HKCU\Software\Microsoft\Windows\CurrentVersion\CloudStore\Store\Cache\DefaultAccount\$$windows.data.unifiedtile.startglobalproperties\Current\Data
Type: REG_BINARY
Length: 181
Data: 02 00 00 00 BD A2 58 5C 06 12 D3 01 00 00 00 00

I need that data string in binary…
bharvey
Scratcher
1000+ posts

Snap! user discussion

Dale_Mahalko wrote:

There is an Export option when I right-click on the output string on the stage, but this just opens a new blank tab in Chrome.
Congratulations! You are the first to report a bug newly introduced in the dev version. Export works properly for this project in non-dev Snap!, and also in dev in Firefox, but not Chrome.

Dale_Mahalko
New to Scratch
68 posts

Snap! user discussion

I have never liked the Scratch code commenting system. Comments stick out way off to the right, but typically the script editing area is very width-limited, and it is very annoying to have to scroll around to read comments.

What I would prefer is inline comments which can be inserted directly into the code as a code block. I have found a sort-of workaround for this. I define a variable named “Rem” and stick all my comments in there. But there are two downsides.

1. This is a variable that does nothing but is constantly changing its values with each comment line, so there is likely a tiny impact on performance

2. Multiline commenting in an expanding list box is apparently not possible, so writing multi-line inline comments this way is difficult and annoying, and must be split across multiple separate “Set Rem To” statements. I do not see any particular reason why a multiline text box should not be permitted.
Dale_Mahalko
New to Scratch
68 posts

Snap! user discussion

I am still trying to figure out the mechanics of my “Mario knockoff” to make it run at a high framerate.

Apparently objects can be “drawn” outside the viewport, they just are not visible. So apparently I could spawn all sprite blocks to generate the entire world right away when the level loads. It is unclear to me if having hundreds of sprites existing outside the viewport makes rendering slower.

I suppose I could tell sprites to hide themselves if they are outside the viewport, and to unhide just as they are about to come into view in the viewport, so that they don't need to be clipped as they are already hidden anyway. It is unclear to me if a hidden object uses less processing if it is outside the viewport.

If sprites slow the rendering whether hidden or visible and outside the viewport, then the third route is to constantly load sprites just in front of the player off-screen, as the player moves forward, and also removing sprites that have gone off-screen behind the player. This keeps the total world sprite count as low as possible.
Dale_Mahalko
New to Scratch
68 posts

Snap! user discussion

Oh… no…..

I just got an “Oh snap!” in Chrome after a few hours of editing the Mario thingy. I didn't save my work in a while. Arrrrgghhh..

Lost about 2-3 hours of intense work. I see no way to recover it. It just reloaded an old save from hours ago when I reloaded the page.

Last edited by Dale_Mahalko (Aug. 15, 2017 10:05:20)

bharvey
Scratcher
1000+ posts

Snap! user discussion

Dale_Mahalko wrote:

What I would prefer is inline comments which can be inserted directly into the code as a code block.
I just make a block that doesn't do anything:


For multiline inputs, you can load the “allow multi-line text input” library and then

bharvey
Scratcher
1000+ posts

Snap! user discussion

Dale_Mahalko wrote:

It is unclear to me if having hundreds of sprites existing outside the viewport makes rendering slower.
I don't think so. That is, I guess it takes a little time to check that they are outside, but they aren't rendered, I'm pretty sure.

It is unclear to me if a hidden object uses less processing if it is outside the viewport.
Hidden objects do not take time to render.

Just try writing your program as simply as possible, and if it's too slow, then we can worry about how to fix it. Also, try the dev version, which is faster for some things.

P.S. Sorry about your crash! Autosave is high on my list.

vgbonilla
New to Scratch
1 post

Snap! user discussion

@Jonathan50, I've downloaded your websocket project and installed it on my custom server. I serve Snap! with your websocket enhancement. I connect via "open websocket to ws/“ and I see the traffic on my server, my server upgrades the connection to websocket and then when O try to use ”send to websocket >", I get nothing. Would you be able to help me understand your code?

Thanks in advance,
Victor
Jonathan50
Scratcher
1000+ posts

Snap! user discussion

vgbonilla wrote:

@Jonathan50, I've downloaded your websocket project and installed it on my custom server. I serve Snap! with your websocket enhancement. I connect via "open websocket to ws/“ and I see the traffic on my server, my server upgrades the connection to websocket and then when O try to use ”send to websocket >", I get nothing. Would you be able to help me understand your code?

Thanks in advance,
Victor
Ok, I don't actually know much about how to use websockets, but the SEND block takes the websocket it is passed and uses the JavaScript .send method on it. You need to be sure to save the result of the OPEN WEBSOCKET block in a variable and then pass that to the second parameter of the send block, like this:
set [websocket v] to (open websocket to ws://[the address goes here] :: sensing)

send [Hello] to (websocket) :: sensing
and make sure you are listening for data on the server-side.

Last edited by Jonathan50 (Aug. 16, 2017 00:29:46)


Not yet a Knight of the Mu Calculus.
michael971
Scratcher
13 posts

Snap! user discussion

I'm trying to create multiple stages/backdrops and switch them in SNAP, I see that SCRATCH lets you change backdrops.
bharvey
Scratcher
1000+ posts

Snap! user discussion

michael971 wrote:

I'm trying to create multiple stages/backdrops and switch them in SNAP, I see that SCRATCH lets you change backdrops.


To get the TELL block, choose “Import tools” from the File menu. You can put a background name or number in the input slot.

(The reason for the roundabout notation using the RUN block is that the SWITCH TO COSTUME block's pulldown menu will have the sprite's costumes, not the stage's.)

Dale_Mahalko
New to Scratch
68 posts

Snap! user discussion

This does not work. I have no idea why. Apparently accessing data in multidimensioned arrays does not work the way I expect it should.

Image:
http://imgur.com/8LSLseU

Inside: Error
expecting list but getting number

—————–

How to do what I mean?

CLEAR
DIM ARRAY(96,16)
FOR I = 1 TO 96
FOR J = 1 TO 16
ARRAY(I,J) = I + J
NEXT J
NEXT I

——————–

Also, I want to randomly access cells without having to sequentially “Insert” to all cells linearly first. How do I do this?

DIM ARRAY%(96,16)
ARRAY%(95,13) = 3

Powered by DjangoBB