-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from DevKevYT/1.8.3
1.8.3
- Loading branch information
Showing
3 changed files
with
1,041 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}; | ||
}; |
Oops, something went wrong.