Fix If
Dieser Commit ist enthalten in:
Ursprung
1e9f7e7cf1
Commit
91cc6bc64c
@ -40,6 +40,16 @@ public class If implements SpecialCommand {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (command[2].equals("exists")) {
|
||||
if (scriptExecutor.isVariable(command[1])) {
|
||||
setIndex(scriptExecutor, command[3]);
|
||||
} else {
|
||||
if (command.length > 4) {
|
||||
setIndex(scriptExecutor, command[4]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Value v1 = scriptExecutor.getOrItselfValue(command[1]);
|
||||
Value v2 = scriptExecutor.getOrItselfValue(command[2]);
|
||||
if (v1.getClass() != v2.getClass()) {
|
||||
@ -50,10 +60,17 @@ public class If implements SpecialCommand {
|
||||
return true;
|
||||
}
|
||||
if (v1.asString().equals(v2.asString())) {
|
||||
scriptExecutor.setIndex((int) asLong(command[3]));
|
||||
setIndex(scriptExecutor, command[3]);
|
||||
} else if (command.length > 4) {
|
||||
scriptExecutor.setIndex((int) asLong(command[4]));
|
||||
setIndex(scriptExecutor, command[4]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void setIndex(ScriptExecutor scriptExecutor, String name) {
|
||||
int jp = scriptExecutor.jumpPoints.getOrDefault(name, -1);
|
||||
if (jp != -1) {
|
||||
scriptExecutor.setIndex(jp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren