Jump to content

magician13134

Active Members
  • Posts

    383
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

magician13134's Achievements

Universalist

Universalist (7/7)

0

Reputation

  1. I did run the code exactly as posted in post #4, and that's what gave me weird results. I was just comparing those results to what another program was giving me simultaneously. I don't know if anyone else had this problem, but I compared a bunch of points that I was reading from the script in post #4 to what they should be and linearized it, so this is what I had to do to get it working... It may just be something wrong with my computer, but here's the equation I had to use$realPoint=10^(2.002*Log($coord[$i])/Log(10) - 2.413)That yields the proper coordinates for me...
  2. Sorry to bring up and old topic, but I'm trying to get this to work and I'm having some troubles. The script works great, but the numbers seem a little off. The number range I was getting was from 0-65535 (2^16) rather than 0-255 (2^8), so I just took the square root, but when the joystick is at rest, it reads ~180 rather than 128. This is true for all three axes. I have reset the joystick calibration in Windows, but I don't think that's the issue, because other programs read the joystick fine (as 128 when it's at rest). Does anyone know anything about this? Your help would be greatly appreciated. Thanks!
  3. Hey, I used to use this UDF a while ago, but now I'm getting this error when I try to run your example script (CommMG.au3 and commg.dll are in the same directory) >"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Users\magician13134\Desktop\Com\CommgExample.au3" /autoit3dir "C:\Program Files (x86)\AutoIt3" /UserParams +>11:29:31 Starting AutoIt3Wrapper v.2.0.0.3 Environment(Language:0409 Keyboard:00000409 OS:WIN_VISTA/ CPU:X64 OS:X64) >Running AU3Check (1.54.14.0) from:C:\Program Files (x86)\AutoIt3 +>11:29:31 AU3Check ended.rc:0 >Running:(3.3.0.0):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "C:\Users\magician13134\Desktop\Com\CommgExample.au3" error in get version C:\Users\magician13134\Desktop\Com\CommgExample.au3 (190) : ==> Subscript used with non-Array variable.: For $pl = 1 To $portlist[0] For $pl = 1 To $portlist^ ERROR ->11:29:31 AutoIT3.exe ended.rc:1 +>11:29:33 AutoIt3Wrapper Finished >Exit code: 1 Time: 3.165 I'm using Windows 7, does this have anything to do with it?
  4. Very nice! Any way to control backlight? I don't see it in the AvLCD.au3 file. I guess it's not in the dll either, so I need to go bug the guy who made that
  5. Ha ha... totally missed that. A little awkward... Anyway guys, here it is, finished(ish), there's one bug, it doesn't say "None Found" when no words are found, which is a bit odd... But whatever. Not necessary. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <String.au3> Dim $alphabet1[26] Dim $alphabet2[26] Dim $letters[2][2] Dim $pScore[8] Dim $pAdd1[8] Dim $pAdd2[8] Dim $pSub1[8] Dim $score[8] For $i = 0 to 5 $score[$i] = 0 Next $alphabet1[0]="a" ; A $alphabet1[1]="b" ; B $alphabet1[2]="c" ; C $alphabet1[3]="d" ; D $alphabet1[4]="e" ; E $alphabet1[5]="f" ; F $alphabet1[6]="g" ; G $alphabet1[7]="h" ; H $alphabet1[8]="i" ; I $alphabet1[9]="j" ; J $alphabet1[10]="k" ; K $alphabet1[11]="l" ; L $alphabet1[12]="m" ; M $alphabet1[13]="n" ; N $alphabet1[14]="o" ; O $alphabet1[15]="p" ; P $alphabet1[16]="t" ; Q $alphabet1[17]="r" ; R $alphabet1[18]="s" ; S $alphabet1[19]="t" ; T $alphabet1[20]="u" ; U $alphabet1[21]="v" ; V $alphabet1[22]="w" ; W $alphabet1[23]="s" ; X $alphabet1[24]="y" ; Y $alphabet1[25]="z" ; Z $alphabet2[0]="a" ; A $alphabet2[1]="b" ; B $alphabet2[2]="c" ; C $alphabet2[3]="d" ; D $alphabet2[4]="e" ; E $alphabet2[5]="f" ; F $alphabet2[6]="g" ; G $alphabet2[7]="h" ; H $alphabet2[8]="i" ; I $alphabet2[9]="e" ; J $alphabet2[10]="k" ; K $alphabet2[11]="l" ; L $alphabet2[12]="m" ; M $alphabet2[13]="n" ; N $alphabet2[14]="o" ; O $alphabet2[15]="p" ; P $alphabet2[16]="t" ; Q $alphabet2[17]="r" ; R $alphabet2[18]="s" ; S $alphabet2[19]="t" ; T $alphabet2[20]="u" ; U $alphabet2[21]="v" ; V $alphabet2[22]="w" ; W $alphabet2[23]="s" ; X $alphabet2[24]="y" ; Y $alphabet2[25]="s" ; Z $GUI = GUICreate("Smart Mouth", 411, 420) $startButton = GUICtrlCreateButton("Generate", 20, 162, 100, 35) $showButton = GUICtrlCreateButton("Show answers", 180, 162, 100, 35) $letters[0][0] = GUICtrlCreateLabel("", 30, 10, 80, 125) GUICtrlSetFont(-1, 40, 10000) GUICtrlSetBkColor(-1, 0x33FF11) GUICtrlSetColor(-1, 0x000000) $changeLetter1 = GUICtrlCreateInput("", 30, 139, 15, 20) GUICtrlSetLimit(-1, 1) $doChange1 = GUICtrlCreateButton("Change", 50, 139, 60, 20) $changeLetter2 = GUICtrlCreateInput("", 190, 139, 15, 20) GUICtrlSetLimit(-1, 1) $doChange2 = GUICtrlCreateButton("Change", 210, 139, 60, 20) $letters[1][0] = GUICtrlCreateLabel("", 190, 10, 80, 125) GUICtrlSetFont(-1, 40, 10000) GUICtrlSetBkColor(-1, 0xEE8800) GUICtrlSetColor(-1, 0x000000) $loading = GUICtrlCreateLabel("", 24, 200, 250) $answersEdit = GUICtrlCreateEdit("", 20, 215, 260, 150) GUICtrlCreateLabel("Check is a word is valid:", 20, 370, 150, 17) $checkWord = GUICtrlCreateInput("", 20, 385, 150, 20) $checkbutton = GUICtrlCreateButton("Check", 175, 385, 40, 20) $valid = GUICtrlCreateLabel("", 225, 377, 75, 50) GUICtrlSetFont(-1, 21, 2000) GUISetState(@SW_SHOW) $file = FileOpen("words.txt", "r") $contents = FileRead($file) $player1 = GUICtrlCreateGroup("Player 1", 290, 5, 110, 50) $pScore[1] = GUICtrlCreateLabel("0", 295, 28, 25, 17) $pSub1[1] = GUICtrlCreateButton("-1", 320, 25, 20, 20) $pAdd1[1] = GUICtrlCreateButton("+1", 345, 25, 20, 20) $pAdd2[1] = GUICtrlCreateButton("+2", 370, 25, 20, 20) $player2 = GUICtrlCreateGroup("Player 2", 290, 65, 110, 50) $pScore[2] = GUICtrlCreateLabel("0", 295, 88, 25, 17) $pSub1[2] = GUICtrlCreateButton("-1", 320, 85, 20, 20) $pAdd1[2] = GUICtrlCreateButton("+1", 345, 85, 20, 20) $pAdd2[2] = GUICtrlCreateButton("+2", 370, 85, 20, 20) $player3 = GUICtrlCreateGroup("Player 3", 290, 125, 110, 50) $pScore[3] = GUICtrlCreateLabel("0", 295, 148, 25, 17) $pSub1[3] = GUICtrlCreateButton("-1", 320, 145, 20, 20) $pAdd1[3] = GUICtrlCreateButton("+1", 345, 145, 20, 20) $pAdd2[3] = GUICtrlCreateButton("+2", 370, 145, 20, 20) $player4 = GUICtrlCreateGroup("Player 4", 290, 185, 110, 50) $pScore[4] = GUICtrlCreateLabel("0", 295, 208, 25, 17) $pSub1[4] = GUICtrlCreateButton("-1", 320, 205, 20, 20) $pAdd1[4] = GUICtrlCreateButton("+1", 345, 205, 20, 20) $pAdd2[4] = GUICtrlCreateButton("+2", 370, 205, 20, 20) $player5 = GUICtrlCreateGroup("Player 5", 290, 245, 110, 50) $pScore[5] = GUICtrlCreateLabel("0", 295, 268, 25, 17) $pSub1[5] = GUICtrlCreateButton("-1", 320, 265, 20, 20) $pAdd1[5] = GUICtrlCreateButton("+1", 345, 265, 20, 20) $pAdd2[5] = GUICtrlCreateButton("+2", 370, 265, 20, 20) $player6 = GUICtrlCreateGroup("Player 6", 290, 305, 110, 50) $pScore[6] = GUICtrlCreateLabel("0", 295, 328, 25, 17) $pSub1[6] = GUICtrlCreateButton("-1", 320, 325, 20, 20) $pAdd1[6] = GUICtrlCreateButton("+1", 345, 325, 20, 20) $pAdd2[6] = GUICtrlCreateButton("+2", 370, 325, 20, 20) $player7 = GUICtrlCreateGroup("Player 7", 290, 365, 110, 50) $pScore[7] = GUICtrlCreateLabel("0", 295, 388, 25, 17) $pSub1[7] = GUICtrlCreateButton("-1", 320, 385, 20, 20) $pAdd1[7] = GUICtrlCreateButton("+1", 345, 385, 20, 20) $pAdd2[7] = GUICtrlCreateButton("+2", 370, 385, 20, 20) While 1 $msg = GUIGetMsg() If $msg == $GUI_EVENT_CLOSE Then quit() If $msg == $startButton Then getLetters() If $msg == $showButton Then getAnswers() If $msg == $checkButton Then checkWord() If $msg == $doChange1 or $msg == $doChange2 Then getLetters(StringLower(GUICtrlRead($changeLetter1)), StringLower(GUICtrlRead($changeLetter2))) For $i = 1 to 7 If $msg == $pSub1[$i] Then updateScore($i, -1) EndIf If $msg == $pAdd1[$i] Then updateScore($i, 1) EndIf If $msg == $pAdd2[$i] Then updateScore($i, 2) EndIf Next WEnd Func updateScore($player, $add) $score[$player]+=$add If $score[$player] < 0 Then $score[$player] = 0 EndIf GUICtrlSetData($pScore[$player], $score[$player]) EndFunc Func checkWord() $word = GUICtrlRead($checkWord) If StringInStr($contents, @CRLF & $word & @CRLF, 2) Then GUICtrlSetColor($valid, 0x00FF00) GUICtrlSetData($valid, "YES") Else GUICtrlSetColor($valid, 0xFF0000) GUICtrlSetData($valid, "NO") EndIf EndFunc Func getLetters($l1 = -1, $l2 = -1) $letters[0][1] = $l1 $letters[1][1] = $l2 If $l1 == -1 Then $letters[0][1] = $alphabet1[Random(0, 25, 1)] EndIf If $l2 == -1 Then $letters[1][1] = $alphabet2[Random(0, 25, 1)] EndIf GUICtrlSetData($answersEdit, "") GUICtrlSetData($letters[0][0], " " & StringUpper($letters[0][1])) GUICtrlSetData($letters[1][0], " " & StringUpper($letters[1][1])) GUICtrlSetData($changeLetter1, StringUpper($letters[0][1])) GUICtrlSetData($changeLetter2, StringUpper($letters[1][1])) EndFunc Func getAnswers() $data = "" GUICtrlSetData($loading, "Loading...") $answers = StringRegExp($contents,"\b(" & $letters[0][1] & "[a-z]*" & $letters[1][1] & ")\b",3) If @error Then ; This doesn't work for some reason... GUICtrlSetData($loading, "") GUICtrlSetData($answersEdit, "None found") Return False EndIf $length = (Ubound($answers) - 1) GUICtrlSetData($loading, "") For $i = 0 to $length If StringLen($answers[$i]) >= 4 Then $data&=$answers[$i] If $i <> $length Then $data&=@CRLF EndIf EndIf Next GUICtrlSetData($answersEdit, $data) EndFunc Func quit() FileClose($file) Exit EndFunc
  6. Right, I had already replaced that with \B* like "Richard Robertson" suggested, they both return the same thing. One array.... thing... I can't believe I can't think of the word for that... one array value..? containing every word starting with the first letter... I'm pretty puzzled by that... EDIT Actually, you guys were right (that sounds rude, I said actually because I was mistaken) I had $Letters[0][1] twice instead of having $letters[0][1] and $letters[1][1], then I guess I have an input control instead of an edit accounting for the one-linedness, rather than one array value. Let me fix those things and get back to you. Yup, that was the problem/those were the problems. Thanks guys and sorry for being careless
  7. Well, the reason I wasn't doing this: For $X = Asc("a") to Asc("z") $alphabet1[$iIndex] = Chr($X) $iIndex += 1 Next Is because it's not the complete alphabet, there's some missing, but yes, that third method is much simpler. I forgot about that. And the regular expression is still a little messed up. It returns words, but a lot of them and it seems in just one array value...
  8. Ooh, right. That makes sense. Let me try that. Hmmm... it's still not working. Maybe having the whole source code would help. It's a game called SmartMouth that I'm try to write. The idea is two letters are generated, and you must find words that start and end with those. No proper nouns, that's why it's case sensitive. Here it is: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Dim $alphabet1[26] Dim $alphabet2[26] Dim $letters[2][2] $alphabet1[0]="a" ; A $alphabet1[1]="b" ; B $alphabet1[2]="c" ; C $alphabet1[3]="d" ; D $alphabet1[4]="e" ; E $alphabet1[5]="f" ; F $alphabet1[6]="g" ; G $alphabet1[7]="h" ; H $alphabet1[8]="i" ; I $alphabet1[9]="j" ; J $alphabet1[10]="k" ; K $alphabet1[11]="l" ; L $alphabet1[12]="m" ; M $alphabet1[13]="n" ; N $alphabet1[14]="o" ; O $alphabet1[15]="p" ; P $alphabet1[16]="t" ; Q $alphabet1[17]="r" ; R $alphabet1[18]="s" ; S $alphabet1[19]="t" ; T $alphabet1[20]="u" ; U $alphabet1[21]="v" ; V $alphabet1[22]="w" ; W $alphabet1[23]="s" ; X $alphabet1[24]="y" ; Y $alphabet1[25]="z" ; Z $alphabet2[0]="a" ; A $alphabet2[1]="b" ; B $alphabet2[2]="c" ; C $alphabet2[3]="d" ; D $alphabet2[4]="e" ; E $alphabet2[5]="f" ; F $alphabet2[6]="g" ; G $alphabet2[7]="h" ; H $alphabet2[8]="i" ; I $alphabet2[9]="e" ; J $alphabet2[10]="k" ; K $alphabet2[11]="l" ; L $alphabet2[12]="m" ; M $alphabet2[13]="n" ; N $alphabet2[14]="o" ; O $alphabet2[15]="p" ; P $alphabet2[16]="t" ; Q $alphabet2[17]="r" ; R $alphabet2[18]="s" ; S $alphabet2[19]="t" ; T $alphabet2[20]="u" ; U $alphabet2[21]="v" ; V $alphabet2[22]="w" ; W $alphabet2[23]="s" ; X $alphabet2[24]="y" ; Y $alphabet2[25]="s" ; Z $GUI = GUICreate("Smart Mouth", 311, 420, 193, 115) $startButton = GUICtrlCreateButton("Generate", 20, 200, 100, 35) $showButton = GUICtrlCreateButton("Show answers", 180, 200, 100, 35) $letters[0][0] = GUICtrlCreateLabel("", 30, 50, 80, 125) GUICtrlSetFont(-1, 40, 10000) GUICtrlSetBkColor(-1, 0x33FF11) GUICtrlSetColor(-1, 0x000000) $letters[1][0] = GUICtrlCreateLabel("", 190, 50, 80, 125) GUICtrlSetFont(-1, 40, 10000) GUICtrlSetBkColor(-1, 0xEE8800) GUICtrlSetColor(-1, 0x000000) $answersEdit = GUICtrlCreateInput("", 24, 256, 265, 150) GUISetState(@SW_SHOW) $file = FileOpen("words.txt", "r") $contents = FileRead($file) While 1 $msg = GUIGetMsg() If $msg == $GUI_EVENT_CLOSE Then quit() If $msg == $startButton Then getLetters() If $msg == $showButton Then getAnswers() WEnd Func getLetters() $letters[0][1] = $alphabet1[Random(0, 25, 1)] $letters[1][1] = $alphabet2[Random(0, 25, 1)] GUICtrlSetData($answersEdit, "") GUICtrlSetData($letters[0][0], " " & StringUpper($letters[0][1])) GUICtrlSetData($letters[1][0], " " & StringUpper($letters[1][1])) EndFunc Func getAnswers() ConsoleWrite($letters[0][1] & @CRLF & $letters[1][1] & @CRLF) $data = "" $answers = StringRegExp($contents, "\b" & $letters[0][1] & "\B*" & $letters[1][1] & "\b", 1) If not IsArray($answers) Then Return False EndIf For $i = 0 to Ubound($answers) $data&=$answers[$i] Next GUICtrlSetData($answersEdit, $data) EndFunc Func quit() FileClose($file) Exit EndFuncoÝ÷ Øý½æ¥²kçm+ºÚ"µÍÌÍØ[ÝÙÈHÔÝ[Ð]ÙY[ ÌÍØÛÛ[Ë [È ÌÍÛ]ÖÌVÌWK ÌÍÛ]ÖÌWVÌWH [ÈÔJ The word list can be downloaded in this file: http://hood.sjfn.nb.ca/~eddie/wscr.htmlMake sure you rename it to .txt
  9. I have a list of several words in a text file, and I need to match words based on the first and last letter. So let's say that I know the first letter is "h" and the last letter is "o", I would like this to find the world "hello" if it is on the list. I read the tutorial in the help file and the thirty minute tutorial linked to in that, and I still am unsure, thanks. This is what I have, but it's not working... $answers = StringRegExp($contents, "\b" & $letters[0][1] & ".*" & $letters[1][1] & "\b", 1) ;$letters[0][1] = first letter ;$letters[1][1] = second letter
  10. Don't forget your quotes around the string:$Website = "AutoItScript.com/forum" _IECreate($Website, 0, 0)
  11. Don't include the brackets or variable, those just show you the variable name and if it's optional. Use this:#include <IE.au3> _IECreate ("www.SiteYouWantToOpen.com", 0, 1)
  12. It's been awhile since I worked on this, just thought I upload a slightly upgraded script. I know this could have been coded a lot better, but I'm to lazy to fix it now... It works, so... I'll let it be #include <GUIConstants.au3> $width = 45 $height = 45 $color = 0xFF0000 $bestTimeCount = "" $clicks = 0 $totalAverage = 0 $generousAverage = 0 $misses = 0 $button = "" $GUI = GUICreate("Reflex tester", 945, 800, -1, 0) $lastTime = GUICtrlCreateLabel("Last time: ", 16, 688, 200, 17) $bestTime = GUICtrlCreateLabel("Best time: ", 16, 708, 200, 17) $missesLabel = GUICtrlCreateLabel("Misses: ", 16, 728, 200, 17) $timesGroup = GUICtrlCreateGroup("Times", 8, 656, 249, 105) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("", 8, 8, 929, 641) GUICtrlCreateGroup("", -99, -99, 1, 1) $label = GUICtrlCreateLabel("", 8, 8, 929, 641) $optionsGroup = GUICtrlCreateGroup("Options", 272, 656, 665, 110) $colorBox = GUICtrlCreateInput("FF0000", 288, 678, 121, 21) $widthBox = GUICtrlCreateInput("45", 456, 678, 121, 21) $heightBox = GUICtrlCreateInput("45", 624, 678, 121, 21) $delayBox = GUICtrlCreateInput("2500", 800, 678, 121, 21) $Label1 = GUICtrlCreateLabel("Color", 344, 703, 28, 17) $Label2 = GUICtrlCreateLabel("Width", 504, 703, 32, 17) $Label3 = GUICtrlCreateLabel("Height", 672, 703, 35, 17) $Label4 = GUICtrlCreateLabel("Max. delay (mS)", 826, 703, 75, 17) $decoyCheckBox = GUICtrlCreateCheckbox("Decoy?", 800, 738, 121) GUICtrlSetState(-1, $GUI_CHECKED) $decoyColorBox = GUICtrlCreateInput("AA0000", 288, 738, 121, 21) $decoyWidthBox = GUICtrlCreateInput("45", 456, 738, 121, 21) $decoyHeightBox = GUICtrlCreateInput("45", 624, 738, 121, 21) $startPause = GUICtrlCreateButton("Pause", (945 - 100) / 2, 768, 100, 25) GUICtrlCreateGroup("", -99, -99, 1, 1) $decoy = GUICtrlCreateButton("", -200, -200, 0, 0) GUISetState(@SW_SHOW) $button2 = GUICtrlCreateButton("Press to begin", (945 - 200) / 2, (641 - 200) / 2, 200, 200) GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlSetState(-1, $GUI_ONTOP) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE then _exit($clicks, $totalAverage, $generousAverage) If $msg = $button2 then GUICtrlDelete($button2) exitLoop EndIf WEnd GUICtrlSetState($colorBox, $GUI_DISABLE) GUICtrlSetState($widthBox, $GUI_DISABLE) GUICtrlSetState($heightBox, $GUI_DISABLE) GUICtrlSetState($delayBox, $GUI_DISABLE) GUICtrlSetState($decoyColorBox, $GUI_DISABLE) GUICtrlSetState($decoyWidthBox, $GUI_DISABLE) GUICtrlSetState($decoyHeightBox, $GUI_DISABLE) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE then _exit($clicks, $totalAverage, $generousAverage) If execute("0x" & GUICtrlRead($colorBox)) <> $color Then $color = execute("0x" & GUICtrlRead($colorBox)) EndIf If GUICtrlRead($widthBox) <> $width Then $width = GUICtrlRead($widthBox) If $width > 450 then $width = 450 GUICtrlSetData($widthBox, 450) EndIf EndIf If GUICtrlRead($heightBox) <> $height Then $height = GUICtrlRead($heightBox) If $height > 450 then $height = 450 GUICtrlSetData($heightBox, 450) EndIf EndIf If $msg = $startPause then startPause() For $i = 0 to random(0, GUICtrlRead($delayBox)) step 5 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then _exit($clicks, $totalAverage, $generousAverage) Next _generate(random(15, 929-($width+10)), random(15, 641-($height+10)), $width, $height) $timer = timerInit() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE then _exit($clicks, $totalAverage, $generousAverage) If $msg = $startPause then startPause() ExitLoop EndIf If $msg = $label Then $misses+=1 GUICtrlSetData($missesLabel, "Misses: " & $misses) EndIf If $msg = $button then _hit(timerDIff($timer), $lastTime, $bestTime, $bestTimeCount, $clicks, $totalAverage, $generousAverage) ExitLoop EndIf WEnd wEnd func _generate($x, $y, ByRef $_width, ByRef $_height) $button = GUICtrlCreateButton("", Int($x), Int($y), $_width, $_height) GUICtrlSetBkColor(-1, Execute("0x" & GUICtrlRead($colorBox))) GUICtrlSetState($button, $GUI_ONTOP) If GUICtrlRead($decoyCheckBox) == 1 Then $newX = random(15, 929-($width+10)) $newY = random(15, 641-($height+10)) While $newX + GUICtrlRead($decoyWidthBox) > $x and $newX < $x + $_width and $newY + GUICtrlRead($decoyHeightBox) > $y and $newY < $y + $_height $newX = random(15, 929-($width+10)) $newY = random(15, 641-($height+10)) WEnd GUICtrlSetBkColor($decoy, Execute("0x" & GUICtrlRead($decoyColorBox))) GUICtrlSetPos($decoy, $newX, $newY, GUICtrlRead($decoyWidthBox), GUICtrlRead($decoyHeightBox)) Else GUICtrlSetPos($decoy, -200, -200) EndIf endFunc func startPause() If GUICtrlRead($startPause) == "Pause" then GUICtrlSetState($colorBox, $GUI_ENABLE) GUICtrlSetState($widthBox, $GUI_ENABLE) GUICtrlSetState($heightBox, $GUI_ENABLE) GUICtrlSetState($delayBox, $GUI_ENABLE) GUICtrlSetState($decoyColorBox, $GUI_ENABLE) GUICtrlSetState($decoyWidthBox, $GUI_ENABLE) GUICtrlSetState($decoyHeightBox, $GUI_ENABLE) GUICtrlSetData($startPause, "Resume") While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE then _exit($clicks, $totalAverage, $generousAverage) If $msg = $startPause then GUICtrlSetData($startPause, "Pause") GUICtrlDelete($button) $timer = timerInit() GUICtrlSetState($colorBox, $GUI_DISABLE) GUICtrlSetState($widthBox, $GUI_DISABLE) GUICtrlSetState($heightBox, $GUI_DISABLE) GUICtrlSetState($delayBox, $GUI_DISABLE) GUICtrlSetState($decoyColorBox, $GUI_DISABLE) GUICtrlSetState($decoyWidthBox, $GUI_DISABLE) GUICtrlSetState($decoyHeightBox, $GUI_DISABLE) Return EndIf WEnd EndIf endFunc func _hit($_time, ByRef $_lastTime, ByRef $_bestTime, Byref $_bestTimeCount, ByRef $_clicks, ByRef $_totalAverage, ByRef $_generousAverage) $_time-=50 ; Accounts for lag from the point your mouse is pressed (actual reflex) to the point it is released (function triggered) GUICtrlSetData($_lastTime, "Last time: " & $_time & " mS") If $bestTimeCount == "" or $_time < $_bestTimeCount Then GUICtrlSetData($_bestTime, "Best time: " & $_time & " mS") $_bestTimeCount = $_time EndIf $_clicks+=1 $_totalAverage+=$_time If $_time < 5000 then $_generousAverage+=$_time EndIf GUICtrlDelete($button) endFunc func _exit($_clicks, $_totalAverage, $_generousAverage) If $clicks > 0 then local $date = @MON & "/" & @MDAY & "/" & @YEAR $_totalAverage/=$_clicks $_generousAverage/=$_clicks MsgBox(0, "Your scores are:", "Clicks: " & $_clicks & @CRLF & "Misses: " & $misses & @CRLF & "Average (mS): " & $_totalAverage & @CRLF & "Average excluding those over 5 seconds: " & $_generousAverage) If MsgBox(4, "Save your scores", "Save your scores to 'scores.txt'?") == 6 then FileWrite("scores.txt", "Clicks: " & $_clicks & @CRLF & "Misses: " & $misses & @CRLF & "Average (mS): " & $_totalAverage & @CRLF & "Average excluding those over 5 seconds: " & $_generousAverage & @CRLF & "----------Generated by the Magic Soft Inc. Reflex Tester on " & $date & "----------" & @CRLF) EndIf EndIf destruct() Exit endFunc func destruct() ; I'm sure this isn't helpful at all, but whatever GUIDelete($GUI) $bestTime = "" $_bestTime = "" $bestTimeCount = "" $_bestTimeCount = "" $button = "" $clicks = "" $_clicks = "" $color = "" $_color = "" $colorBox = "" $date = "" $delayBox = "" $generousAverage = "" $Group2 = "" $GUI = "" $height = "" $_height = "" $heightBox = "" $Label1 = "" $Label2 = "" $Label3 = "" $Label4 = "" $lastTime = "" $optionsGroup = "" $width = "" $_width = "" endFunc Heh, try it at 10x10 pixels. Quite challenging!
  13. Awesome script! I'm definitely going to use this!! Great work, guys!
  14. Once that happens, it's too late for what I'm trying to do. I need to get the size of the grey border BEFORE you let go of the mouse [Edit] Ah, I found a LazyCat script that I was able to modify to do it. Here's what I did: GUIRegisterMsg(0x0214, "moving") Func moving($hWnd, $Msg, $wParam, $lParam) Local $pos = DllStructCreate("uint;uint;int;int;int;int;uint", $lParam) $string = "" For $i = 0 to 6 $string&=$i & ": " & DllStructGetData($pos, $i) & @CRLF GUICtrlSetData($edit, $i, "append") Next GUICtrlSetData($edit, $string) EndFunc Now I just need to find out how to manipulate that size... Does anyone know how to do that? [Edit] Pssh, that was in LazyCat's script too. Thanks for you help LazyCat!
×
×
  • Create New...