|
@@ -51,6 +51,8 @@ public final class Script {
|
|
|
|
|
|
private final ArrayList<AutoCloseable> closeables = new ArrayList<>();
|
|
private final ArrayList<AutoCloseable> closeables = new ArrayList<>();
|
|
|
|
|
|
|
|
+ private long endTime = 0;
|
|
|
|
+
|
|
public Script(ScriptManager sm, Consumer<Script> onTerm, String name, String... path) {
|
|
public Script(ScriptManager sm, Consumer<Script> onTerm, String name, String... path) {
|
|
ifState.push(true);
|
|
ifState.push(true);
|
|
this.id = idCounter++;
|
|
this.id = idCounter++;
|
|
@@ -97,7 +99,7 @@ public final class Script {
|
|
public void run() {
|
|
public void run() {
|
|
isWaiting = false;
|
|
isWaiting = false;
|
|
|
|
|
|
- long endTime = System.nanoTime() + 15_000_000;
|
|
+ endTime = System.nanoTime() + 15_000_000;
|
|
while(lineIndex < code.length && !isWaiting && !isHolded) {
|
|
while(lineIndex < code.length && !isWaiting && !isHolded) {
|
|
Instruction instr = code[lineIndex];
|
|
Instruction instr = code[lineIndex];
|
|
try {
|
|
try {
|
|
@@ -142,7 +144,7 @@ public final class Script {
|
|
isHolded = false;
|
|
isHolded = false;
|
|
run();
|
|
run();
|
|
}
|
|
}
|
|
- }, 1);
|
|
+ }, 5);
|
|
scriptManager.getLogger().print("auto scheduler was activated", null,
|
|
scriptManager.getLogger().print("auto scheduler was activated", null,
|
|
instr.getName(), name, this,
|
|
instr.getName(), name, this,
|
|
new StackTrace(instr.getLine(), returnStack, code));
|
|
new StackTrace(instr.getLine(), returnStack, code));
|
|
@@ -347,4 +349,8 @@ public final class Script {
|
|
public boolean equals(Object o) {
|
|
public boolean equals(Object o) {
|
|
return o != null && o instanceof Script && ((Script) o).id == id;
|
|
return o != null && o instanceof Script && ((Script) o).id == id;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public void addTimer(long l) {
|
|
|
|
+ endTime -= l * 1000000;
|
|
|
|
+ }
|
|
}
|
|
}
|