#NE riddle
from eventAPI import *
from APIUtils import *

def fireEvent(e):
    if (((getTag(e, "lFlagS") & 0x100) == 0) or (getTag(e, "lFlagU") == 2)):
        return 1
    if (getTag(e, "lFlagU") == 1):
        showMessage(e, ["Again, you approach the ziggurat, and again, the voice speaks."])
    else:    
        k = getTag(e, "TotEzig")
        if (k == 0):
            showMessage(e, ["Before you stands a bizarrely painted ziggurat, atop of which burns a dark flame.",
                            "","As you approach it, the flame burns higher and a voice comes out of nowhere."])
        elif (k == 1):
            showMessage(e, ["You come near another ziggurat.","",
                            "Once again, the flame that crowns it comes alive, and a mysterious voice intones:"])
        elif (k == 2):
            showMessage(e, ["Guess what? Another ziggurat, complete with flame and voice."])
        elif (k == 3):
            showMessage(e, ["Seen one ziggurat, seen all ziggurats..."])
        k += 1
        setTag(e, "TotEzig", k)
        setTag(e, "lFlagU", 1)
    answer = stringInput(e, ["\"What has roots as","  nobody sees,","Is taller than trees,",
                             "Up, up it goes","And yet never grows?\""])
    if (answer.lower() == "mountain"):
        showMessage(e, ["\"That is correct.\"","","With these words, the voice fades away and the flame recedes."])
        k = getTag(e, "TotEplot")
        k += 1
        setTag(e, "TotEplot", k)
        setTag(e, "lFlagU", 2)
        return 1
    else:
        showMessage(e, ["\"Wrong. Go away.\"","","You do."])
        return 1
