Jump to content

If problem.


Recommended Posts

Alright so, i started making this bot for a game called MTA. its just a simple bot, but what im trying to do is make it so autoit will switch from whatever im doing at the time, to mta, run the little bot, then switch back to what im doing, now i have that done. Except i also want it so if im watching a movie in windows media player,to switch to that and make it full screen again.

I"m an alright programmer I just dont know autoit code so feel free to use advanced terms ill understand you. Here is my code so far (Its just thrown together then ive been adding on to it if i find osmething to add)

;Option 1
while 1
$window1 = WinGetTitle("")
blockinput (1)
WinActivate("MTA: San Andreas","")
Send("{w down}")
Sleep(600)
Send("{w up}")
Sleep(50)
Send("{d down}")
Sleep(600)
Send("{d up}")
Sleep(50)
Send("{s down}")
Sleep(600)
Send("{s up}")
Sleep(50)
Send("{a down}")
Sleep(600)
Send("{a up}")
Sleep(200)
MouseClick("left",550,340,1)
Sleep(100)
MouseClick("left",581,474,1)
Sleep(100)
WinSetState ( "MTA: San Andreas", "", @SW_MINIMIZE)
WinActivate($window1,"")
if $window1 = "Windows Media Player" then
MouseClick("left",581,474,1)
MouseClick("left",581,474,1)
Else    
EndIf
blockinput (0)
Sleep(125000)
$window2 = WinGetTitle("")
;Option 2
blockinput (1)
WinActivate("MTA: San Andreas","")
Send("{w down}")
Sleep(600)
Send("{w up}")
Sleep(50)
Send("{d down}")
Sleep(600)
Send("{d up}")
Sleep(50)
Send("{s down}")
Sleep(600)
Send("{s up}")
Sleep(50)
Send("{a down}")
Sleep(600)
Send("{a up}")
Sleep(200)
MouseClick("left",549,366,1)
Sleep(100)
MouseClick("left",581,474,1)
Sleep(100)
WinSetState ( "MTA: San Andreas", "", @SW_MINIMIZE)
WinActivate($window2,"")
if $window2 = "Windows Media Player" then
MouseClick("left",581,474,1)
MouseClick("left",581,474,1)
Else    
EndIf
blockinput (0)
Sleep(125000)
wend

What the bot does is move my character in a circle then selects an option then goes back to w/e. But it switches between 2 options each time (if i could shorten this code with if statements it would be awesome)

But yeah basically my problem is making the if statement work. cause it appears as though it doesnt even pick up the window1/2 variables as windows media player.

thanks alot,

~wodahskcin

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...