#castle basement switch #2
from SDLKeys import SDLK_0, SDLK_1, SDLK_2, SDLK_3, SDLK_4, SDLK_5, SDLK_6, SDLK_7, SDLK_8, SDLK_9
from eventAPI import *
from APIUtils import *

rtcastle0switch2 = 0

def fireEvent(e):
   global rtcastle0switch2
   rtcastle0switch2 = getTag(e, "rtcastle0switch2")
   currentSwitch(e)
   return 0

def currentSwitch(e):
   text = ["There is a dial set into the wall.  The dial can be turned so that a small arrow will point to one of the numbers."]
   if (rtcastle0switch2 == 0):
      text.extend(["", "The dial is set to the number 0."])
   if (rtcastle0switch2 == 1):
      text.extend(["", "The dial is set to the number 1."])
   if (rtcastle0switch2 == 2):
      text.extend(["", "The dial is set to the number 2."])
   if (rtcastle0switch2 == 3):
      text.extend(["", "The dial is set to the number 3."])
   if (rtcastle0switch2 == 4):
      text.extend(["", "The dial is set to the number 4."])
   if (rtcastle0switch2 == 5):
      text.extend(["", "The dial is set to the number 5."])
   if (rtcastle0switch2 == 6):
      text.extend(["", "The dial is set to the number 6."])
   if (rtcastle0switch2 == 7):
      text.extend(["", "The dial is set to the number 7."])
   if (rtcastle0switch2 == 8):
      text.extend(["", "The dial is set to the number 8."])
   if (rtcastle0switch2 == 9):
      text.extend(["", "The dial is set to the number 9."])
   text.extend(["", "Do you wish to move the dial to another number?"])
   if (poseYesNo(e, text)):
      changeSwitch(e)
   else:
      return 0


def changeSwitch(e):
   text = ["What number will you set the dial to?."]
   optionTexts = ["Please choose a number from 0 to 9."]
   optionsKeys = [SDLK_0, SDLK_1, SDLK_2, SDLK_3, SDLK_4, SDLK_5, SDLK_6, SDLK_7, SDLK_8, SDLK_9]
   inputValue = optionInput(e, text, optionTexts, optionsKeys)
   if (inputValue == SDLK_0):
      rtcastle0switch2 = 0
      text=(["The dial is now set to the number 0."])
   elif (inputValue == SDLK_1):
      rtcastle0switch2 = 1
      text=(["The dial is now set to the number 1."])
   elif (inputValue == SDLK_2):
      rtcastle0switch2 = 2
      text=(["The dial is now set to the number 2."])
   elif (inputValue == SDLK_3):
      rtcastle0switch2 = 3
      text=(["The dial is now set to the number 3."])
   elif (inputValue == SDLK_4):
      rtcastle0switch2 = 4
      text=(["The dial is now set to the number 4."])
   elif (inputValue == SDLK_5):
      rtcastle0switch2 = 5
      text=(["The dial is now set to the number 5."])
   elif (inputValue == SDLK_6):
      rtcastle0switch2 = 6
      text=(["The dial is now set to the number 6."])
   elif (inputValue == SDLK_7):
      rtcastle0switch2 = 7
      text=(["The dial is now set to the number 7."])
   elif (inputValue == SDLK_8):
      rtcastle0switch2 = 8
      text=(["The dial is now set to the number 8."])
   elif (inputValue == SDLK_9):
      rtcastle0switch2 = 9
      text=(["The dial is now set to the number 9."])
   else:
      showMessage(e, ["ERROR!"])
   setTag(e, "rtcastle0switch2", rtcastle0switch2)
   showMessage(e, text)
