Navigation

    CreatiCode Scratch Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • CreatiCode

    Creating leaderboards with saved variables

    Help
    3
    12
    399
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • The_True_Odst
      The True ODST Best Forum Helpers last edited by

      How do you put a variable into the leaderboard/change the top number in the leaderboard with the variable the player got?

      ODST: Orbital Drop Ship Trooper
      (Halo Reference)

      info-creaticode 1 Reply Last reply Reply Quote 0
      • info-creaticode
        CreatiCode @The_True_Odst last edited by

        @011830-0a42ef84

        Currently, you can use this block to submit a new value for the current user, which will overwrite the old value if the new value is better:

        e42c466b-0256-4f65-8ed0-a84f9d5ffe8e-image.png

        The_True_Odst 1 Reply Last reply Reply Quote 0
        • The_True_Odst
          The True ODST Best Forum Helpers @info-creaticode last edited by

          @info-creaticode Is this a premium block? I can’t find it in the game and the AI won’t give it to me.

          ODST: Orbital Drop Ship Trooper
          (Halo Reference)

          info-creaticode 1 Reply Last reply Reply Quote 0
          • info-creaticode
            CreatiCode @The_True_Odst last edited by

            @011830-0a42ef84

            It is in the “Game” extension.

            The_True_Odst 1 Reply Last reply Reply Quote 0
            • The_True_Odst
              The True ODST Best Forum Helpers @info-creaticode last edited by The_True_Odst

              @info-creaticode I’m sorry, but I can’t find the game extension. What are you referring to? If the extensions are the tabs like the sound and motion ones, I don’t see the game one on there.

              d1faa950-443d-4df2-924d-9368dfaa7068-image.png

              ODST: Orbital Drop Ship Trooper
              (Halo Reference)

              info-creaticode 1 Reply Last reply Reply Quote 0
              • info-creaticode
                CreatiCode @The_True_Odst last edited by

                @011830-0a42ef84

                You can click this green button on the bottom left to add the “Game” extension:

                fc55cf9a-148c-4cab-ac0d-137acadbd936-image.png

                jeffreyrb03-gmail The_True_Odst 2 Replies Last reply Reply Quote 1
                • jeffreyrb03-gmail
                  JaecadeJnight Mod Helper @info-creaticode last edited by

                  @info-creaticode It seems that XO (as shown in the image above) gives blocks but probably in the wrong syntax so it falls back to making a comment block lke “// record player score” which isn’t the same as the actual block “record player score”.

                  #LLJW
                  <span style="color:white;background-image:linear-gradient(to right, lightblue, navy)">My name is Jeff</span>

                  1 Reply Last reply Reply Quote 0
                  • The_True_Odst
                    The True ODST Best Forum Helpers @info-creaticode last edited by

                    @info-creaticode I figured it out, thank you

                    ODST: Orbital Drop Ship Trooper
                    (Halo Reference)

                    The_True_Odst 1 Reply Last reply Reply Quote 0
                    • The_True_Odst
                      The True ODST Best Forum Helpers @The_True_Odst last edited by

                      @info-creaticode How do you create multiple leaderboards for different things?

                      ODST: Orbital Drop Ship Trooper
                      (Halo Reference)

                      jeffreyrb03-gmail 1 Reply Last reply Reply Quote 0
                      • jeffreyrb03-gmail
                        JaecadeJnight Mod Helper @The_True_Odst last edited by

                        @011830-0a42ef84 i believe there is only one leaderboard per game, use a server saved table/database instead that will save user IDs and stats

                        #LLJW
                        <span style="color:white;background-image:linear-gradient(to right, lightblue, navy)">My name is Jeff</span>

                        The_True_Odst 1 Reply Last reply Reply Quote 0
                        • The_True_Odst
                          The True ODST Best Forum Helpers @jeffreyrb03-gmail last edited by

                          @jeffreyrb03-gmail can you help me with that and give me an example? I tried it but I didn’t know how

                          ODST: Orbital Drop Ship Trooper
                          (Halo Reference)

                          jeffreyrb03-gmail 1 Reply Last reply Reply Quote 1
                          • jeffreyrb03-gmail
                            JaecadeJnight Mod Helper @The_True_Odst last edited by jeffreyrb03-gmail

                            @011830-0a42ef84 using databases is a tiny bit tricky, but they are basically just tables with strict/enforced columns with types (like number, string, or date) and allow you to store rows in them. It is pretty transaction based kinda like actual databases. For a leaderboard you just need to create a database for a leaderboard, and to get data from it, just display say around 100 rows where a stat like coins is greatest, if you were to show some leaderboard of users with the most coins.

                            I’ll let you tinker around with that first and if you still need help then I would like to see your code and I’ll give working code. I do have a project that demonstrates how to use a database, you’ll have to look in the code though, and what it does it just check if a password you enter is the correct password by asking the database for the password and then checking if the inputted password is equal to the password from the database:

                            the project is in unlisted shared so u can see it
                            https://play.creaticode.com/projects/66f85f2ce228c74a133e1128


                            Hopefully my project doesn’t confuse you more, but all you have to do is just change it up and delete the stuff leftover from my challenge thingie. Instead of using the database to store one singular piece of text, you can use it to store multiple rows like a table and in the end, you could use that database to make a leaderboard of your own and shows what you want.

                            The columns it should be storing are (user id), found in Sensing, and then any variables.

                            #LLJW
                            <span style="color:white;background-image:linear-gradient(to right, lightblue, navy)">My name is Jeff</span>

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post