-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
on stage:ready
doesn't work.
#1376
Comments
For any users with the same issue, the below is a workaround.
|
Looks like some kind of bug with evaluating the trigger condition. If I just use
it continually prints true (no instances showing "false"). The following will not print anything, even when staging:
This gives an error that the variable is not defined:
While this works as expected, including flip flopping when staging:
Obviously the |
Thought i would expand this issue instead of creating a new one since i think they are the same thing.
|
Can either of you force an exception in the code and post the log file? I'd like to see the opcodes that are executing when you're seeing the issue. It could be a problem with the compiler not properly handling suffixes in these two code paths. |
here you go. |
Looks like the stack trace got cut off in the middle, and the opcode list didn't get output. I've seen this happen where KSP doesn't finish flushing the file for a while unless you close the program. Can you try again, making sure you closed KSP? I suppose it may also be a size limitation of pastebin, but I think we've used it before for log files. |
yep here is the op code list.
Log:
|
not sure if it is related but when using a normal variable
This only works if you type it into the terminal, running it as a script doesn't cause it to trigger. |
OK, I think I know what needs to be done to make this work. The issue is that
While
This also means that you can't work around it using locks, or functions, because both cases will throw an exception that the identifier is not a valid variable. We will have to modify the compiler code so that it evaluates @TDW89 While your 2nd example doesn't work as written, it does work like this:
This is because It is interesting to note that |
I hadn't noticed this issue when it was first opened. Just looking at it now. Yes the problem is that the compiler, when it visits the ON statement, is hardcoded to assume the thing is just a simple identifier and nothing else. If it has more things in the expression, it ignores everything but the first identifier it finds - so an expression like |
Hi, I'm the guy from this reddit thread: https://www.reddit.com/r/Kos/comments/499udi/what_am_i_doing_wrong_with_the_on_trigger/ I was still running 0.18.something at that point, have updated to 0.19.2 since, and now the problem has changed. Script looks like this:
But now with 0.19.2 i get the following error:
Log says:
|
I have an inkling what might be wrong, but can you try this quick workaround: I suspect that because the steering isn't mentioned in the main body of code, the compiler isn't recognizing the need to build the right initial setup for it. |
Your suspicion that it has something to do with LOCK STEERING was right - the error disappears when i remove the it from the ON trigger. Unfortunately locking & unlocking it before the ON trigger doesnt work. |
Hmm. This problem is... sort-of new and sort-of old. old problem: Attempting to lock steering makes the steering function have a value of null for a bit before it activates for real. new problem: Now that all values must be derived from Possible solutions: I'm of a mixed mind about it. On the one hand it shouldn't be null. On the other hand being incapable of dealing properly with cases where a value does end up being null makes kOS more fragile than it should be. |
Can we just execute the trigger right before calling |
The on command is supposed to activate a trigger whenever a boolean changes state.
stage:ready
is a boolean, but for some reasonon stage:ready
always evaluates to true.The text was updated successfully, but these errors were encountered: