(sos!) Help me fix some problem for my Sorting (name and score)

The requirements don't say code your own sort, just apply a sort.

The smart money uses a built-in block where possible, instead of reinventing the wheel.

Your instructor might not even know the sort blocks existed, since they are new.

The best coders use the fewest blocks.

It's always wise
to modularize.

If in doubt
rip it out.

i just change the playername to the same screen , also this time I going to let them type name only if their score is on the 5 top score list. Can I ask where & how can I put the if then statement to check whether the score is on top 5 or not, if yes, then will open the "playerName" screen to ask the user name and store it to the clouddb

image
image

i havent put the "playerName" screen visible bcz I dont know how to check whether their final score match with the top5 score in list

That would need to be after you finish a game and have a score.

Testing against the latest high score list would require having a copy of the high score list available locally.

You could save YOUR highest score in TinyDB, under tag MyHighestScore, and test against that before deciding to update it and start the process of updating the cloud high score table.
Let that process ask the cloud for the current high score table, and let it do the append,sort, trim to length, and replace operation.

1 Like

but I thought u said use one database is more easier than using 2

Where?

You keep adding requirements, so more work is needed.
Multiple screens can't talk to each other.
TinyDB is easier than CloudDB for local storage, and you should be able to distinguish between the two and know where to use one and where to use the other.

what if now they are in same screen

dda1116b5461170bf07aff178225b6b119600bfe

All username and score information must be available before attempting to update it.

The screen Initialize event is a good place to ask for the latest high score list.
It should arrive before the user has a chance to enter his name and confirm.

do u have some kind of similar video for this, I'm lost (sorry I being so foolish ). Especially, I never learn the table.

See the introductory section.
Then see the nb191 add-ons for tables.

I added a new, simpler, tutorial for CloudDB top scores under a single tag.

tq i will try now :pleading_face:

i should create a independent database for username?

Tell us where "ttttttt" came from.
It is not a list.

image
now, become this. I think is from the result(name,score)

image

image

result:
image

Use the Companion and the Blocks Editor Do It facility to show the contents of that global scores table.

1 Like

sorry, can i look the image of the Blocks Editor Do It

Without the Do It facility you are working with one eye tied behind your back.

https://ai2.appinventor.mit.edu/reference/other/testing.html

problem is use of the values one of this block (the operation > cannot accept the arguments ...) based on the error message.
list2

You possibly can use DoIt to debug.

Use the MIT debugging advice Live Development, Testing and Debugging

and Enis's comments about the built-in DoIt debgger MIT App Inventor 2 Tips – TWO DOG APPS