Skip to content
Felizolinha edited this page Jan 14, 2016 · 4 revisions

                              This page documents the blocks in the Data category.


 

Counters

**  Counters were the first data type introduced by TGB's Extension. They do the same as variables but without polluting the editor with lots of variable names. They are also able to have dynamic names (names created by the code through variables or any other method you prefer).**

Blocks:

Counter _ Set counter _ to _ Increase counter _ by _ Reset counter _ Reset all counters
As these blocks are pretty much self explanatory, they won't be explained here.

Imagined uses:

  • Simulating local variables without polluting the editor screen.

Trivia:

  • Unfortunately, counters have been proven to be slower than normal variables due to Extensions limitations. See this project for a benchmark.
  • There is a default counter called Help that before being changed by the project reports a random tip about TGB's Extension. Resetting all the counters also makes it report these tips again.
  • The maximum amount of counters you can have in a project is 50000, this is to prevent crashing the user's computer/browser.

 

Cookies

**  Cookies were the second data type introduced. They are local, persistent variables, that don't need the cloud to do so.**

Blocks:

Cookie _ Set cookie _ to _ Increase cookie _ by _ Delete cookie _ Delete all cookies
As these blocks are pretty much self explanatory, they won't be explained here.

Imagined uses:

  • Simpler and faster saving systems for games than the ones using cloud. (Notice that this approach is not account-bound, but computer-bound).

Trivia:

  • The cookie blocks don't actually use cookies, they use localStorage.
  • As per the above, there is a limit of 10MB that must be respected, if you try to surpass it your changes won't be saved. Unfortunately, the amount of data being used is calculated by summing up the cookies from all the projects that are using it, this means that a spammy project can cause side effects for a user even in other projects.

Planned Updates:

  • When reaching the 10MB limit for localStorage, prompt the user asking if he/she wants to delete the "cookies" from the actual project, from the project that is most using storage (prevents against spammy projects) or the cookies from all the projects he has visited.
Clone this wiki locally