-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEditor.txt
More file actions
109 lines (100 loc) · 2.32 KB
/
Editor.txt
File metadata and controls
109 lines (100 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
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};
};