Solved

Error in Game

Posted on 2004-09-03
1
243 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
1 Comment
 
LVL 20

Accepted Solution

by:
MediaMacros earned 50 total points
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In this short web based tutorial, I wanted to show users how they can still use the powers of FrontPage in conjunction with Expression Web 3.  Even though Microsoft eliminated the use of Web components, we can still use them with FrontPage and edit …
Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
The purpose of this video is to demonstrate how to create a Printer Friendly PDF on a WordPress Page. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome Screenshot” Google Chrome Extension, and SmallPDF.com Log…
The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be IPage.com Log into your Hosting account. IPage will be used for demonstration : Locat…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now