Achilles Posted October 3, 2007 Share Posted October 3, 2007 Nice game AlmarM... My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
WeMartiansAreFriendly Posted October 3, 2007 Share Posted October 3, 2007 1st try: 22.8 seconds 2nd try: 14.9 Seconds I play shooting games alot Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet() Link to comment Share on other sites More sharing options...
alien13 Posted October 3, 2007 Share Posted October 3, 2007 (edited) @Manadar -- I have modified yours a little just to keep the local saved scores feature and added a little not to say what level that score is from. Other than that I like what you have done, I can really learn a lot from your script, so for that I thank you! Here is the modified ver. alien13 Edited October 3, 2007 by alien13 Link to comment Share on other sites More sharing options...
AlmarM Posted October 3, 2007 Author Share Posted October 3, 2007 Srry, but im not gonne add scripts that I dont understand... Im not THAT good in AutoIT scriping. So im staying with my Old script THAT I understand ^^ Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
jvanegmond Posted October 3, 2007 Share Posted October 3, 2007 (edited) well I saw the original script and felt compelled to write a better one. I was disappointed to see that I'm a bit late. I felt like I owe Manadar something, since he came up with the array idea, but I, too, had the idea, and didn't read his scripts before writing mine. I'm sorry if any of it looks similar, I did write it. I decided to leave the random pick out of the code, because depending on how the random buttons are picked, it could make the game very easy. I kept everything exactly the way AlmarM had it, except for the way it was written and how things are displayed. Take a look. I would enjoy feedback from experienced coders able to shorten up my code. So here it is:Back to Manadar, nice script, although you left out exit functionality during the game, and the ability to change modes once one is picked. I really enjoyed the About screen. I may have to use that in the rest of my scripts, your name of course included.I completely believe you. The array step was a logical one to make, and you used a one dimensional array.. I always prefer to keep two dimensions, when using two axis's, to make things easier.The reason why I left out exit functionality is the same reason why I didn't add a lot of things that I could have added. I wanted to show AlmarM the purpose of arrays, and why he should learn them. Nothing else. Also, I doubt putting in exit functionality during the game is a logic step. I may need to rewrite the game to OnEvent mode. Thanks for the compliment on the About screen. I wrote it for someone else to use, but I figured if he was not going to use it I may well advertise it a little bit more. Also thanks for giving me credit, should you use the about screen. Always appreciate it.@alien13, I like the way you keep the high scores. I do hope you learn a lot from the script, as that is it's primary purpose. Happy to teach! Edited October 3, 2007 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
jvanegmond Posted October 3, 2007 Share Posted October 3, 2007 (edited) Here's a different version of the game, the basics are the same.. You still have to click a button. expandcollapse popupOpt("GUIOnEventMode", 1) #include <GUIConstants.au3> Dim $gButton[3][2][2], $iStart = 0, $iPressed = 0, $iClicks = 0, $sTime $sGUI = GUICreate("HowFastAreU2", 400, 400) GUISetOnEvent($GUI_EVENT_CLOSE,"_Exit") GUICtrlCreateLabel("Welcome to HowFastAreU version 2! This time you have three different boxes. All three of them move constantly. Your objective is to click on a box as soon as it lits up. How fast can you tick them? Good luck.", 10, 350, 380, 50) For $x = 0 to 2 $gButton[$x][0][0] = GUICtrlCreateButton("Start", 10+(60*$x), 10, 50, 50) $gButton[$x][1][0] = 10+(60*$x) $gButton[$x][1][1] = 10 GUICtrlSetOnEvent($gButton[$x][0][0],"_Button" & $x) Next GUISetState() While 1 Sleep(50) For $x = 0 to 2 $aPos = ControlGetPos($sGUI,"",$gButton[$x][0][0]) If ($gButton[$x][1][0] <> $aPos[0]) OR ($gButton[$x][1][1] <> $aPos[1]) Then $delX = ($gButton[$x][1][0] - $aPos[0]) / 10 $delY = ($gButton[$x][1][1] - $aPos[1]) / 10 If (Round($delX,0) < 5) AND (Round($delY,0) < 5) AND ($gButton[$x][0][1] = $GUI_DISABLE) Then GUICtrlSetState($gButton[$x][0][0],$GUI_ENABLE) $gButton[$x][0][1] = $GUI_ENABLE Else ControlMove($sGUI,"",$gButton[$x][0][0],$aPos[0]+$delX,$aPos[1]+$delY) EndIf EndIf Next WEnd Func _Button0() If Not $iStart Then $iPressed += 1 GUICtrlSetState($gButton[0][0][0],$GUI_DISABLE) If $iPressed = 3 Then StartGame() EndIf Else $gButton[0][1][0] = Random(10,340,1) $gButton[0][1][1] = Random(10,290,1) GUICtrlSetState($gButton[0][0][0],$GUI_DISABLE) $gButton[0][0][1] = $GUI_DISABLE $iClicks += 1 CheckVictory() EndIf EndFunc Func _Button1() If Not $iStart Then $iPressed += 1 GUICtrlSetState($gButton[1][0][0],$GUI_DISABLE) If $iPressed = 3 Then StartGame() EndIf Else $gButton[1][1][0] = Random(10,340,1) $gButton[1][1][1] = Random(10,290,1) GUICtrlSetState($gButton[1][0][0],$GUI_DISABLE) $gButton[1][0][1] = $GUI_DISABLE $iClicks += 1 CheckVictory() EndIf EndFunc Func _Button2() If Not $iStart Then $iPressed += 1 GUICtrlSetState($gButton[2][0][0],$GUI_DISABLE) If $iPressed = 3 Then StartGame() EndIf Else $gButton[2][1][0] = Random(10,340,1) $gButton[2][1][1] = Random(10,290,1) GUICtrlSetState($gButton[2][0][0],$GUI_DISABLE) $gButton[2][0][1] = $GUI_DISABLE $iClicks += 1 CheckVictory() EndIf EndFunc Func StartGame() $iStart = 1 For $x = 0 to 2 GUICtrlSetData($gButton[$x][0][0],"Click") $gButton[$x][0][1] = $GUI_DISABLE $gButton[$x][1][0] = Random(10,340,1) $gButton[$x][1][1] = Random(10,290,1) Next $sTime = TimerInit() EndFunc Func CheckVictory() If $iClicks > 50 Then $temp = Round(TimerDiff($sTime)/1000,1) $sResult = "You got them in " & $temp & " seconds." If $temp > 30 Then $sResult &= @CRLF & @CRLF & "HINT: The boxes that move just a little once you have clicked " & @CRLF & _ "them become available for clicking sooner, so keep your mouse close!!" EndIf For $x = 0 to 2 GUICtrlSetData($gButton[$x][0][0],"Start") GUICtrlSetState($gButton[$x][0][0],$GUI_DISABLE) $gButton[$x][0][1] = $GUI_DISABLE $gButton[$x][1][0] = 10+(60*$x) $gButton[$x][1][1] = 10 Next $iStart = 0 $iPressed = 0 $iClicks = 0 $sTime = 0 MsgBox(0, "Your results..", $sResult) EndIf EndFunc Func _Exit() Exit EndFunc Edited October 3, 2007 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
alien13 Posted October 4, 2007 Share Posted October 4, 2007 I got 25.7 seconds on first try at your script manadar Nice work! Link to comment Share on other sites More sharing options...
AlmarM Posted October 4, 2007 Author Share Posted October 4, 2007 Im at school now so i cant test is and.. Ty for saying the script is good (The idea) But i just cant figure out where all the Click Buttons are :S And when its disable and enable so... Thats why im not adding it ... PS Some1 mayby have some other EASY ideas for me ?? I mean im bored the last weaks because i dont have any ideas for any scripts... So anyone have an idea for me ?? Not TO hard please... Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
jvanegmond Posted October 4, 2007 Share Posted October 4, 2007 Im at school now so i cant test is and.. Ty for saying the script is good (The idea) But i just cant figure out where all the Click Buttons are :SAnd when its disable and enable so... Thats why im not adding it ...PSSome1 mayby have some other EASY ideas for me ?? I mean im bored the last weaks because i dont have any ideas for any scripts... So anyone have an idea for me ?? Not TO hard please...Well, maybe you could update your clicking game to have multiple buttons at the same time you can click.. github.com/jvanegmond Link to comment Share on other sites More sharing options...
AlmarM Posted October 4, 2007 Author Share Posted October 4, 2007 (edited) Well, maybe you could update your clicking game to have multiple buttons at the same time you can click.. You mean? For exampleX = Enabled ButtonO = Disabled ButtonO X O O OO O O X OX O O O XO O O O OO O X O OX O O O OIs that what you mean ?? Exexpt that there are many Enabled. Or is that what you mean ?But I dont get whats fun about that, because it will easier Edited October 4, 2007 by AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
LongBowNZ Posted October 4, 2007 Share Posted October 4, 2007 ... etc ...But I dont get whats fun about that, because it will easierMake it so only one button works Link to comment Share on other sites More sharing options...
energy Posted October 5, 2007 Share Posted October 5, 2007 Here is my best time: It was a lot of work. Link to comment Share on other sites More sharing options...
AlmarM Posted October 4, 2008 Author Share Posted October 4, 2008 Woah!Never knewn there was a discussion between Manadar and me.Afther re-reading it all, there is one thing I want to say:SorryJust re-read all things I said AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
jvanegmond Posted October 6, 2008 Share Posted October 6, 2008 Never knewn there was a discussion between Manadar and me.Afther re-reading it all, there is one thing I want to say:You shouldn't have to say sorry. You meant what you said, and I respect you for doing so. github.com/jvanegmond Link to comment Share on other sites More sharing options...
AlmarM Posted October 9, 2008 Author Share Posted October 9, 2008 Awww thank you AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
Canasian Posted April 27, 2009 Share Posted April 27, 2009 I win!!! rawr. Already been done.. but still was fun Link to comment Share on other sites More sharing options...
jvanegmond Posted April 27, 2009 Share Posted April 27, 2009 Stop digging github.com/jvanegmond Link to comment Share on other sites More sharing options...
FinalVersion Posted April 27, 2009 Share Posted April 27, 2009 [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center] Link to comment Share on other sites More sharing options...
Mat Posted April 27, 2009 Share Posted April 27, 2009 (edited) I win!!! rawr. Rawr, I'm a dinosaur!! small bug. control click works on disabled buttons and it only times from begininnig to end. 0.2 is the new record. ControlClick ("How fast are u ?", "", 3) ControlClick ("How fast are u ?", "", 4) very simple really without cheating got it down to 20.3. MDiesel Edited April 27, 2009 by mdiesel AutoIt Project Listing Link to comment Share on other sites More sharing options...
youknowwho4eva Posted April 27, 2009 Share Posted April 27, 2009 (edited) A little harder to cheat on I think? The label at the bottom tells you column and row to click on I believe I did that part right, in case I didn't columns are vertical, rows are horizontal. CODE#include <GuiConstants.au3> #include <Constants.au3> Dim $button[100][100] Global $dif, $start_button $r = 0 $b = 0 $r1 = 1 $r2 = 1 HotKeySet("{F4}", "HighScores") $Main = GUICreate("How fast are u ?", 470, 640) ; Given this GUI a name GUISetState(@SW_SHOW) For $w = 1 to 6 For $i = 1 to 6 $r += 1 $button[$i][$w] = GUICtrlCreateButton("Button" & $r, ($i * 10) + ($i * 50), ($w * 10) + ($w * 50), 50, 50) GUICtrlSetState(-1,$GUI_DISABLE) Next Next $Quick_HighScore = GUICtrlCreateEdit("Quick Highscore view" & @CRLF & @CRLF, 60, 430, 350, 120) $start_button = GUICtrlCreateButton("Start",50,560,80,30) $Restart_Button = GUICtrlCreateButton("Restart", 150, 560, 80, 30) $HighScores = GUICtrlCreateButton("High Scores", 250, 560, 80, 30) $About = GUICtrlCreateButton("About", 350, 560, 80, 30) $label = GUICtrlCreateLabel("Label",200,600,200,20) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit ;~ Case $msg = $Start_Button For $w = 1 To 6 For $i = 1 To 6 GUICtrlSetState($button[$i][$w],$GUI_ENABLE) ;~ MsgBox(0,"","") Next Next $r1 = Random(1,6,1) $r2 = Random(1,6,1) $begin = TimerInit() GUICtrlSetData($label, "Column: " & $r1 & " Row: " & $r2) Case $msg = $button[$r1][$r2] $b += 1 $r1 = Random(1,6,1) $r2 = Random(1,6,1) GUICtrlSetData($label, "Column: " & $r1 & " Row: " & $r2) ;~ Case $msg[1] = $main ;~ MsgBox(0,"",$msg[1]) Case $b = 10 Beep(500, 100) $dif = Round(TimerDiff($begin) / 1000, 1) MsgBox(0, "Your Time: ", "Your time is: " & $dif & " seconds. ") GUICtrlSetData($Quick_HighScore, $dif & " Seconds" & @CRLF, "|") ;Asks the user if they want to save their score If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(36, "Save", "Would you like to save your score?") Select Case $iMsgBoxAnswer = 6 ;Yes Save() ; Goes to the save function Case $iMsgBoxAnswer = 7 ;No ;nothing EndSelect _reset() Case $msg = $Restart_Button _Reset() Case $msg = $HighScores HighScores() Case $msg = $About About() EndSelect Sleep (20) WEnd Func _Reset() Sleep(100) ;~ MsgBox(0, "Restart", "Restarting" & @CRLF & "Please wait...", 2) $r1 = Random(1,6,1) $r2 = Random(1,6,1) $b = 0 For $w = 1 To 6 For $i = 1 To 6 GUICtrlSetState($button[$i][$w],$GUI_DISABLE) ;~ MsgBox(0,"","") Next Next Sleep(100) EndFunc ;==>_Reset Func Save() FileWrite(@ScriptDir & "\Scores.txt", $dif & " Seconds" & @CRLF) MsgBox(64, "Saved", "Your high score has been saved!") ; Tells you it is saved HighScores() ; Opens the high scores window EndFunc ;==>Save Func HighScores() $Scores = FileRead(@ScriptDir & "\Scores.txt") ; Reads the scores from the txt file If @error Then MsgBox(0, "", "Error occurred, you probably haven't saved any scores yet.") Else GUISetState(@SW_HIDE, $Main) $HSW = GUICreate("High Scores", 241, 237) $HS = GUICtrlCreateEdit("Scores:"& @CRLF & $Scores, 10, 10, 221, 217, BitOR($ES_READONLY, $ES_WANTRETURN)) GUISetState(@SW_SHOW) While 3 $msg3 = GUIGetMsg() Select Case $msg3 = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd GUIDelete($HSW) GUISetState(@SW_SHOW, $Main) EndIf EndFunc ;==>HighScores Func About() GUISetState(@SW_HIDE, $Main) $AboutWindow = GUICreate("About", 250, 200) $ProgramName = GUICtrlCreateLabel("How fast are u?", 85, 26) $ProgramDescription = GUICtrlCreateEdit("Credits:" & @CRLF & @CRLF & "Scripter: AlmarM" & @CRLF & "Game by: AlmarM" & @CRLF & "Some things edited by: alien13", 20, 60, 210, 126, BitOR($ES_READONLY, $ES_WANTRETURN)) GUISetState(@SW_SHOW) While 2 $msg2 = GUIGetMsg() Select Case $msg2 = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd GUIDelete($AboutWindow) GUISetState(@SW_SHOW, $Main) EndFunc Edited April 27, 2009 by youknowwho4eva Giggity Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now