PictoBlox Cloud Chat System Using Cloud Variables
by jashdesai in Circuits > Computers
38 Views, 1 Favorites, 0 Comments
PictoBlox Cloud Chat System Using Cloud Variables
This project demonstrates a simple cloud-based chat system created using PictoBlox Cloud Variables. Two or more users connected to the same cloud project can send messages using keyboard keys and receive messages in real time.
Supplies
Setting Up Pictoblox
Select Blocks
Select Cloud Variable Extention
Cloud Variables are special variables in PictoBlox that store data on the internet instead of only on a single computer. This allows multiple users and devices connected to the same project to share and update data in real time.
Unlike normal variables, cloud variables automatically synchronize across all connected devices. When one user changes a cloud variable, the updated value is instantly visible to everyone connected to that project.
Connect to Cloud Server
Code and Logic
Step 1: Connect to Cloud Server
When the green flag is clicked:
- The device connects to the Pictoblox cloud server.
- Cloud variables are initialized.
Step 2: Sending Message from User A
When key A is pressed:
- Counter increases by 1.
- Message variable stores: A says: Hello at <Counter>
- LastSender is set to A.
- Sprite displays: Message Send from A
Step 3: Sending Message from User B
When key B is pressed:
- Counter increases by 1.
- Message variable stores: B says: Hello at <Counter>
- LastSender is set to B.
- Sprite displays: Message Send from B
Step 4: Receiving Messages
A forever loop continuously checks:
- If oldvariable < Counter
- Then a new message has arrived.
The sprite then:
- Updates the old counter value.
- Displays the received cloud message.
Logic Explanation
The project works using a cloud counter system.
Every time a user sends a message:
- The counter value increases.
- Other connected devices compare the current counter with their stored old counter.
- If the value changes, it means a new message has been received.
This method helps all devices stay synchronized.
Download the SB3 file
Result
The project allows users to send and receive messages in real time while storing shared data online. The interface displays multiple cloud variables such as Counter, LastSender, Message, and a list of usernames connected to the system.
Whenever a user sends a message, the cloud variables update instantly, showing the latest sender and message details across all connected devices. This project introduces the concept of cloud computing, real-time data synchronization, and multiplayer communication using cloud variables in an interactive and beginner-friendly way.