Checking Algorithm

Ok, So I’m a magician and I’m trying to work out how to do an algorithm in bubble for a magic effect I’m working on,

I have a screen that has a repeating group, 1 cell and then I have 2 arrows left and right that change the RG cell, I would like to do an algorithm that when the arrow is pressed it waits 5 seconds and it checks if it’s still the same cell it triggers a custom event if not it does nothing,

I hope you understand!
Thanks in advance :slight_smile:

Sounds like you will have arrows that trigger workflow events. In the event, you can set a delay action of 5000 milliseconds. After that, you would look at the index of the repeating group and take action based on that.

Yes but I thought about having a state number so the first action of the workflow event sets the index of the RG, then it waits 5 seconds and it then checks if the previously set state is equals to the current index and if it is then it triggers an event, this will be done using “Only when” however my problem is if the user presses the arrow again does it cancel the other workflow event that’s still waiting 5 seconds or not? as if it doesn’t then when setting the state at the beginning of the new workflow will make the event trigger early when it needs to wait 5 seconds, every cell it goes to needs to wait 5 seconds, no less

Hope you understand

Hmmm, not sure I follow, but yes to using custom states! :slight_smile: I haven’t used the delay action much, but you might also think about disabling the arrow once it is clicked, so it cannot be clicked again (assuming that is what you want.)

So if the button is clicked, it does say workflow 1 for that button which includes waiting 5 seconds and then triggering a custom event, if the button is clicked again after say 2 seconds apart, I want it to do workflow 2 (which has the same actions as WF 1) but cancel the first workflow so it doesn’t trigger the event, I don’t want to disable the button whilst the delay is happening

Ahh. I can’t do an example right now, but my initial thoughts are:

Custom state click_pending as yes/no on the RG and defaults to no

–Arrow click triggers Event. There would be two Events for this click. One when click_pending is yes, one if click_pending is no.

–If Yes, set click_pending to no > do custom event

–If No, set click_pending to yes > delay 5 seconds > do custom event ONLY when click_pending is yes > set click_pending to no

I’m just not sure what is available to us during the delay.

Maybe this helps you?

–Ken

Unfortunately that didn’t work :frowning:

Here is the example project for this problem: https://bubble.io/page?name=index&id=arrowtesting&tab=tabs-1

It looks like it stops events from working during the delay however on my actual project I could press buttons ok during the delay with no problems but it’s not using this same method

Maybe these help? The do when condition is true allows something to be run every time it is true. Or Do every x seconds would allow you to check the state of things .

54%20AM

Finally worked it out!

This topic was automatically closed after 70 days. New replies are no longer allowed.