I checked the source code, and tried this

untitled script pic (1)

But it doesnt work. Am I missing something?

Same for this

untitled script pic (2)

And this

untitled script pic (3)

Why are you trying to use javascript? Why can't you just use those blocks?

I am trying to understand the source code of snap, that's why im testing things. I got understanding of other blocks, but blocks with functions of "do" in the beginning don't work for some reason. I am sure they work the othey way that i don't know

Well, you should probably change the category to Advanced Help with Snap!

alright, forgot this one existed

Alright, i see a pattern. Blocks that i can't call are located in threads.js, while others are located in objects.js.



Can call using this. + function


Can't call using this. + function, gives an error that it is not a function

So the question is how do we call functions from threads.js?

you don't. Forget about JS and learn Snap! instead. Feel free to explore the source code but please don't use this forum to ask questions about it. This forum is about learning CS with Snap, not about discussing technicalities about how Snap is made.

(Also, anything you hope to learn from reading the sources is probably going to be useless in the next version, as we're planning to fundamentally change how blocks work internally)

well, I'm not sure I fully understood what you just wrote, but if it's any help we're planning to make it so (much) more of Snap! is going to be written in Snap! itself in the future.

Yeah, sorry. I ramble. I'm just going to delete it.

I'm stuck, basically, I've read all of Brian's textbooks, SICP, a textbook on compiling, the Traditional C manual, the ANSI C manual, a textbook written to explain why the C manual was written, the GNU LIBC which explains why they added the commands they did... and a couple of other textbooks, including 70 pages of the Vulkan reference manual before I closed the pdf, deleted it, then deleted the pdf reader I used (and then re-installed it, because it's useful)

I also have the source code of a lot of older games in C, a couple of apps written in C++ and some other esoteric things.

And still get stuck at ground zero because my brain doesn't WORK like that. It just doesn't, and I hate that most of the CS world thinks that stuff makes any level of sense. (It's Gibberish)

Snap! makes perfect sense to me, and yet... Still can't get anywhere.

well, in my case i was just trying to get all blocks functions to combine it with tosh syntax we made in js, so that we could make a text editor for snap, but here is jens telling me no

p.s my gf spent like 3 days making tosh's syntax in js, but i [***] up my part with getting snap functions т-т, she ll probably get them for me too lol

Yeah, I get his reasoning, but I also understand yours.

Like, I want to build a text editor that blockifies any and all languages and also keeps the text visible, and if you're crazy, can add a window that shows the assembly and the source code (Kinda like Compiler Explorer does)

I want to build native apps that use my hardware to it's maximum to teach myself how the sausage is made. And I want to use blocks to do it, because Augmented Reality? Makes far more sense with a visual language baseline than it does a text one. It just does. Drag and Drop with my fingers in a 3D space instead of a mouse and keyboard? Yes pls, even if I have to do it myself. (And I'm an idiot)

I saw this thread and the other thread, which is why I signed in and commented. You're doing good work as far as I can tell. Keep it up.

sounds impossible, blockify [censored by moderator] xd

Probably is tbh lol.

Thanks! Tho my worst part is me not knowing any text languages expect a bit of lua. Even js, i get confused a lot there.

YYYUUP!. I keep trying to port Quake to snap. If only so I can use snap to SEE that code in motion and see it running, and figure it out that way, because reading it textually? Nooope.

Also, the original Quake does a pretty cool thing where it has it's own internal parser for QuakeC which is a mini C for quake level scripting. Kinda like what the SICP calls meta-circular programming.

What I'd do is put quake in snap and then put snap in quake, so I can blockify the console amongst other things. Then do the same with other games I grew up with and see if I can learn anything that way.

For example;

cvar_t chase_back = {"chase_back", "100"}; (Which defines a CVar (Console VARiable), and it's variable, but also an alias so you can activate and de-activate that in game. So if I'm adding that as a dictionary in snap am I adding the chase_back twice? or once and then telling the dictionary which one it wants... but what if it wants both? Which it does... GAH. Then I Alt-F4 notepad and snap and go play fortnite.

wait bh isnt it language's name?