a WORKING programming language WITHIN Scratch! I've wanted to do this for a very long time and I finally got it to a place where I'm happy with the result! This script that is already preloaded into the project is a script that writes the first 100 digits of the Fibonacci Sequence into Registers 5 - 105. Click the Green Flag and type in the prompt to enter code. I am working on creating a complete manual for all of the instructions built in, but for now I left a list of just a handful of them here: There are various "e" commands that effect the program rather than entering code, they are: eRun = Run the current program eSpeed = Change how many seconds between each line of code while running, 0 seconds will mean 1 frame between lines, anything less than 0 will cause the script to run instantly eBack = Erase the previous line eInsert = Insert code at a specific line eReplace = Replace a certain line of code eDelete = Delete a specific line of code eClear = Completely deletes all Code or Registers (When asked, type nothing to delete all of both) Now, onto the REAL commands: WRT [Register] [Number] = Writes the number [Number] into the register specified by [Register]. CPY [Register] [Address] = Copy the number in Register [Address] into the Register [Register]. ADD [Register] [Number1] [Number2] = Writes the sum of [Number1] and [Number2] into the register at [Register]. SUB, MUL, DIV [Register] [Number1] [Number2] = Writes the difference, product, or quotient of [Number1] and [Number2] into the register [Register]. SIN & COS [Register] [Number] = Writes the Sine / Cosine of [Number] into the register at [Register] END (No operands) = Specifies the end of the program, a loop, or an if statement. REP [Times] = Repeats every line of code between this command the next END command [Times] amount of times. IFF [Boolean] & ELS (No operands) = If [Boolean] is larger than 0, run the code, otherwise skip directly to the next END command. If there is a ELS command between the IFF and END then it will run when the [Boolean] is not greater than 0. EQL [Register] [Number1] [Number2] = Checks if [Number1] is equal to [Number2] and writes it to the register at [Register] JMP [Line] = Moves the program reader directly to the line [Line], This can be used to create infinite loops. Will take the script out of any IFF or REP loops. CRD [Register] [X position] [Y position] = Converts [X Position] and [Y position] into the RCF Format (Check Notes and Credits for more info on RCF) and then writes the RCF coordinate into the register at [Register] (STILL WIP, THIS COMMAND CURRENTLY DOESN'T LIKE NON-INTEGER X & Y POSITIONS) RDX & RDY [Register] [Address] = Reads the X/Y Position from the RCF coordinate at [Address] and writes it to [Register] DOT [Address] = Draws a single dot onto the screen at the position specified by the RCF coordinate at [Address] LIN [Address1] [Address2] = Draws a line on the screen between the RCF positions at [Address1] and [Address2] PEN [Size] [Color] = Configures the size of the pen to [Size] and the color to [Color] CLR (No operands) = Clears the screen of any pen drawings
Commands are split into two different sections, the command itself, and the operands. Operands are sections of the code that can change how the command precisely functions. i.e. How many times a loop runs, How much a number increases by, ect. On the right side there is a list called "Registers" this is where your variables will be stored, you can read from a register by putting a "0" in front of which register you want to access. i.e. REP 5 will repeat a line of code 5 times, but REP 05 will repeat a line by whatever number is in the 5th register. RCF (Register Coordinates Format) is a special format that can store a X & Y value into a single register, you don't need to be able to read RCF to use coordinates, the CRD command should do most of the work for you