So I have been out of the game for several months and have forgotten and/or Thunkable X Firebase is different. I have read every post I can find about Firebase and have not found a solution to my problem.
I am making a multiplayer dice game. I need to be able to have certain things happen when the Firebase DataChanged block fires when it relates to the users game they are in. They will be multiple games going at once so each game has its own unique ID and only players of that game can write/call data. The DataChanged block is key because when a player “rolls” it changes the node “Rolling” to true which then triggers all others players dice to “roll” and then display the current players “dice”. However I am not able to get any updated data from the DataChanged block as it always crashes the live app. Note: I am trying to avoid having to use the Get block as I would have to call all the children within that game which seems data heavy.
Does Firebase no longer send the key and value of ONLY the data changed, meaning if Rolling updated for my game would FB DataChanged it would only display Rolling=true/false?
Here are my screen shots. I know it might sound confusing but I dont know how best to describe it LOL.
So I tried that and still crashing my app. I know it used to be possible to only view the data from an update but that seems to have gone away. I will just have to use the Get block it seems.
I need some help with this too.
I’m making a quiz app, and each user has to join in a room, and then his/her name is sent to firebase under the bucket(variable room). I’m struggling to get the names and scores of all the players who are also under that same room name and display it in a listviewer.
This is my firebase structure,a nd what it’s supposed to look like:
And now, it’s become messed up, and it looks like this.
I suppose my problem is that what’s returned is not a list. Since I need to insert my name and score at the end of the list, do you know of a way to convert something into a list? Or at least check whether the value returned from RTDB is a list?
Thanks
Personally I don’t like the way lists save in Firebase. I save all of my lists as a text string with each item being separated by a comma. It makes it easier to store and call. To get this I use the make Text from list block when saving to Firebase and switch it to make List from text when calling the data back and save it to a variable.
Using your example I would save it like this within my firebase:
Addie/Players: “Player1,Player2,Player3,Player4”
Addie/Scores:“0,0,0,0”
After calling the data I would save it in 2 variable lists. That way if I want player 1 score I would just use the In list get #1 return.
That’s genius! But sometimes, the room is empty when a player joins, so the app crashes when I attempt to make it convert nonexistant text into a list with the delimiter ‘,’ .