Jamesernator
New member
Basically
can for some commands immediately end the ASH script, this is observable with the following script:
If this code is run after using for example a single
then it won't execute the rest of the script.
Now there is an (awful) workaround for this, by abusing `try-finally` you can ensure that some code will always run so this will still work:
However this doesn't seem a great solution as there's no way to wrap any of that logic in another function without having to still wrap `try-finally` around that e.g.:
This means you can't create generic functions that rely on executing an arbitrary CLI command.
---
Now it seems to be the case that `cli_execute` creates some weird "exception"-like thing, so I think the best addition for this would be to add a `catch` statement to `try` e.g.:
Code:
cli_execute
Code:
void main() {
cli_execute("Briefcase collect");
cli_execute("terminal extrude booze");
cli_execute("terminal extrude booze");
cli_execute("terminal extrude booze");
cli_execute("cheat ancestral recall");
cli_execute("cheat 1952 mickey mantle");
cli_execute("cheat island");
cli_execute("breakfast");
cli_execute("genie pocket wish");
cli_execute("genie pocket wish");
cli_execute("genie pocket wish");
cli_execute("teatree shake");
print("Dailies done");
}
If this code is run after using for example a single
Code:
terminal extrude
Now there is an (awful) workaround for this, by abusing `try-finally` you can ensure that some code will always run so this will still work:
Code:
void main() {
try {
cli_execute("Briefcase collect");
} finally try {
cli_execute("terminal extrude booze");
} finally try {
cli_execute("terminal extrude booze");
} finally try {
cli_execute("terminal extrude booze");
} finally try {
cli_execute("cheat ancestral recall");
} finally try {
cli_execute("cheat 1952 mickey mantle");
} finally try {
cli_execute("cheat island");
} finally try {
cli_execute("genie pocket wish");
} finally try {
cli_execute("genie pocket wish");
} finally try {
cli_execute("genie pocket wish");
} finally try {
cli_execute("teatree shake");
} finally {
print("Dailies done");
}
}
However this doesn't seem a great solution as there's no way to wrap any of that logic in another function without having to still wrap `try-finally` around that e.g.:
Code:
void terminal_booze() {
try {
cli_execute("terminal extrude booze");
} finally try {
cli_execute("terminal extrude booze");
} finally try {
cli_execute("terminal extrude booze");
} finally {
return;
}
}
void main() {
try {
cli_execute("Briefcase collect");
} finally try {
terminal_booze();
} finally try {
cli_execute("cheat ancestral recall");
} finally try {
cli_execute("cheat 1952 mickey mantle");
} finally try {
cli_execute("cheat island");
} finally try {
cli_execute("genie pocket wish");
} finally try {
cli_execute("genie pocket wish");
} finally try {
cli_execute("genie pocket wish");
} finally try {
cli_execute("teatree shake");
} finally {
print("Dailies done");
}
}
This means you can't create generic functions that rely on executing an arbitrary CLI command.
---
Now it seems to be the case that `cli_execute` creates some weird "exception"-like thing, so I think the best addition for this would be to add a `catch` statement to `try` e.g.:
Code:
void execute_safe(string command) {
try {
cli_execute(command);
} catch {
return;
}
}
void main() {
execute_safe("Briefcase collect");
execute_safe("terminal extrude booze");
execute_safe("terminal extrude booze");
execute_safe("terminal extrude booze");
execute_safe("cheat ancestral recall");
execute_safe("cheat 1952 mickey mantle");
execute_safe("cheat island");
execute_safe("genie pocket wish");
execute_safe("genie pocket wish");
execute_safe("genie pocket wish");
execute_safe("teatree shake");
print("Dailies done");
}