Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
applescript help
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="primrey" data-source="post: 1368643" data-attributes="member: 237619"><p>Please check the stats part of this is not working</p><p>[CODE]repeat</p><p> set statswin to 0</p><p> set statsLoser to 0</p><p> set statsplays to 0</p><p> set x to some item of "1234556789" as number</p><p> display dialog "Guess a number between 1 and 9" default answer "Insert number here" buttons {"OK", "Stats"} default button 1</p><p> if the button returned of the result is "Stats" then</p><p> display dialog "wins " & statswin</p><p> display dialog "Loses " & statsLoser</p><p> display dialog "Total games " & statsplays</p><p> else</p><p> </p><p> try</p><p> set theAnswer to (text returned of result) as number</p><p> on error</p><p> display dialog "Invalid Input"</p><p> say "Invalid input"</p><p> return</p><p> end try</p><p> </p><p> --Test for Correct Numbers</p><p> if theAnswer < 1 or theAnswer > 10 then</p><p> set theTest to 0</p><p> else</p><p> set theTest to 1</p><p> end if</p><p> </p><p> --Return Comments to user</p><p> if theTest = 0 then</p><p> display dialog "Invalid Input"</p><p> else</p><p> set m to theAnswer * x</p><p> set a to 1</p><p> if m is in {1, 4, 9, 16, 25, 36, 49, 64, 81} then</p><p> set a to 2</p><p> end if</p><p> if a is equal to 2 then</p><p> </p><p> display dialog "winner"</p><p> set statswin to statswin + 1</p><p> set statsplays to statsplays + 1</p><p> else</p><p> display dialog "loser"</p><p> set statsLoser to statsLoser + 1</p><p> set statsplays to statsplays + 1</p><p> end if</p><p> end if</p><p> end if</p><p>end repeat</p><p>end</p><p>end[/CODE]</p></blockquote><p></p>
[QUOTE="primrey, post: 1368643, member: 237619"] 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[/CODE] [/QUOTE]
Verification
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
applescript help
Top