Setup
First, let’s create 3 new properties:
achievment#:unlocked? = bool:False
achievment#:title = string:Title
achievment#:description = string:Description
Scripting
We can create a new notification device. These devices can hold their own block code, which is helpful since we can simplify our code but compiling it all into one notification device.
We can add this to our notification that runs on wire pulse.
I tried to use a similar method as I would in javascript. In JavaScript, we can use backticks (`) to concatenate strings. I we use a javascript style approach to the problem as such, we can make our code modular. Here is what I would have written in javascript:
let achievements = {
"1": {
"unlocked": true,
"title": "Title Here",
"description": "description here"
},
};
const GrantAchievment = (n) => {
let num = toString(n);
if (!achievements[num].unlocked) {
// stuff
}
else return null;
};
Conclusion
Thanks for reading. This was a quicker article, but I plan to make a much longer guide about guide-making it’s self and my process in making my guides.