diff --git a/examples/cheststealer/count.minescript b/examples/cheststealer/count.minescript index 3a92dc6..6fb5308 100644 --- a/examples/cheststealer/count.minescript +++ b/examples/cheststealer/count.minescript @@ -5,16 +5,14 @@ scoreboard objectives add items dummy # Gives to the player every given item of a chest -slot = 0 offset = 9 id = "\"minecraft:diamond\"" scoreboard players set total items 0 # 27 slots in a player inventory, excluding the hotbar -{% while slot < 27 %} +{% for (slot = 0; slot < 27; slot++) %} scoreboard players set count items 0 execute as @s run execute store result score count items run data get block ~ ~ ~ Items[{Slot:{{slot}}b,id:{{id}}}].Count scoreboard players operation total items += count items - slot += 1 -{% endwhile %} \ No newline at end of file +{% endfor %} \ No newline at end of file diff --git a/examples/cheststealer/give.minescript b/examples/cheststealer/give.minescript index de85012..19168ca 100644 --- a/examples/cheststealer/give.minescript +++ b/examples/cheststealer/give.minescript @@ -3,15 +3,12 @@ # Gives the items.total number of items to the player steps = [64, 15, 1] -i = 0 id = "minecraft:diamond" -{% while i < steps.length %} - n = steps[i] +{% for (n of steps) %} cond = `execute if score total items matches ${n}.. run` {{ cond }} give @s {{ id }} {{ n }} {{ cond }} scoreboard players remove total items {{ n }} - i += 1 -{% endwhile %} +{% endfor %} execute if score total items matches 1.. run function cheststealer:give \ No newline at end of file diff --git a/package.json b/package.json index 97dca40..c911fb3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "minescript", - "version": "0.0.1-alpha", + "version": "0.0.2-alpha", "description": "A Minecraft Functions templating engine", "main": "lexer.js", "dependencies": { diff --git a/src/argumentParser.js b/src/argumentParser.js index b10eac0..fab81aa 100644 --- a/src/argumentParser.js +++ b/src/argumentParser.js @@ -4,7 +4,7 @@ let inputFolder = '' let outputFolder = '' program - .version('0.0.1-alpha') + .version('0.0.2-alpha') .arguments(' ') .description('Compiles .mcscript or .minescript files located inside the given inputFolder.\n' + 'The resulting .mcfunction files are stored inside the given namespaceFolder - located inside a datapack.')