Solved

Error in Game

Posted on 2004-09-03
1
248 Views
Last Modified: 2013-12-24
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








0
Comment
Question by:Angela123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 20

Accepted Solution

by:
MediaMacros earned 50 total points
ID: 11972230
YOu probably have it picking a word that is not in the list or that is mistyped.  Remember that property lists are case sensitive.  To prevent the error you might try this..

member("clue").text = string(clueList[gHangmanWord])

Or better yet make the clueList global then change the code for picking the word like this.

global clueList
on getHangmanWord
  r = random(clueList.count)
  return clueList.getPropAt(r)
end
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Standard user authenification for website plugin? 3 183
span onclick not working if no string displayed 7 66
WEB Service vs ??? 7 133
move expression web site to a new server 13 106
Now that Expression Web 4.0 (http://www.microsoft.com/expression/products/Upgrade.aspx) is free if you buy or have the full version of Expression Web 3.0, now is the best time to  migrate from FrontPage to Expression Web (http://www.frontpage-to-exp…
This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
The purpose of this video is to demonstrate how to connect a WordPress website to Google Analytics. This will be demonstrated using a Windows 8 PC Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php :…
The purpose of this video is to demonstrate how to prevent comment spam on a WordPress Website. This will be demonstrated using a Windows 8 PC. Plugin Akismet will be used. Go to your WordPress login page. This will look like the following: myw…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question