if i’m reading this code right, it sounds like in problem 1 you’re trying to create a block that basically does this:
where someBooleanExpression is an expression that could change over time.
well, that’s not possible. when you call a function with a boolean argument, the value of that boolean will be captured in the initial call and will never change.
if you wanted to do something like that in javascript, you would write your function like this:
function conditionalOnGameUpdate(condition: () => boolean, handler: () => void) {
game.onGameUpdate(() => {
if (condition()) {
handler()
}
});
}
the condition argument in this example is a function that returns a boolean. that function gets called every frame and allows the expression to be re-evaluated.
unfortunately, while this is totally doable in javascript, there is no way to make a block that does this (actually there is one block that works this way and it’s pause until, but it’s special and you can’t replicate it in an extension)
as for problem 2, i have no idea what you’re trying to do here. can you draw a picture of what your block should look like and maybe give some sample code to show how it’s used?
