by Tu rf
Version 1 (December 20, 2021)
Download (107 downloads)
[Non-premium]
A parser to simplify array experssions in Automate, written in JavaScript, ported to... Automate.
This program aims to compress multiple variable expressions and operators (conditionals also included) into a single expression.
Due to the nature of a webpage, the entire flow is only written in 2 blocks: One for the flow start and one for the web dialog block.
The code
The code must begin with var followed by the array name and the number of elements in an array.
All statements are separated by semicolons.
Only if-else statements are supported for now.
Comments (//) are also supported.
Example:
Let's say you wanted to check whether this player has enough coins to buy an item. The item costs 100 coins. If the player had the money, take the money and give the item. Otherwise, don't take the money and don't give the item. Oh, and you also wanted to know whether the transaction succeeds or not. Normally, this takes 1 "Expression true?" block and 4 "Variable set" block to process....
var g[3];
if(g[0] >= 100){ //player has enough money?
g[0]=g[0]-100; //take 100 money
g[1]=g[1]+1; //give 1 item
g[2]=true; //transaction success
}
else{ //not enough money!
g[2]=false; //transaction failed
}
But now all of these above can be compressed into this statement, which does all of the above in one "Variable set" block!
[((g[0] >= 100) ? (g[0]-100) : g[0]), ((g[0] >= 100) ? (g[1]+1) : g[1]), ((g[0] >= 100) ? (true) : (false))]
Which will save 4 blocks from your flow.
Feedbacks and bug reports, please...
Hopefully I'll be able to add something in the future.
The code is also available here: https://github.com/RealOfficialTurf/ArrayLang
5 stars | 3 | |
4 stars | 0 | |
3 stars | 1 | |
2 stars | 1 | |
1 star | 0 | |
Reports | 0 |
Rate and review within the app in the Community section.