Sign in to follow this  
Followers 0
techguy86

First $y Returns Neg. Number

3 posts in this topic

Func Find()
GUICtrlSetData($input4,"")
GUICtrlSetData($input5,"")
For $x = 0 to 39
If Mod ( $x, 4 ) <> Mod ( GUICtrlRead($input6), 4 ) Then ContinueLoop
$input4current = GUICtrlRead($input4)
GUICtrlSetData($input4,$input4current & " " & $x)
$modx = Mod ( $x, 4 )
;MsgBox(0,"GUI Event", $modx)
Select
   Case $modx = 2 OR 3
$y = $x - 2
   Case $modx = 0 OR 1
$y = $x + 2
EndSelect
MsgBox(0,"GUI Event", $y)
         $input5current = GUICtrlRead($input5)
         GUICtrlSetData($input5,$input5current & " " & $y)
Next
EndFunc

"0" mod 4 = "0"

Thus $y should = $x + 2, but alas...

When $input6 is "0", $input4 = 0 4 8 12 16 20 24 28 32 36, $input5 = -2 2 6 10 14 18 22 26 30 34

I don't that first neg. 2, what am I doing wrong? Thanks.


My Programs:Dissolve (Updated 5-30-06)Credit Card Validator (Not created as of yet)Master Lock Combination Cracker (Updated 7-08-07)Go Siteseeing:My Website: - Click HereCyberZeroCool's Website - Click Here

Share this post


Link to post
Share on other sites



Func Find()
GUICtrlSetData($input4,"")
GUICtrlSetData($input5,"")
For $x = 0 to 39
If Mod ( $x, 4 ) <> Mod ( GUICtrlRead($input6), 4 ) Then ContinueLoop
$input4current = GUICtrlRead($input4)
GUICtrlSetData($input4,$input4current & " " & $x)
$modx = Mod ( $x, 4 )
;MsgBox(0,"GUI Event", $modx)
Select
   Case $modx = 2 OR 3
$y = $x - 2
   Case $modx = 0 OR 1
$y = $x + 2
EndSelect
MsgBox(0,"GUI Event", $y)
         $input5current = GUICtrlRead($input5)
         GUICtrlSetData($input5,$input5current & " " & $y)
Next
EndFunc

"0" mod 4 = "0"

Thus $y should = $x + 2, but alas...

When $input6 is "0", $input4 = 0 4 8 12 16 20 24 28 32 36, $input5 = -2 2 6 10 14 18 22 26 30 34

I don't that first neg. 2, what am I doing wrong? Thanks.

I had to strip out the distractions to see it and came up with:

; Test Mod() function
$input6 = InputBox("Mod() Test", "Enter value for $input6:", "0")
Find()

Func Find()
    For $x = 0 To 39
        If Mod($x, 4) <> Mod($input6, 4) Then ContinueLoop
        $modx = Mod($x, 4)
        MsgBox(64, "Debug", "$x = " & $x & @CRLF & _
                "Mod($x, 4) = $modx = " & $modx)
        Select
            Case $modx = 2 Or $modx = 3
                $y = $x - 2
            Case $modx = 0 Or $modx = 1
                $y = $x + 2
        EndSelect
        MsgBox(0, "GUI Event", "$y = " & $y)
    Next
EndFunc  ;==>Find

Your problem was the OR part of the CASE statements.

Hope that helps... :think:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Beautiful. Thank you. It was just what I was looking for. Now onto bigger projects...


My Programs:Dissolve (Updated 5-30-06)Credit Card Validator (Not created as of yet)Master Lock Combination Cracker (Updated 7-08-07)Go Siteseeing:My Website: - Click HereCyberZeroCool's Website - Click Here

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0