This is a complex question, so I apologize in advance. Believe it or not, this is for an assignment in a college-level class.
I am trying to implement a lexer in Minecraft that interprets different types of number-looking banners. The functionality I am looking to achieve is very similar to SethBling's Scrabble Spell Checker. Essentially, when a number of various banners are placed, some series of command blocks are triggered.
So let's say I want to interpret these banners and set a scoreboard objective to be 149:
Here's my understanding of how this functionality works:
- There is a dummy scoreboard object configured to act a counter
- A command block would spawn in an armour stand to the far right of the banners and it could step the armour stand to the left 1 block after every iteration using relative coordinates
- At each "step", the armour stand would have to issue a
testfor
command and then, depending on the result, would have to add that respective value to the scoreboard
Step 3. is the heart of my question. In SethBling's example he uses this command:
/execute @e[type=ArmorStand,name=Lexer] ~ ~ ~ /testforblock ~ ~ ~ wall_banner -1 {Patterns:[{Pattern:"ls",Color:0},{Pattern:"bs",Color:0},{Pattern:"bo",Color:15}]}
Where it's clear the banner type is being identified. But I'm not sure how it is possible to do anything with this result.
Am I on the right track with this logic? How can I use the result from the testfor
command issued by the armour stand?
Once I figure out the value of the banner, how can I add this result to the relative total (ie. 9 + 40 + 100), since I can't perform mathematical operations inside the command block?
I know this question involves a lot of complex command block logic. Thanks so much for your help!