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
Solved

Error in Game

Posted on 2004-09-03
1
246 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
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…

856 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