iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🅿️

A Guide to Building a Point System in Scratch

に公開

I will introduce methods and points to note when creating a point system in Scratch.

How to Create

Scratch has a feature called cloud variables that allows you to save variable values on the server.
While there are methods to manage points through comments and other means, I will omit those for now.

If you're creating a point system using cloud variables, there are two main methods:

  • Save user and point data directly in cloud variables.
  • Prepare a server and exchange information via cloud variables.

For building a serious system, the latter is recommended.
It looks something like the diagrams below.
Save image
Load image

While it is possible to save data directly to cloud variables as in the former method,
due to the specifications of cloud variables, you can only save up to 2560 characters per project (256 characters per variable, 10 variables per project).
In terms of capacity, that's about 1KB.
If you're interested, this article is also worth reading:
https://qiita.com/ito-noizi-scratch/items/ef9d5a4989fe6b49201c

Creating a server within Scratch can be quite complex.
Therefore, the Python library "scratchattach" is highly recommended!

https://github.com/TimMcCool/scratchattach/wiki

You can write simple programs in Python to reference and update cloud variables. (I'm planning to write an article on how to use it if I feel like it.)
It looks like this:

sample.py
import scratchattach as sa

session = sa.login("username", "password")  # Log in to Scratch
cloud = session.connect_scratch_cloud("project_id")  # Connect to the cloud
events = cloud.events()

@events.event
def on_set(activity):  # Called when a cloud variable is updated
    print(f"Cloud variable updated. Timestamp: {activity.timestamp} Variable name: {activity.var} Value: {activity.value}")
    # If you want to know who changed the cloud variable, it seems you can use activity.load_log_data()

@events.event  # Called when preparation for detection is complete
def on_ready():
   print("Server ready!")

events.start()  # Start detection

(Partially modified from the official Wiki)

Furthermore, it comes with various features such as classes for cloud communication and retrieving user/project data!
However, as mentioned later, there are some features that should not be used included in the library, so please check carefully.

Prohibited Actions

In Scratch, there are various rules beyond just the Terms of Service and Community Guidelines (such as announcements by the Scratch Team in discussion forums or answers to questions in comments).
In particular, I feel there are many prohibited actions related to point systems. Here are a few examples.

Example 1: I want to create an online chat feature!

An official statement called Cloud chat projects has been issued, and sharing chats with free-text input or word selection is prohibited.
(This is reportedly referred to as the Second Cloud Shock in Japan.)
Chats that send only emojis or a limited set of fixed phrases are considered acceptable.

Example 2: I made a feature to automatically comment once a day to subscribers!

Social actions using bots (comments, follows, hearts, stars, etc.) are not allowed.
While there is no official statement on the forums, many Scratchers, including former Scratch Team members, have expressed the same sentiment in the discussion forums.

The previously mentioned scratchattach also provides features like posting comments and following, but it's best to avoid using them as much as possible, as they could lead to an account block at worst.

Example 3: Let's make a homepage where points can be sent!

This violates the second point of Shops, Points, and Pretend Currency Systems.
As stated in the Japanese translation, point systems must not be made usable in apps or scripts outside of Scratch.
The reason isn't explicitly stated, but I believe it is because of the risks associated with using things like browser extensions.

This violates the fourth point of Links to Member-created Websites.
A condition for introducing links to your own website is that unmoderated communication methods must not be provided on the website.

By the way, it is sometimes said that "you need permission in advance to promote a website," but as of December 2024, permission is no longer required as long as you follow the rules.

Example 5: Let's give points if someone follows me

The third point of Shops, Points, and Pretend Currency Systems states that "using social actions (likes, favorites, follows, etc.) as a method of payment" is not allowed.
Things like "giving follows, hearts, or stars as prizes for lotteries or contests" are also prohibited for this reason.

Conclusion (Reading Optional)

By using server communication, you can expand the scope of your Scratch projects.
Please give it a try!

However, following Scratch's rules is extremely important. It is true that many of Scratch's rules are implied through forum posts and can be difficult to understand.
However, operating a system without following the rules will not only lower the reputation of the system but could also lead to an account block, making it impossible to continue your activities.

I hope those who plan to operate point systems in the future will keep this in mind.

Text before the update

This article was created with a sense of self-reflection.
Systems using bots can be used maliciously if one has ill intent.
Therefore, I've come to feel that it's better to develop them cautiously.
Even if you operate a system without following the rules, there is a risk that the system's reputation will decline, or in the worst case, you will be unable to continue your activities due to an account block.
Let's read and follow the rules carefully!

Thank you for reading until the end.
If there are any errors in the content or if you have any questions, I would appreciate it if you could let me know in the Discussion below!

Discussion