Discuss Scratch

marsmark
Scratcher
83 posts

Scratch++ | A text based Programming Language made in Scratch

Scratch++ | Introductory to text based programming

Scratch++ is a custom coded programming language/engine made in Scratch that combines the fundamental aspects of text based programming languages with the syntax of Scratch code blocks. Designed mainly for experienced Scratchers who are planning to advance into text based programming and Scratchers who have already advanced beyond Scratch. Read further to read the instructions on how to write Scratch++, I will try to explain it in as Scratch user friendly as possible.

This documentation is outdated! Check out the new ones link below!

Project Link: https://scratch.mit.edu/projects/723487329/
New Forum Link: https://scratch.mit.edu/discuss/topic/696737/?page=1#post-7366904

Last edited by marsmark (Dec. 5, 2023 11:40:09)

derpproking
Scratcher
3 posts

Scratch++ | A text based Programming Language made in Scratch

Yay
seriously good job.
when I receive [A great project]
say [wow nice job this is really good]
marsmark
Scratcher
83 posts

Scratch++ | A text based Programming Language made in Scratch

derpproking wrote:

Yay
seriously good job.
when I receive [A great project]
say [wow nice job this is really good]

when I receive [complement v]
play sound [cries in happiness v]
minecoins_inc
Scratcher
8 posts

Scratch++ | A text based Programming Language made in Scratch

OMG THIS IS AMAZING
marsmark
Scratcher
83 posts

Scratch++ | A text based Programming Language made in Scratch

minecoins_inc wrote:

OMG THIS IS AMAZING
Thank you so much!
marsmark
Scratcher
83 posts

Scratch++ | A text based Programming Language made in Scratch

Tiny update here:
As of v1.0.21b update, you are allowed to use “else” command written right after “if” statement. Here's a little example.
if 3 == 4 {
set test to 1
} else {
set test to 2
}
I've also updated the original thread as well.
derpproking
Scratcher
3 posts

Scratch++ | A text based Programming Language made in Scratch

marsmark wrote:

Tiny update here:
As of v1.0.21b update, you are allowed to use “else” command written right after “if” statement. Here's a little example.
if 3 == 4 {
set test to 1
} else {
set test to 2
}
I've also updated the original thread as well.
Thanks! I always wanted the else statement!
derpproking
Scratcher
3 posts

Scratch++ | A text based Programming Language made in Scratch

I was messing around with the code and I decided to make an easy-to-use angled step system, but it says there is an error on line zero. Maybe this is just a bug on my end, here is the code if you want.
main.scr/ask(“Starting x”)§set x to (answer())§ask(“Starting y”)§set y to (answer())§ask(“distance to travel”)§set targetdist to (answer())§ask(“angle of travel”)§set direction to (answer())§define step(dir,dist){§change x by (cos((dir))*(dist))§change y by (sin((dir))*(dist))§}§define report(x,y,dir,dist)§print “We are at x:”(x)“, y:”(y)“.”§print “We traveled a distance of”(dist)“at an angle of”(dir)“.”§}§step(direction,targetdist)§report(x,y,direction,targetdist)§


What is does is this:
when green flag clicked
ask [Starting x position?] and wait
set [X] to (answer)
ask [Starting y position?] and wait
set [Y] to (answer)
ask [How far do you want to travel?] and wait
set [targetdist] to (answer)
ask [What angle do you want to travel at?] and wait
set [direction] to (answer)
and then functions to step and evaluate the end result.

Last edited by derpproking (Nov. 10, 2022 20:38:45)

marsmark
Scratcher
83 posts

Scratch++ | A text based Programming Language made in Scratch

derpproking wrote:

main.scr/ask(“Starting x”)§set x to (answer())§ask(“Starting y”)§set y to (answer())§ask(“distance to travel”)§set targetdist to (answer())§ask(“angle of travel”)§set direction to (answer())§define step(dir,dist){§change x by (cos((dir))*(dist))§change y by (sin((dir))*(dist))§}§define report(x,y,dir,dist)§print “We are at x:”(x)“, y:”(y)“.”§print “We traveled a distance of”(dist)“at an angle of”(dir)“.”§}§step(direction,targetdist)§report(x,y,direction,targetdist)§

So… 2 things.
1. I've fixed the ask() function from methods that takes no parameter that now allows you to input a string. For example ask(“How are you?”)
2. You need to assign ask() to to a variable, it's not an independent function.

In your case,
main.scr/set x to ask(“Starting x position?”)§set y to ask(“Starting y position?”)§set targetdist to ask(“how far do you want to travel?”)§set direction to ask(“what angle do you want to travel at?”)§

It's a little bit buggy importing, Scratch doesn't allow some characters.

