Hi, I am trying to teach myself applescript. I went through Jerry Lee Ford, Jr.'s book, Applescript for the Absolute Beginner, and understood everything except this following code block. Can any one help me figure out how the variable "ValidInput" switches to "true" and ends the loop?
--******** GetPlayerInput handler ******************
--This handler prompts the player to tell the game the range of
--numbers from which lottery ticket numbers should be selected
on GetPlayerInput()
--This variable is used to control loop execution
set ValidInput to false
repeat until ValidInput = true -- loop until valid input is collected
--Question,:how does ValidInput switch to true???
--Prompt the player to specify the range of numbers to be used
set NoRange to text returned of (display dialog ¬
"What is the highest number that can be selected when " & ¬
"creating a lottery ticket?" default answer ¬
"44" buttons {"OK"} with title GameTitle)
--The range must be at least 3 and no larger than 59
if (NoRange > 2) and (NoRange < 60) then
set NoRange to NoRange as integer --Convert the player input
--Question: Why do I need this step???? A: see page 101 "Coercion"
return NoRange -- Return the player's input
else -- Display an error message if the input is not valid
display dialog "Error: You must enter an integer value " & ¬
"between 3 and 59" with title GameTitle
end if
end repeat
end GetPlayerInput
=
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: