New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Just a question


Post Reply New Thread Subscribe

 
Thread Tools
primrey

 
Member Since: Feb 12, 2012
Posts: 2
primrey is on a distinguished road

primrey is offline
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
QUOTE Thanks
chscag

 
chscag's Avatar
 
Member Since: Jan 23, 2008
Location: Fort Worth, Texas
Posts: 39,145
chscag has a reputation beyond reputechscag has a reputation beyond reputechscag has a reputation beyond reputechscag has a reputation beyond reputechscag has a reputation beyond reputechscag has a reputation beyond reputechscag has a reputation beyond reputechscag has a reputation beyond reputechscag has a reputation beyond reputechscag has a reputation beyond reputechscag has a reputation beyond repute
Mac Specs: 27" iMac i5, 3.2 GHz, iPad 3, iPhone 5c, 3 iPods, OS X Mavericks

chscag is online now
Your post has been moved to the proper forum. It does not belong in "Community Suggestions........."
QUOTE Thanks

Post Reply New Thread Subscribe


« Applescript - Duplex printing from Pages | applescript help »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
The QUESTION Game ToddG Schweb's Lounge 159 08-15-2007 05:25 PM
Boot-Up Question Mark Folder Impending Doom Question. bingwalker OS X - Operating System 3 07-10-2007 05:19 AM
Ask 'me' a question... eric Schweb's Lounge 22 01-12-2007 06:33 AM
Video production question macinsandiego Movies and Video 4 11-17-2004 07:39 AM
Postscript question battleangel444 OS X - Operating System 2 07-09-2004 12:45 PM

All times are GMT -4. The time now is 03:19 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?