Last edited by marsmark (Nov. 11, 2022 02:32:16)

DimensionalGuard53
Scratcher
4 posts

Scratch++ | A text based Programming Language made in Scratch

I have a simple question: Has tech just, restarted at square one at this point?
marsmark
Scratcher
83 posts

Scratch++ | A text based Programming Language made in Scratch

DimensionalGuard53 wrote:

I have a simple question: Has tech just, restarted at square one at this point?
what do you mean?
DimensionalGuard53
Scratcher
4 posts

Scratch++ | A text based Programming Language made in Scratch

marsmark wrote:

DimensionalGuard53 wrote:

I have a simple question: Has tech just, restarted at square one at this point?
what do you mean?
I mean, from what I can tell. Scratch++ is text only, just like the early days of programing (Like on the Commadore PET). And back then to get anything close to graphics you had to use text characters. I'm not saying add more graphics though, I'm just pointing out the similarities.

some ASCII characters for minimal graphics would be nice though again, not pressuring you.
marsmark
Scratcher
83 posts

Scratch++ | A text based Programming Language made in Scratch

DimensionalGuard53 wrote:

marsmark wrote:

DimensionalGuard53 wrote:

I have a simple question: Has tech just, restarted at square one at this point?
what do you mean?
I mean, from what I can tell. Scratch++ is text only, just like the early days of programing (Like on the Commadore PET). And back then to get anything close to graphics you had to use text characters. I'm not saying add more graphics though, I'm just pointing out the similarities.

some ASCII characters for minimal graphics would be nice though again, not pressuring you.
It's just that I have no knowledge on frontend stuff. Might be a good update once I learned something related.
Gamergalaxy689
Scratcher
100+ posts

Scratch++ | A text based Programming Language made in Scratch

please don't tell me someone is going to make a coding game, in Scratch++, which is a coding game, in Scratch, which is a coding game too.
marsmark
Scratcher
83 posts

Scratch++ | A text based Programming Language made in Scratch

Gamergalaxy689 wrote:

please don't tell me someone is going to make a coding game, in Scratch++, which is a coding game, in Scratch, which is a coding game too.
Scratch++ doesn't have graphic capabilities, but someone might make a coding engine inside Scratch++ that was able to make computer graphics. That can only mean one thing,

Scratch inside Scratch insi…
DimensionalGuard53
Scratcher
4 posts

Scratch++ | A text based Programming Language made in Scratch

marsmark wrote:

It's just that I have no knowledge on frontend stuff. Might be a good update once I learned something related.

I know a lot about it and I can summarize it.
ASCII is the standard text & text rendering scheme for all computers and keyboards, there's 3 categories that are self explanatory.
  • Printable: These are the characters you see and can generally use
  • Control: These control how it's rendered but that is unrelated to this
  • Extended: These are the ones I'm talking about, they aren't generally used but are easily accessible on many older computers.

Here's a table of all of them, no need to add all of them, just the ones that look like graphics (like characters 200-206)

I counted all the ones that look like graphics already, there's 22. And I think to access them it could be a simple tab somewhere that allows it. Like you've might've seen I know what it's like so once again, I'm not pressuring at all. If you need info I'll be happy to give it!

Last edited by DimensionalGuard53 (Nov. 14, 2022 05:26:15)

ihavecandy7
Scratcher
23 posts

Scratch++ | A text based Programming Language made in Scratch

Suggestion: Add String Functions.

A great approach would be to implement methods similar to how strings are in python:
“hello!”.capitalize()

Why not add `.replace()`?
“(A)”.replace(“(A)”, “Hello.”)

This would allow for formatting and easier implementation of text generators.

In other words, this is a fantastic project! Keep going!

Last edited by ihavecandy7 (Nov. 14, 2022 11:40:59)

marsmark
Scratcher
83 posts

Scratch++ | A text based Programming Language made in Scratch

ihavecandy7 wrote:

“(A)”.replace(“(A)”, “Hello.”)
Great suggestions, I'm still trying to figure out a way to do it. I might just make it the first 3 parameters methods.

ihavecandy7 wrote:

“hello!”.capitalize()
Added upper(“”) and lower(“”), thanks for suggestion!
IceWolfNinjaThe2nd
Scratcher
5 posts

Scratch++ | A text based Programming Language made in Scratch

Is it possible to declare a variable like this: var b = random(1, 255) as an example
marsmark
Scratcher
83 posts

Scratch++ | A text based Programming Language made in Scratch

IceWolfNinjaThe2nd wrote:

Is it possible to declare a variable like this: var b = random(1, 255) as an example
set b to random(1, 255)

Powered by DjangoBB