Skip to content

Commit

Permalink
Merge pull request #3 from DevKevYT/1.8.3
Browse files Browse the repository at this point in the history
1.8.3
  • Loading branch information
DevKevYT committed Aug 27, 2020
2 parents c7e36ec + a97f0cb commit b6b03b6
Show file tree
Hide file tree
Showing 3 changed files with 1,041 additions and 63 deletions.
109 changes: 109 additions & 0 deletions Editor.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
#Devscrip console editor by Sn1pe2win#

currentLine = 0;
lines = [];
printHeading = {
println "";
println "OFFICIAL DEVSCRIP CONSOLE EDITOR";
println "Type /help for a list of commands";
println "";
};

printAll = {
call $printHeading;
call $printLinesUntil (length $lines);
};

recieveInput = {
print $0 ">";
return (input);
};


printLinesUntil = {
for i $0 {
print $i ">" $lines[$i];
println "";
};
};


exec cls;
call $printHeading;

loop {
input = (call $recieveInput $currentLine);
if ($input != "") {
if ($input == "/edit") {
println "EDIT LINE?";
line = (input);
call $printLinesUntil ($line + 1);
print "NEW: ";
newLine = (input);
if ($newLine != "") {
$newLine === $lines $line;
exec cls;
call $printAll;
} {pop $lines $line;currentLine = ($currentLine - 1)};
} {
if ($input == "/list") {
exec cls;
call $printAll;
} {
if ($input == "/run") {
whole = "";
for i (length $lines) {
whole = ($whole + $lines[$i]);
};
println "";
exec cls;
call $printAll;
println "";
println "+++EXECUTING+++";
println "";
script $whole;
println "";
print "Done. Press Enter...";
input;
exec cls;
call $printAll;

} {
if ($input == /help) {
println "Available commands:";
println "/help, /run, /edit, /list, /new, /save, /load";
println "Fun fact: This program is written in the devscript language! Take a look into the Editor.txt file!";
} {
if ($input == /new) {
lines = [];
currentLine = 0;
exec cls;
call $printAll;
} {
if ($input == "/save") {
println "SAFE FILE TO? (Use */ for current path)";
file = (getFile (input));
for i (length $lines) {
writeFileLine $file $lines[$i];
};
println "FILE SAVED TO" $file;
} {
if ($input == /load) {
println "LOAD FILE FROM? (Use */ for current path)";
file = (getFile (input));
fl = (readFileLines $file);
lines = $fl;
currentLine = ((length $fl) + 1);
println "FILE LOADED";
} {
push $input $lines;
currentLine = ($currentLine + 1);
};
};
};
};
};
};
};
} {exec cls;call $printAll};
};
Loading

0 comments on commit b6b03b6

Please sign in to comment.