Results 1 to 2 of 2

Thread: Just a question

  1. #1


    Member Since
    Feb 12, 2012
    Posts
    2
    Just a question
    Please check the stats part of this is not working
    Code:
    repeat
    	set statswin to 0
    	set statsLoser to 0
    	set statsplays to 0
    	set x to some item of "1234556789" as number
    	display dialog "Guess a number between 1 and 9" default answer "Insert number here" buttons {"OK", "Stats"} default button 1
    	if the button returned of the result is "Stats" then
    		display dialog "wins " & statswin
    		display dialog "Loses " & statsLoser
    		display dialog "Total games " & statsplays
    	else
    		
    		try
    			set theAnswer to (text returned of result) as number
    		on error
    			display dialog "Invalid Input"
    			say "Invalid input"
    			return
    		end try
    		
    		--Test for Correct Numbers
    		if theAnswer < 1 or theAnswer > 10 then
    			set theTest to 0
    		else
    			set theTest to 1
    		end if
    		
    		--Return Comments to user
    		if theTest = 0 then
    			display dialog "Invalid Input"
    		else
    			set m to theAnswer * x
    			set a to 1
    			if m is in {1, 4, 9, 16, 25, 36, 49, 64, 81} then
    				set a to 2
    			end if
    			if a is equal to 2 then
    				
    				display dialog "winner"
    				set statswin to statswin + 1
    				set statsplays to statsplays + 1
    			else
    				display dialog "loser"
    				set statsLoser to statsLoser + 1
    				set statsplays to statsplays + 1
    			end if
    		end if
    	end if
    end repeat
    end
    end

  2. #2

    chscag's Avatar
    Member Since
    Jan 23, 2008
    Location
    Keller, Texas
    Posts
    55,643
    Your post has been moved to the proper forum. It does not belong in "Community Suggestions........."

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. G3 question building question
    By OtakuboyT in forum Apple Desktops
    Replies: 1
    Last Post: 08-30-2009, 03:37 PM
  2. Noob question (MBPro question)
    By jcragg in forum Apple Notebooks
    Replies: 2
    Last Post: 01-21-2009, 08:04 AM
  3. Hardware Question + Linux Question
    By Sir Edwin CBE in forum Running Windows (or anything else) on your Mac
    Replies: 0
    Last Post: 11-20-2007, 12:53 PM
  4. Boot-Up Question Mark Folder Impending Doom Question.
    By bingwalker in forum macOS - Operating System
    Replies: 3
    Last Post: 07-10-2007, 05:19 AM
  5. Airport Question & Program Default Question
    By vicariousgeorge in forum Switcher Hangout
    Replies: 1
    Last Post: 03-02-2007, 12:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •