# In game it is possible to tag items and objects using the 'tagger'

on start:
    var score = 0
    position beginroom_wood 25 62 77 0
    position cracked_bricks 24 62 73 0
    state main beginroom

on obtainitem minecraft:netherstar:
    var score score+1

while main = beginroom:
    on start:
        message "And the adventure starts!"

    on obtaintag firstroomkey:
        message "With this key you can open the door to the second room!"
        state main secondroom
        tag firstroomdoor open

    on rightclickblock beginroom_wood:
        message "You begin searching in the rubble"
        #delay <>
        message "and you find an old key!"
        message "Nice of my captor to leave the key here"
        give minecraft:diamond beginroom_key

while main = secondroom:
    on blockat rubble == minecraft:air:
        message "You destroy the rubble blocking the door!"
        state main = finalroom

while main = finalroom:
    on delay 100:
        message "You have the feeling there must be some treasure here"

    on open treasurechest:
        message "There it is!"
        state main theend

while main = theend:
    on start:
        message "You win the game!"

