5th Snap! Problem

Jesus, 5 custom block problems already.

This is a new block though.

So, I recently saw a post about a "wait (delay) or until " block, and I wanted to make one for myself that's as simple as possible. I think that's an issue, because when I run the block to wait until the cursor is touching the sprite, it goes on forever even though the "touching [mouse pointer]?" predicate reports true.

Why does this happen, and how can I fix it?

As always, here's proof of the issue and the block's code:
(The sprite is saying the output of "touching [mouse pointer]?")

(As you can see, this is probably the simplest that one of these blocks can be.)

You have to make the condition input be a boolean (unevaluated). Then in order to test if it's true, you have to call the variable inside the block.

Wow. That's the simplest screw-up I've ever made.

Well, it's working now.

believe me, I've also had many very simple skrewups while programming, so it's normal.

Aside from the bug in your code that @ego-lay_atman-bay found, I think the logic of your procedure doesn't embody what I thought the purpose of this block is. It's supposed to stop after either the time times out or the condition is satisfied. If you say WAIT 1000 SECS OR UNTIL ... it shouldn't wait 1000 seconds. I see your block has WAIT twice in its title text, so I guess it does what it says it does, but if I'm remembering the earlier thread about this correctly, the original purpose was to provide a timeout for a condition that might never be met, so the DELAY input was a maximum delay for the block to stop. Am I confused?

P.S. Oh wait I just read the other thread you posted around the same time as this one. So you implemented both this strange block and the one that serves a more real purpose. So, never mind.

But waiting a second in between cycles through the REPEAT UNTIL block unnecessarily slows down checking the non-time condition. If you check for a collision this way, the sprites will no longer be touching by the time you make the next test! Instead of using a counter of seconds, the usual way to time things is to use untitled script pic. Remember the starting time when your block starts, then test

Another quick tip, the true false switch block only calls the statement once, even if unveiled and called the true false switch never changes its value after the block is initially ran, even if you press the switch

Always use other means to test t/f conditionals or you will have a headache trying to figure out what’s wrong

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.