However, it appears to be executed several times per click - the “visible” property flashes on and off, and sometimes the item toggles the visibility, and sometimes it doesn’t.
I have had this happen with a Python script too… whenever I press a button, it executes the appropriate code 3 or 4 times!
Would someone be so kind as to tell me what is going on?
Because there is exactly one frame rendered per frame (in lag situation it might be skipped).
lets see what you wrote:
A)
When
mouse left button pressed AND
mouse cursor over object AND
property click is False
Then
show object
play action forward
click = True
B)
When
mouse left button pressed AND
mouse cursor over object AND
property click is True
Then
hide object
play action forward
click = False
Lets skip what is the same condition in both situations: mouse click and mouse over
Lets skip what does not influence followup logic: playing action and showing/hiding
It remains:
If property click == True -> property click = False
If property click == False -> property click = True
… I thought that the click event would only be true once per click.
Yes, the logic should not be that hard
When Clicked () {
IF (visible)
{
text.hide
visible=false
}
if (!VISIBLE) {
text.show
visible=true
}
}
But I still don’t follow why it is toggling multiple times per click, sir - I can see it flashing, and again, sometimes it ends up changing state of visibility and sometimes it doesn’t when it is done flashing.
Does this have something to do with the number of frames in the animation? Like an odd or even # of frames would produce a different result?
Ahhh… by telling it to “skip”, I get the flashing to go much slower. So “Left Button” is less of an singular “event” and more of a “condition”. How do I get the logic to work such that it only fires ONCE for every click?
Now what you said makes sense! I had a bad assumption about what “triggers” Left Button.
Both mouse sensors measure the “click”. The “not click” is measured by them as well. To activate actuators on the inverse you connect them with a NAND (rather than an AND) controller.