This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-08-25 11:35:44

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

MGNZ language

The purpose of this forum is to communicate with Rick3137 about our long-stagnant programming language.  That being said, feel free to input any ideas.

Anyway:

Looking at this, I am coming to realize that both of our scripts are, well, erm... unreadable.  This is probably due to two primary facts:

We both comment sparsely.  The only key we have to eachother's variables are the variable's names, and the code that we wrote has to be interpreted line-by-line.

It has been months since I worked on this and the purpose of lots of my scripts (and through transition, lots of your scripts) remain a mystery to me.  This is again, due to the lack of comments that I left and is one of the reasons comments are essential.


What do you think of starting over again, this time with a clear picture of what we want to accomplish.

It seems that you are trying to mimic (sort of) basic.  Just so you know what I envision:



If command:   if(this = that) { do this }
This may be broken into this:

if(this=that) {
do this code
}

[b]or this:[b]

if(this=that)
{
do this code
}


I don't consider loops important if we use the "GoBack" command.  A loop is easily imitated with the if-statement (e.g. if(condition){GoBack BeginningOfLoop}).  Overall, this is the most major deviation from common scripting that I am looking at.  Aside from being easier, the GoBack command also seems more flexible.  Functions may even be possible! And you wouldn't have to declare them.  Just place the GoBack command just before them and move the running script ahead of the function to skip it.  To access the function, simply GoBack to the beginning of the function, just after the skip-command.


I am moving away from the declaration of variables because I think if we want complex statements (e.g. 5+(x*6)  ) single-letter variables will be much easier to work with.  If we are only going to use single-letter variable names, pre-declared variables seem much easier to work with.


As I mentioned in my comment: very flexible "datatypes".  Scratch already does this for us.  I simply propose adding lists/arrays to the mix.  All variables will be lists, though many may simply have a length of 1.


As far as GUI, I want to mimic the HTML5/JavaScript canvas element.  Commands:

StrokeRect(x,y,xchange,ychange) draws a rectangle with the upper left hand corner at (x,y) and moves right by xchange and down by ychange.  Since filling in rectangles seems unrealistic (at least, until the new Scratch comes out, it may have the stretch-blocks that will make it easy), this can be abbreviated
to Rect(x,y,xchange,ychange)

Line(startx,starty,endx,endy) seems pretty self-explanatory

Colors will be difficult as Scratch doesn't have these built in.  I was thinking just setting the default color to red and using the "change pen color" block to reach the large range of colors.  Having a prebuilt gray-color and changing pen shade will give us gray scale.

changecolorby(x)
changeshadeby(x)
color = gray
color = red

For sounds, your previous method seems as good as any.  The addition of the "rest __ beats" would be nice, as well as a tempo-setting command.  A nice side effect of the rest__beats is that we may not have to have a wait command.

Show me your ideas and what you would like to see as the final product.  We'll see where we can compromise and where one of us can concede.

Last edited by MoreGamesNow (2011-08-25 11:37:31)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#2 2011-08-25 13:08:41

Rick3137
Scratcher
Registered: 2010-01-22
Posts: 57

Re: MGNZ language

If you want to start over, go ahead. I'll remix my ideas into yours. That "goback" command of yours may be ok, but there are people who would be against it. Long ago
Basic had a command called "goto" that did this . They spent many years getting rid of it
because it caused many complex and unreadable programs. Loop commands were invented to get rid of the " goto" command. Machine language commands still have a version of this called " jump".
Your idea of making something compatable with javascript is a good thing. Javascript may be the big future thing because the new Html5 rules are slowly making it as good as "Flash".

Offline

 

#3 2011-08-25 15:28:10

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: MGNZ language

My idea isn't about making it compatible with JavaScript, only similar.  That being said, we could make it VERY similar (so that you could simply cut an paste code like that below), but there is little reason to.  The reason for all that below being used is because JavaScript offers more options than we will.  Multiple canvases and filled-in squares using the examples below.

var context=document.getElementById("canvasname").getContext("2d");
context.strokeRect(0,0,40,70);
etc.

Since JavaScript has so many different web elements to connect to, the use all of its commands is unnecessary.  The language I envision is similar only in style to JavaScript, not compatible.

Anyway, thanks for the go ahead.

P.S. regarding your "goto" command (probably a better name than GoBack) that loops definitely make script easier to read.  I'll try to include both the GoBack command and the loops.


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#4 2011-08-25 15:36:05

Rick3137
Scratcher
Registered: 2010-01-22
Posts: 57

Re: MGNZ language

About making functions using your GoBack command: I've seen something like that before. The program that jumped to the function saved a return address in a memory location called a stack. Then there was a command called "return" that used this location when the function was done. This was done by the old Basic programming languages. In this case your GoBack was called "GoSub" and the function was called a subroutine. If you want you can bring all that back.

Offline

 

Board footer