Jump to content

Looking for tips to optimize my first script


Guest Oida
 Share

Recommended Posts

; AutoIt Version: 3.0 
; Language:       English 
; Platform:       WinXP 
; Author:         Aroreapousuizteorthrepr133711 

$on = 0

; Prompt the user to run the script using Yes/No prompt 
$run = MsgBox(4, "rBot Beta 1", "Do you want to run rBot?") 


; Exit if "No" 
If $run = 7 Then 
    Exit 
EndIf 

; Initial shit 
$time = MsgBox(4, "SO - Merc?", "Yes = SO | No = Merc") 
HotKeySet("{PAUSE}", "EndScript") 
HotKeySet("{LEFT}", "setmerc") 
HotKeySet("{RIGHT}", "setso")
HotKeySet("{UP}", "turnon") 
HotKeySet("{DOWN}", "turnoff") 

; Script Start 
While 1 

  $start = TimerInit() 
  $dif = TimerDiff($start) 

If $on = 1 Then

  While 1 
    If $time = 6 Then 
      $coord = PixelSearch (506, 410, 512, 420, 0xAB3131, 30, 3)
    Else 
      $coord = PixelSearch (506, 410, 512, 420, 0x364190, 30, 3)
    EndIf 

; 5, 300 - 1024, 560 can be changed if you want to search a wider area. 
; Not recommended though since you can just adjust your view to fit all 
; the water in that space. The bigger the area, the less likely it is to 
; detect it. 
; If the splash isn't getting detected then change the hex colour to 
; something a bit closer. Top one is day, bottom is night. 

    If UBound($coord)>1 Then     
;      MouseMove(512, 384) 
      MouseClick("left") 
      ExitLoop 
    EndIf
  WEnd 

EndIf

WEnd 
 
  
; Function to exit script 
Func turnon() 
    $on = 1
EndFunc

; Function to exit script 
Func turnoff() 
    $on = 0
EndFunc

; Function to exit script 
Func setso() 
    $time = 6
EndFunc

; Function to exit script 
Func setmerc() 
    $time = 1
EndFunc

; Function to exit script 
Func EndScript() 
    Exit 
EndFunc

The script is working fine but my fps in games drop down to 10, even if i set $on to 0 which deactivates the script. I absolutely have no idea why it's doing this. :idiot:

Link to comment
Share on other sites

  • Developers

The script is working fine but my fps in games drop down to 10, even if i set $on to 0 which deactivates the script. I absolutely have no idea why it's doing this.  :idiot:

<{POST_SNAPBACK}>

Add a Sleep(10) before both wend statement and see if that helps...

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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...