Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 00:08

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

Advertisement



My [AutoIt]-Pinball_Bot

Discussion on My [AutoIt]-Pinball_Bot within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
DrDreo's Avatar
 
elite*gold: 0
Join Date: Mar 2010
Posts: 343
Received Thanks: 48
Lightbulb My [AutoIt]-Pinball_Bot

Hier Download-Link--->

Hät gerne Verbesserungsvorschläge, ist mein 1.Bot!
Bezüglich dem Code und der Funktion.

Oder die die mir nicht vertrauen ^^ :

PHP Code:
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#include <misc.au3>


Opt("PixelCoordMode"0)
Opt("OnExitFunc""onexit")
HotKeySet ("e""End"
GUICreate("Pinball-BoT"264175)
GUICtrlCreateLabel("Press START BOT to start Pinball-BoT Press e to End Bot"304020050)
$Button1 GUICtrlCreateButton("Start Bot"1501208925)
GUISetState(@SW_SHOW
$Button2 GUICtrlCreateButton("End Bot" ,301208925)
GUISetState(@SW_SHOW

Opt("SendKeyDelay"50)
Opt("SendKeyDownDelay"100

While 
1
$nMsg 
GUIGetMsg()
Switch 
$nMsg
Case $GUI_EVENT_CLOSE
Exit
Case 
$Button1
Run 
("C:\Programme\Windows NT\Pinball\pinball.exe")
Sleep(5000)
Send("{Space down}")
sleep(1000)
Send("{Space up}")
While 
1
PixelSearch
(1494171804850xB4B4BC)
If 
Not @error Then
Send
("{Y down}")
Sleep(100)
Send("{Y up}")
EndIf
PixelSearch(1834172084850xB4B4BC)
If 
Not @error Then
Send
("{M down}")
Sleep(500)
Send("{M up}")
EndIf
PixelSearch(3204143394300xB4B4BC)
If 
Not @error Then
Sleep
(2000)
Send("{Space Down}")
Sleep(1000)
Send("{Space Up}")
EndIf
Func End()
send("!{F4}")
Exit
EndFunc 
WEnd
Case $Button2
Exit
EndSwitch
WEnd 
Exit 
DrDreo is offline  
Old 10/06/2010, 17:11   #2

 
S7ZY's Avatar
 
elite*gold: 58
Join Date: Feb 2009
Posts: 5,715
Received Thanks: 3,058
braucht man da wirklich
Code:
Send("{M down}")
?
normale weise braucht man doch nur
Code:
Send("M")
oder nicht?
klär mich auf wenn ich falsch bin

€dit: bot funkt nicht+die funktion Bot end funktioniert auch nicht, da immer noch script aktiv bleibt.
S7ZY is offline  
Old 10/06/2010, 17:42   #3
 
DrDreo's Avatar
 
elite*gold: 0
Join Date: Mar 2010
Posts: 343
Received Thanks: 48
ja ich weiß aber wenn ich die Taste eine halbe Sekunde drücke dann geht der Schuss etwas genauer, kommt mir so vor

Ich Weis deshalb hab ich Hotkey "e"... wärend Pinball läuft!

Ich habs versucht und ein Freund sagte, dass es theoretisch funktionieren sollte, wenn man auf den Button2 drückt--> Exit

Aber ich weiß nicht wie ich den Bot sonst Enden soll!

Wie meinst Bot funkt nicht?!
DrDreo is offline  
Old 10/06/2010, 18:56   #4
 
lolkop's Avatar
 
elite*gold: 280
Join Date: May 2007
Posts: 2,818
Received Thanks: 3,483
da du nach verbesserungs vorschlägen fragtest, hier mal ein par tips:

Code:
GUICreate("Pinball-BoT", 264, 175)
GUICtrlCreateLabel("Press START BOT to start Pinball-BoT Press e to End Bot", 30, 40, 200, 50)
$Button1 = GUICtrlCreateButton("Start Bot", 150, 120, 89, 25)
GUISetState(@SW_SHOW) <--- unnötig
$Button2 = GUICtrlCreateButton("End Bot" ,30, 120, 89, 25)
GUISetState(@SW_SHOW) <--- einmal state setzen reicht doch vollkommen
Code:
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ButtonConstants.au3>
#include <misc.au3>
keines dieser includes wird von dir genutzt. also wozu etwas ins script packen, was nicht gebraucht wird?
Code:
While 1
        [...]
        While 1
             [...]  
             Endlosschleife in Endlosschleife = ganz schlechte idee.
             Diese Schleife setzt alles andere in deinem script ausser funktion.
        WEnd
	[...]
WEnd
desweiteren solltest du noch alle sleep befehle durch timer ersetzen. jeder sleep befehl blockiert dein script.

und wie bereits erwähnt wurde, kannst du das "down" bzw "up" beim send weglassen. das spiel erkennt das übrigens sowieso nicht. beide formen werden als normales send anerkannt.
Code:
Send("{Y down}")
Sleep(100)
Send("{Y up}")
wird von pinball so interpretiert:
Code:
Send("Y")
Sleep(100)
Send("Y")
das liegt darann das autoit automatisch send befehle abschließt, sobald ein anderer befehl dezwischen liegt.

zuletzt bleibt noch zu sagen, dass funktions definitionen immer deutlich abgetrennt vom restlichen code liegen sollten. und noch wichtiger ist, dass sie niemals in schleifen liegen
Code:
While 1
        [...]
        Func End()
            send("!{F4}")
            Exit
        EndFunc
	[...]
WEnd
ist ein absolutes nogo.
bei jedem schleifendurchlauf wird eine neue funktion mit dem selben name definiert, die wieder einen neuen speicherbereich einnimmt.
lolkop is offline  
Reply

Tags
autoit, pinball bot




All times are GMT +2. The time now is 00:08.


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.