02-26-2025, 07:53 AM
(02-13-2025, 08:35 PM)kyonides Wrote:(02-13-2025, 03:19 PM)Zeriab Wrote: The conditional branch script command requires the result to specifically be either true or false. Try putting in a number like 12 and you'll see the conditional branch being skipped as well.
Expanding it to work with truthy and falsey values is a good idea ^^
Well, I run a test to see what happens if you simply pass a number to a custom method like the following:
Code:class Interpreter
def is_true?(var)
var
end
end
It doesn't alter the value by default but just returns the argument immediately as you can see above.
Result: true
As people might already know, numbers and many other objects are treated as true by default.
My fix takes anything you might have put as a script condition and negates it twice. Thus, if it was a number, any non NilClass object or a TrueClass one, it will always be true. This means it does respect the need to evaluate to true or false. All nil's would become false and stop being ignored by the conditional branch. Great, don't you think?
That code's all fine and dandy, but that's doesn't represent what the default code does. For that the code got to look something like this:
Code:
class Interpreter
def is_true?(var)
var == true
end
def is_false?(var)
var == false
end
end
I agree that your change is a good one. Skipping the branch completely when the script call returns something other than true or false is weird.
As you said, double negation will turn a truthy value into true and a falsey value into false. It's a fine way of doing things ^^
Quote:Regarding the command_355 stuff, I do understand your desire to add the waiting time but I don't share it. My variant is inspired by VX ACE where any result of the script event command evaluation does NOT become an integral part of the interpretation mechanism. Meaning that it won't stop executing it just because it returned a falsey value like it does in XP.
Anyway, I'd need to get access to a few edge cases where I can clearly see the need to use another version or fix it some other way before I would dare to modify it or replace it.
Looks like I did it to get a less risky version of waiting for movements completion: https://save-point.org/thread-874.html
Having a new dedicated command would be better, but only Unite supports editing the editor
*hugs*
![[Image: ZeriabSig.png]](http://www.twinkfish.com/al/ZeriabSig.png)