Jump to content

First $y Returns Neg. Number


Recommended Posts

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 Site-Seeing:My Website: - Click Here

Link to comment
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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...