Jump to content

New to Coding need help please


Loraik
 Share

Recommended Posts

I am trying to modify a script that I use to also log my char. out in a game I play when anyone of 3 spots equal a certain color however I am comming up short. I am very very new to coding but am trying to do this. Anyone tell me what I am doing wrong?

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;; Check Resource 1-3;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

$colorBehindEvents = --------; if this color is seen in any one of 3 locations then
; start camp sequence

Func ResourceCheckingProcedure()
$Resource1x = ---
$Resource1y = ---
$Resource2x = ---
$Resource2y = ---
$Resource3x = ---
$Resource3y = ---
    
    $ResourceCheck1 = PixelGetColor($Resource1x, $Resource1y)
    $ResourceCheck2 = PixelGetColor($Resource2x, $Resource2y)
    $ResourceCheck3 = PixelGetColor($Resource3x, $Resource3y)
        MsgBox(64,"Resource Listings", "Pixel color at location for resource 1" & @CRLF & "Pixel Colour for resource 1: " & $ResourceCheck1 & " x:" & $Resource1x & " y:" & $Resource1y _
                   & @CRLF & "Pixel color at location for resource 2" & @CRLF & "Pixel Colour for resource 2: " & $ResourceCheck2 & " x:" & $Resource2x & " y:" & $Resource2y _
                   & @CRLF & "Pixel color at location for resource 3" & @CRLF & "Pixel Colour for resource 3: " & $ResourceCheck3 & " x:" & $Resource3x & " y:" & $Resource3y)
EndFunc     

Func CheckIfEventColorsIsDefault() 
   If ($ResourceCheck1= $colorBehindEvents) OR ($ResourceCheck2= $colorBehindEvents) OR ($ResourceCheck3= $colorBehindEvents) Then 
      MsgBox(3, "Out of Resources", "You have 60 sec. to press ABORT or you will camp to the Character Selection Screen" [, 60000]) 
    If 3 Then Exit(0) Else
        Send("{enter}");Press enter on keyboard
        Send("/camp")  ;Camps Character 
        Send("{enter}");Press enter on keyboard

Here is what I am trying to do.

Read in the color of each resource (3 spots they are shown on screen). When the resource equals the color of "$colorBehindEvents" then it will bring up a window that will basicly say "Press the button to stay playing" and then will basicly allow you to keep playing OR if nothing is is done in 60 seconds then it will type "/camp" and you're character is camped out of game.

If there is anyone out there that can help me get this to work I would greatly appreciate it.

Loraik

Link to comment
Share on other sites

Is this what you wanted?

Func CheckIfEventColorsIsDefault()
    If ($ResourceCheck1 = $colorBehindEvents) OR ($ResourceCheck2 = $colorBehindEvents) OR ($ResourceCheck3 = $colorBehindEvents) Then
        $result = MsgBox(1, "Out of Resources", "You have 60 sec. to press ABORT or you will camp to the Character Selection Screen", 60)
        If $result = 3 Then
            Exit(0)
        Else
            Send("{enter}");Press enter on keyboard
            Send("/camp");Camps Character
            Send("{enter}");Press enter on keyboard
        EndIf
    EndIf
EndFunc

BTW: You really should shorten your variable and function names :lmao:

Edited by ZeDMIN
Link to comment
Share on other sites

AHHHHHH thanks Zed... I didn't quite understand how to properly format that. I had been researching through others finished scripts but wasn't able to understand the exact method of the madness.

Also you say shorten the variable function names. Can you explain why please? I am still learning.

OH and is there any AutoIT for Dummy's books? Since I started messing with AutoIT I am finding it is quite fun to work with but I would like to see something with working examples and explanations to how/what/why. I have gone thru the doc's onsite but for a novice (newbie) learner IMO they are not real friendly.

Thanks again.

Loraik

Link to comment
Share on other sites

Also you say shorten the variable function names.  Can you explain why please?  I am still learning.

<{POST_SNAPBACK}>

Just because i think some lines get unreadable if there are several variables with very long names. And its faster to write. And because i'm lazy. :lmao:
Link to comment
Share on other sites

Quick question. If I wanted the script to then close after the camping procedure would I add this:

WinClose("Name of running script here")

right under:

Send("{enter}");Press enter on keyboard

so it looks like:

Send("{enter}");Press enter on keyboard
            Send("/camp");Camps Character
            Send("{enter}");Press enter on keyboard
                 WinClose("Name of running script here")
        EndIf
    EndIf
EndFunc

Just want to make sure I am understanding the format correct.

Loraik

Edited by Loraik
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...