Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 05:15

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Need A Bit Of Help With My Script

Discussion on Need A Bit Of Help With My Script within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jun 2010
Posts: 17
Received Thanks: 0
Question Need A Bit Of Help With My Script

i have this script for a bot that i am making... but in order to make it so that it "imitate" a 'click' other then useing "my mouse/keybord" i vas told to use this UDF...

but i cant seam to get it to work...

PHP Code:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <PostMessage.au3>
#Region ### START Koda GUI section ### Form=
HotKeySet("{ESC}","Terminate")
$Form1 GUICreate("RS FM Bot"22299192124)
$Label1 GUICtrlCreateLabel("RuneScape Firemaking Bot"48815017)
$Button1 GUICtrlCreateButton("Start"64408933$WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg 
GUIGetMsg()
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE
            
Exit

EndSwitch

If 
$nMsg $Button1 Then Button1()

WEnd



Func Button1
()
    
$hWnd WinGetHandle("RuneScape - The Number 1 Free Multiplayer Game - Mozilla Firefox")
    
Sleep(1000)
    
_PostMessage_Click($hWnd,1045,189,"Left")
    
Sleep(500)
    
_PostMessage_Send($hWnd,"{UP down}")
    
Sleep(2000)
    
_PostMessage_Send($hWnd,"{UP up}")
    
Sleep(500)
    
_PostMessage_Click($hWnd,992,186,"Left"
this is the start of the script but when i start it it dose nothing... any one can tell me what the problem is???

or if there is another way to do it...

(i would like it so i can have 2 bot's running at once or one bot + me playing/scripting...)

i have yet another question...

can anyone tell me how to get ik so when i type "10" in my GUI input it will run 10 loops and then stop?!? i have it so i can set it in the script manualy but it would be nice to get the GUI to work proberly...

and one last thing...

can i get the GUI to "count" aswell?!? so it shows me that it hase made "x" Loops?!?

Regards SSnipeRR
SSnipeRR is offline  
Old 02/25/2011, 18:47   #2
 
derpo's Avatar
 
elite*gold: 0
Join Date: Feb 2010
Posts: 344
Received Thanks: 151
You need an end of the Function Button1 (EndFunc) and you need the Function Terminate.
Here's the code fixed :
PHP Code:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <PostMessage.au3>
HotKeySet("{ESC}","Terminate")
$Form1 GUICreate("RS FM Bot"22299192124)
$Label1 GUICtrlCreateLabel("RuneScape Firemaking Bot"48015017)
$Loops GUICtrlCreateInput("",60,17,93,23)
$Button1 GUICtrlCreateButton("Start"64408933$WS_GROUP)
$txtloop GUICtrlCreateLabel("Loop : ",0,83,222,17)
GUISetState(@SW_SHOW)

While 
1
    $nMsg 
GUIGetMsg()
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE
            
Exit

    EndSwitch

    If 
$nMsg $Button1 Then
        
If GUICtrlRead($LoopsThen
            $loopnumber 
GUICtrlRead($Loops)
            
$hWnd WinGetHandle("RuneScape - The Number 1 Free Multiplayer Game - Mozilla Firefox")
            For 
$i 0 To $loopnumber Step 1
                GUICtrlSetData
($txtloop,"Loop : "&$i)
                
Sleep(1000)
                
_PostMessage_Click($hWnd,1045,189,"Left")
                
Sleep(500)
                
_PostMessage_Send($hWnd,"{UP down}")
                
Sleep(2000)
                
_PostMessage_Send($hWnd,"{UP up}")
                
Sleep(500)
                
_PostMessage_Click($hWnd,992,186,"Left")
            
Next
            GUICtrlSetData
($txtloop,"Loop : ")
        Else
            
MsgBox(0,"Bot","You have to enter a number of loops!")
        EndIf
    EndIf

WEnd

Func Terminate
()
    Exit
EndFunc 
derpo is offline  
Old 02/25/2011, 20:06   #3
 
elite*gold: 0
Join Date: Jun 2010
Posts: 17
Received Thanks: 0
oki thanks... i will try this and see if this will help...

(tho it was only a plug uot from the script so EndFunc is lower down just did not post it cus the full script is a bit long... :S but the normal
PHP Code:
MouseClick() 
vorks fine in the script just the "imitatet" mouseclick's dont...


Edit:

i have tryed the script you fixed... same problem... nothing... it counts the loops tho... thanks...

but it dosent eaven fix on the window...
SSnipeRR is offline  
Old 02/25/2011, 21:09   #4
 
derpo's Avatar
 
elite*gold: 0
Join Date: Feb 2010
Posts: 344
Received Thanks: 151
If you have problems with _PostMessage_Click too, you have to change Left to left
You don't need down and up. The third parameter for the UDF is the Delay between Down and Up in ms.
Example :
Instead of
PHP Code:
_PostMessage_Send($HWnd,{UP down})
Sleep(1000)
_PostMessage_Send($HWnd,{UP up}) 
,just use
PHP Code:
_PostMessage_Send($HWnd,{UP},1000
derpo is offline  
Old 02/25/2011, 21:41   #5
 
elite*gold: 0
Join Date: Jun 2010
Posts: 17
Received Thanks: 0
sry about the duple post... :S

well the problem is all of it...
PHP Code:
Func Button1()
    
$hWnd WinGetHandle("RuneScape - The Number 1 Free Multiplayer Game - Mozilla Firefox")  ;This Should aktivate the windowit dosent. :/
    
Sleep(1000)
    
_PostMessage_Click($hWnd,1045,189,"Left") ; this should click at the certen coordinatesit dosent do anything...
    
Sleep(500)
    
_PostMessage_Send($hWnd,"{UP down}")
    
Sleep(2000)
    
_PostMessage_Send($hWnd,"{UP up}")
    
Sleep(500)
    
_PostMessage_Click($hWnd,992,186,"Left"
oki i'll try make "Left" to "left" and see if that has any efeckt...

but it still need to aktivate the window... :/

thanks for the example...
SSnipeRR is offline  
Reply


Similar Threads Similar Threads
L2Walker script: Solo rebuff/restock/return script
08/08/2012 - Lin2 Exploits, Hacks, Bots, Tools & Macros - 63 Replies
Hello! I've been reading alot and not really contributing so i'll start off here with a very well working script im using to bot my SK outside ivory tower in oren. I've tried to structure the code so it easily can be modified for another level of character, town, and hunting spot. The script is made for CT2 Retail, mainly to get advantage of the newbie buffs (which now lasts all the way until level 62) Change log: Update 2008-09-01 Version 1.14 -Download
[suche] d2nt level rush script 1-25 / follow script
06/23/2010 - Diablo 2 Programming - 5 Replies
moin erstmal sry falls es da doch schon was passendes zu gab - hab schonmal gesucht aber nur alte sachen gefunden oder eben antworten in richtung "geht so schnell dafür braucht man keinen bot" ^^ mein problem besteht darin dass ich für lvl 1 bis 20 immer x stunden brauche - trist geht ja noch halberwegs aber mit tombruns such ich mich immer dusselig ^^ - bzw cows sind noch schlimmer (dafür geht das cow-script für d2nt ausm bluebird zumindest halberwegs) die frage ist jetz die - giebt...



All times are GMT +2. The time now is 05:15.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.