Link to home
Start Free TrialLog in
Avatar of Angela123
Angela123

asked on

Error in Game

I have managed to add clues to a game of hangman that I have been making, the game works fine and the clues appear.  However at certain points I am getting an error message saying:

Script error string expected
member("clue").text = clueList[gHangmanWord]
member 154 of castlib 1

Its obviously got something to do with the ("clue") but this is the name of my text field that the clues are appearing in. And its working fine and then it just comes to a point and this message appears and i dont know why.

The full code I have is:
global gHangmanWord

on exitFrame me
  gHangmanWord = getHangmanWord()
  showClue()
  letterList = []
  repeat with x = 1 to gHangmanWord.char.count
    letterList.add(gHangmanWord.char[x])
  end repeat
  sendAllSprites(#assignLetter, letterList)    
end

on getHangmanWord
  pickText = member("hangmanWords").text
  howManyLines = pickText.line.count
  repeat with x = howManyLines down to 1
    if pickText.line[x] = "" then delete pickText.line[x]
  end repeat
  thisOne = random(howManyLines)
  return pickText.line[thisOne]
 
end



on showClue
  clueList = ["Ice": "Clue: Its cold", "Sea": "Clue: Another name for the ocean", "Isostatic": "Clue: Word that means the land surface itself rises or falls relative to the sea", "Eustatic": "Clue: Worldwide changes in sea levels", "Kilmartin" : "Clue: Name of the place that the presentation is based on", "Earth" : " Clue: Name of the planet that we are living on", "Glacier" : "Clue:  A slowly moving mass of ice", "Mountain" : "Clue:  The name for a very high hill", "Valley" : "Clue: Low land between hills and mountains", "Woodland" : "Clue: Land that is covered with trees and shrubs", "River" : "Clue: A large stream of water that flows along a certain path", "Coastline" : "Clue: The line that separates a land surface from an ocean or sea", "Past" : "Clue: The time that has elapsed", "Climate" : "Clue: The weather in a place over a long period of time", "Wildlife" : "Clue: Animals located in the wild ", "Rock" : " Clue:  A naturally formed aggregate of usually inorganic materials from within the Earth", "Landscape" : " Clue:  An expanse of scenery that can be seen in a single view", "Pollen" : "Clue:  A fine, powdery substance released by plants and trees", "Iceberg" : " Clue: A large piece of floating ice that has broken off of a glacier", "Village" : "Clue: A settlement smaller than a town"]
  member("clue").text = clueList[gHangmanWord]
end








ASKER CERTIFIED SOLUTION
Avatar of MediaMacros
MediaMacros

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial