This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
CCTech's profile picture

SDK The much easier way to script [BETA]

Started by CCTech, 10 May 2018 - 12:34 PM
CCTech #1
Posted 10 May 2018 - 02:34 PM
SDK
SDK is an interpreter for computercraft which comes with an "Programming" language. You don't need to add much text:


mov u 1

Instead of:


term.setCursorPos(1,1)

or:


break

instead of


shell.exit()

It is small for now.. (until I find out how to do statements etc)

But for this you can run/import lua codes from sdk! (see below how)

Features
  • Change Backgound change background colors (Blue. Green. Black, White and Pink.. more will be added soom)
  • Run/Import Lua scripts
  • Clear Background
  • Clear Line
  • Move Cursor Pos to 1,1
  • Move Cursor Pos to 1,19
Get

pastebin get 1YVySt3m

Showcase

Now a small show case..
To paint the backgorund green and the top pink use this code:


Bgcolor(green);
clearScreen;
mov u 1;
Bgcolor(pink);
mov clear;

NOTE: u need to add the ";" at the end of a line!

So and our output is: http://prntscr.com/jg4mno
So but how to run the file?

Install sdk using the pastebin code and then run it
type in the name of the scrip examle: sdktest

Now we create another file which will be a lua file.
We need to call this file : requires

This file is completly lua from CC and sdk scripting won't work.

In this file we type:


print("My first sdk file")

Now we save this file and go edit our sdktest file


Bgcolor(green);
clearScreen;
mov u 1;
Bgcolor(pink);
mov clear;

wait(userKey);

get:require(lua);

Now we open the up sdk and run the script:

Now we get the same screen as before.. but when whe press any button: http://prntscr.com/jg4t04

Description of the "functions"
Bgcolor(pink, blue, green, black, white) Select one of the colors to change the background color
clearScreen Clear the screen (and the backgorund color appers) alo set's the cursor pos to 1,1
mov u 1 Moves the cursor pos to 1,1
mov d 1 Moves the cursor pos to 1,19
Txtcolor(same as Background) Set the text color
wait(1-5) waits..
wait(userKey) waits until you press a key
break breaks the script
mov clear clears the line
get:require(lua) imports/runs how you want to call it the lua file

Note: the lua file needs to be at the same directory as your sdk script and it needs to be called: requires

To do:
  • Add statements
  • create an ide
  • Add more functions to the interpreter (Auto-Update etc.)
  • add print functions
  • And some more
Make sure to follow this topic to don't miss any new update,

Your feedback would help me making SDK better
Edited on 10 May 2018 - 12:35 PM
EveryOS #2
Posted 10 May 2018 - 03:38 PM
So wait, how do you download it again? I missed it.
Nm, I saw it buried in a wall of text

This looks very limited. I would recommend you study lexers and tokenizers.
Edited on 10 May 2018 - 01:40 PM
CCTech #3
Posted 10 May 2018 - 04:00 PM
This looks very limited. I would recommend you study lexers and tokenizers.
I know.. I once made an interpreter but that was on c and not in Lua..