1 Reply Latest reply on May 28, 2007 9:19 AM by Newsgroup_User

    A case statement question

    wgb14 Level 1
      Hi all,

      I have the followign repeated case stements. Do you think there is another (cleaner) way to write them? Let me know what you think!

      CASE TRUE OF
      (scenario = "Architecture"):
      sprite(2).Query = "soundmgr currenttime locD_A.ogg"
      case true of
      (sprite(2).QueryReturn = 0):
      sprite(2).Hypertext ="\loadbackgrnd [file= [BACK\churchdiagram_full.jpg]]"
      sprite(2).Hypertext = "\soundpause [file= [LocD_q9_Á.ogg]]"
      sprite(2).Hypertext = "\SetScript [i0= 0 i1=0]" --deactivates the current script
      tell controls to go to marker ("magnify_back")
      dialogue.close()
      end case
      END CASE
      CASE TRUE OF
      (scenario = "History"):
      sprite(2).Query = "soundmgr currenttime locD_H.ogg"
      case true of
      (sprite(2).QueryReturn = 0):
      sprite(2).Hypertext ="\loadbackgrnd [file= [BACK\churchdiagram_full.jpg]]"
      sprite(2).Hypertext = "\soundpause [file= [locD_H.ogg]]"
      sprite(2).Hypertext = "\SetScript [i0= 0 i1=0]"
      tell controls to go to marker ("magnify_back")
      dialogue.close()
      end case
      END CASE
      CASE TRUE OF
      (scenario = "Biography"):
      sprite(2).Query = "soundmgr currenttime locD_B.ogg"
      case true of
      (sprite(2).QueryReturn = 0):
      sprite(2).Hypertext ="\loadbackgrnd [file= [BACK\churchdiagram_full.jpg]]"
      sprite(2).Hypertext = "\soundpause [file= [locD_B.ogg]]"
      sprite(2).Hypertext = "\SetScript [i0= 0 i1=0]"
      tell controls to go to marker ("magnify_back")
      dialogue.close()
      end case
      END CASE
      CASE TRUE OF
      (scenario = "Architecture_History"):
      sprite(2).Query = "soundmgr currenttime locD_AH.ogg"
      case true of
      (sprite(2).QueryReturn = 0):
      sprite(2).Hypertext ="\loadbackgrnd [file= [BACK\churchdiagram_full.jpg]]"
      sprite(2).Hypertext = "\soundpause [file= [locD_AH.ogg]]"
      sprite(2).Hypertext = "\SetScript [i0= 0 i1=0]"
      tell controls to go to marker ("magnify_back")
      dialogue.close()
      end case
      END CASE
      CASE TRUE OF
      (scenario = "Architecture_Biography"):
      sprite(2).Query = "soundmgr currenttime locD_AB.ogg"
      case true of
      (sprite(2).QueryReturn = 0):
      sprite(2).Hypertext ="\loadbackgrnd [file= [BACK\churchdiagram_full.jpg]]"
      sprite(2).Hypertext = "\soundpause [file= [locD_AB.ogg]]"
      sprite(2).Hypertext = "\SetScript [i0= 0 i1=0]"
      tell controls to go to marker ("magnify_back")
      dialogue.close()
      end case
      END CASE
      CASE TRUE OF
      (scenario = "History_Biography"):
      sprite(2).Query = "soundmgr currenttime locD_HB.ogg"
      case true of
      (sprite(2).QueryReturn = 0):
      sprite(2).Hypertext ="\loadbackgrnd [file= [BACK\churchdiagram_full.jpg]]"
      sprite(2).Hypertext = "\soundpause [file= [locD_AB.ogg]]"
      sprite(2).Hypertext = "\SetScript [i0= 0 i1=0]"
      tell controls to go to marker ("magnify_back")
      dialogue.close()
      end case
      END CASE
      CASE TRUE OF
      (scenario = "Architecture_History_Biography"):
      sprite(2).Query = "soundmgr currenttime locD_AHB.ogg"
      case true of
      (sprite(2).QueryReturn = 0):
      sprite(2).Hypertext ="\loadbackgrnd [file= [BACK\churchdiagram_full.jpg]]"
      sprite(2).Hypertext = "\soundpause [file= [locD_AHB.ogg]]"
      sprite(2).Hypertext = "\SetScript [i0= 0 i1=0]"
      tell controls to go to marker ("magnify_back")
      dialogue.close()
      end case
      END CASE

      CASE TRUE OF
      (the text of member "current_script"= "LocD_q9_Á.hap"): --Elkomenos Church diagram
      sprite(2).Hypertext ="\loadbackgrnd [file= [BACK\church_diagram.jpg]]"
      sprite(2).Hypertext = "\soundpause [file= [LocD_q9_Á.ogg]]"
      sprite(2).Hypertext = "\SetScript [i0= 0 i1=0]" --deactivates the current script
      tell controls to go to marker ("magnify_back")
      dialogue.close()
      end case