Woo! This project was a speedrun basically! Put together in about 3 hours! -------------------------------------- --------------------------------------- PROJECT SPECIFIC INSTRUCTIONS (If you want to use this for your project, look at the notes and credits.) This is a super simple demonstration project using my cloud storage custom blocks. To save a key, type s. Then, name the key and enter the value for the key. To read a key, type g. Then, enter the name of the key you want the value of.
SETUP INSTRUCTIONS BELOW ========================= If you use this, please credit me (@Tacocat0412) and maybe leave a link to this project. It is much appreciated! HOW IT WORKS (A few important details) ====================== A host user sits with the project open in host mode on their computer (it even works if you run it in a background tab). They are responsible for all of the user storage. If a host is not online, the project will not work. Additionally, the host MUST SAVE THE STORAGE AND KEYS LISTS in one way or another because when the project restarts if the lists aren't saved the data is permanently gone. (You could technically retrieve it from the cloud data logs but it would be a hassle.) The user can send requests to set or read the value of a key. HOW TO USE/SETUP ==================== = Setup = To set up, copy all of the code (except for the part that says this is the program) in the background. This should include 6 block definitions and three scripts. When using in your project, change the server name to whatever you want your server to be called. Honestly I don't why I added this, I just thought somebody somewhere might find it useful. You don't have to change it. You can also change the version if you update your game often and want to make sure that the user is on the same version as the host. Change the host list to users you want to be able to host the storage. Copy the cloud notifs sprite if you want the cloud notifications to be shown in your game. They are only used for connecting to the server in this version, but they may be used more in a later version. = Custom Blocks = DECODE - Decodes the number encoded variable. DECODE REQUESTS - Decodes the request variable and runs the command. GET - Asks the host for the value of a key. RESPOND TO PINGS FOREVER - Responds to checks if the host is online forever. SAVE - Tells the host what the value of a key should be. SET UP CLOUD - Prepares the cloud engine. = Important to know = Key values get sent to the 'Data' variable when retrieved. The following 'special keys' can technically be set, but will always return specific values: 'server name' - Returns the name of the host server. 'server uptime' - Returns how long the host has been hosting in seconds. 'server version' - Returns the version of the server. 'server time' - Returns the days since 2000 according to the server. WARNING: IF YOU SEND THE SAME REQUEST TWICE IN A ROW (EVEN FROM DIFFERENT SENDERS), YOU WILL NEVER GET THE CORRECT RESPONSE. THIS IS A LIMITATION OF THE CURRENT ENGINE VERSION AND WILL BE FIXED IN VERSION 2 IF IT IS EVER MADE. VERSION ONE IS MADE TO BE SIMPLE AND RELATIVELY FAST. LIMITATIONS ============= One limitation is listed at the end of the how to use section. The engine can only store up to 200,000 keys because of Scratch's list limitations. (To be fair that is a crazy amount of keys but it is a thing to keep in mind if you make a lot of keys.) This engine is not fault tolerant at all. For example, if two people send a request at the exact same time, only one may go through. They will both interpret the result as being theirs, and so one user may have the incorrect result, which could cause glitches. This encountering this issue is unlikely, but possible if you request the server too often or have many users. TROUBLESHOOTING ================== Some bugs may be caused by the issues mentioned above. Other reasons you may have problems: - Confirm there is a host online with a stable internet connection. The server is only pinged on start, and is not updated when the host leaves. - Confirm all the characters in your message are in the character list. If they are not, add them. WARNING: The character list can only contain characters in the list indexes 10-99. Other problems? Ask me in the comments!