Ideas for how to achieve a "HORSE" function?

I’m working on a function in my app where users can challenge each other to a game of HORSE, and then track and index the game in the app.

Basically, I just need to have a way to track the state of two buttons at once, and then if both buttons are in the same state, a progress bar with 5 states is updated.

I challenge you to a game of HORSE,
I make my shot,
you miss the shot,
you get a letter.

How do I create a tool to track how many times each player missed, and then depending on how many times the player missed, a progress bar image is then updated to reveal the next state (H-O-R-S-E).

Sorry if the explanation is loose! Happy to clarify and share images if it’s worth anybody’s time.

Hello @zach8

Below a stab at the database structure (there are better ways to do this but I suggest the one below as it may spark further ideas for your project):

Game
Title (text)
Player 1 (user)
Player 2 (user)
Winner (user)
Turns (list of turns)

Turn
Title (text)
Game (game)
Letter (options set H,O,R,S,E)
Player that got a letter (user) // if not empty the turn awarded a letter … if empty then the turn did not award a letter

Through workflow actions and conditions you can build it the necessary logic to work things out

Hope the above can get you started :sweat_smile:

2 Likes

Thanks! This is a solid solution, and I have implemented something similar, but not as thorough.

I was thinking maybe there was some kind of visual, or plug-in element that might be able to track the button states with more granular parameters, and then use conditions to change what displays based on the tracking.

Makes much more sense to just update the database and create a parameter that buttons can update, and then the parameter can be checked. Thanks again!

1 Like

Can you offer any insight on how to call the option set, one at a time, in sequence? I have a field for my user called HORSE that tracks how many letters have been acquired in a game, and I have a button for the user to take a letter. The workflow uses the button to update the field, and in theory, each time the user presses the button the field should update to add the next value from the option set.

I tried using “only when” in the workflow to define parameters that check what’s in the HORSE field after the user presses the button to take a letter, and then update from the option set accordingly to run through the sequence.

So, in theory, the user presses a button to take a letter, and then the database checks which letters the user already has, and then the workflow updates the database in the sequence of the option set until HORSE is achieved, and the game ends. So, if you have “H”, and you take a letter, the database updates to “HO”.

But, I figured my logic might be a little weak, and it definitely is. The workflow takes the first button press, and then once the HORSE field is populated, it runs the entire sequence of “only when” actions . So, press the button once, and you get the full option set.

I want each button press to increment through the option set. Any help, or recommendation is greatly appreciated. I’ve tried searching all the terms that I can think of to solve this, but haven’t come up with anything yet.

I tried substituting “result of step 1, 2, etc.” in the workflow conditionals but that produced the same result: one press of the button produces the full option set.

Hi there, @zach8… just throwing a slightly different take on the option set out there as food for thought. I might consider having the options in the set be H, HO, HOR, HORS, and HORSE (in that order, of course). Then, I might have a number field that stores the number of letters a user has, and when a user takes a letter, I would increment that number by 1, and I would get and display the corresponding item # from the option set. Does that make sense and do you think it could work for you?

Best…
Mike

2 Likes

Hey Mike, yeah that’s what I wound up doing for the option set, each value is the incremeneted value: H, HO, HOR, etc.

But I cannot figure out how to increment the number by one. I’m guessing I’m probably over-complicating it. I tried setting the HORSE field as a number, and then putting together a workflow to update the field by adding 1 each time the button is pressed, but I could not figure it out. The workflow gives me options to do all sorts of thing, but none of the choices are basic mathematical operations.

If you can give me any insight on how to set up my workflow so that I’m able to increment the field that would be amazing. After a lot of hours of searching and trying I have not been able to produce any results on that one.

You should be able to set the field equal to its current value + 1. Are you not able to do that? Can you share a screenshot?

Edit: Something like this…

And a text element would display the corresponding option set item like this…

display

2 Likes

hahah damn thanks bro! I was confusing the language. I didn’t realize that the workflow needed to specify that second value before being able increment by one.

I assumed that + 1 should come immediately after the =.

I assumed that Bubble would recognize that the +1 should be applied to the field without any further clarification, and I did not realize that in order to increment, the workflow also needs to declare the existing value.

Thanks so much for the clarification @mikeloc!

1 Like