Jump to content
Sign in to follow this  
qwertylol

function calls

Recommended Posts

qwertylol

Dim $degree = radar_angle()

MsgBox ( 0, "title", $degree )


Func radar_angle()
    $live_center_x = 394
    $live_center_y = 316
    $there_are_this_number_of_points_on_radar = IniRead ( "radar_loc.ini", "n", "there_are_this_number_of_points_on_radar", "default" )
    
    MsgBox ( 0, "title", $there_are_this_number_of_points_on_radar )
    
    Local $loop = 1

    Local $color
    
    Do
        
        $record_x = IniRead ( "radar_loc.ini", "radar_x_offset", 'point_' & $loop, "default" )
        $record_y = IniRead ( "radar_loc.ini", "radar_y_offset", 'point_' & $loop, "default" )
        $color = PixelGetColor ( ( 394 + $record_x ), ( 316 + $record_y ) )
        MsgBox ( 0, "title", $loop )
        MsgBox ( 0, "title", $color)
        MouseMove ( ( 394 + $record_x ), ( 316 + $record_y ) )
        ; return the color under the mouse cursor.
        ;MsgBox ( 0, "title", $color )
        parse_color($color)                     ;send the color to be processed.
        

        $loop = $loop + 1
    Until $loop ==  ( $there_are_this_number_of_points_on_radar + 1 )

    

    MsgBox ( 0, "radar_angle", "no color of the arrow is found on radar" )
    
EndFunc



Func parse_color($color)
    
    $loop = 1
    Local $number_of_colors_on_record = IniRead ( "color.ini", "0", "number_of_colors_on_record", "default" )    ;it needs to know
                                                                                                           ;how many loops to go.
    
    
    If $number_of_colors_on_record = "0" Then
        MsgBox ( 0, "title", "zero" )
        IniWrite ( "color.ini", 1, 'color_' & $loop  , $color )
        IniWrite ( "color.ini", 0, "number_of_colors_on_record", 1 )
        Return
        EndIf            ;this if block simply  writes the color sent to the ini file as the first entry and return this function.
    
    Do                  
        $color_on_record = IniRead ( "color.ini", "1", 'color_' & $loop  , "default" )
        If $color = $color_on_record Then
            Return
            EndIf                                                               ;it will check all of the entries to see
        $loop = $loop + 1                                                       ;if the colors are known. if it is, return
        Until $loop = ( $number_of_colors_on_record ) + 1

    ;$color is a new color!
    IniWrite ( "color.ini", 1, 'color_' & ($loop+1)  , $color )                                  ;for this function to come here
    IniWrite ( "color.ini", 0, "number_of_colors_on_record", ( $number_of_colors_on_record+1 ) ) ; that means it's not found on the record
                                                                                                ; and so it's added, and return.
    Return
    
    EndFunc

for some reason it won't go to parse_color function.

Share this post


Link to post
Share on other sites
qwertylol

never mind , i got the bug.

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  

×