Sign in to follow this  
Followers 0
will88

{w down} getting ignored in my script?

20 posts in this topic

#1 ·  Posted (edited)

Hello again, I'm fairly new to autoit scripting and Im having a problem with my autoit script.

HotKeySet("{F1}", "Start")
HotKeySet("{F2}", "Stop")
Global $Loop = 0

$InI = 'abc123.ini'

Global $deathini = IniRead(@ScriptDir & "\" & $InI, "Options", "Death", "NotFound")
$armorini = IniRead(@ScriptDir & "\" & $InI, "Options", "Armor", "NotFound")
$Cast = IniRead(@ScriptDir & "\" & $InI, "Options", "Cast", "NotFound")
$buffkey = $armorini
$WoW = 'World of Warcraft'
$notset = ''
$logout = 'logout'
$shutdownn = 'shutdown'
$quit = 'quit'
$attack = 't'
$findmob = '{tab}'
$mobtargeted = '0x605F00'
$health = '0x008900'
$mana = '0x000093'
$armor = '0x007BEC'
$dead = '0x710000'

$chat = '0xDC73CD' 
$msg = 'brb' 
$msg2 = 'oops mistell sorry'
$death = '/exit'
;
If FileExists(@ScriptDir & "\" & $InI) Then
Sleep(Random(400, 550))
Else
MsgBox(0, "Error", $InI & " does not exist!")
EndIf
If $deathini == $notset Then
$deathini = False
Else
$deathini = True
EndIf
If $armorini == $notset Then
$armorini = False
Else
$armorini = True
EndIf
If $armorini = False And $deathini = False Then
MsgBox(0, $InI, "Armor and Death options need to be setup in the .ini file")
EndIf
If $armorini = True And $deathini = False Then
MsgBox(0, $InI, "Death options need to be setup in the .ini file")
EndIf
If $armorini = False And $deathini = True Then
MsgBox(0, $InI, "Armor key needs to be setup in the .ini file")
EndIf
If $Cast == $notset Then
MsgBox(0, "Error", "Cast not set")
EndIf










While 1
If $Loop = 1 Then
$whsp = PixelSearch(34, 558, 135, 673, $chat)
If Not @error Then
Sleep(500)
Send('r')
Sleep(500)
Send($msg)
Send('{enter}')
Sleep(500)
Send('r')
Sleep(500)
Send($msg2)
Send('{enter}')
Sleep(500)
Send('{enter}')
Sleep(500)
Send('/exit')
Sleep(500)
Send('{enter}')
Sleep(500)
Exit
Else
Sleep(random(10, 15))
EndIf   
    
    
$deathdetect = PixelSearch(451, 180, 570, 192, $dead)
If Not @error Then
died($deathini)
EndIf
$buff = PixelSearch(815, 32, 842, 59, $armor)
If Not @error Then
Sleep(Random(700, 1000))
Else
Send($buffkey)
Sleep(Random(600, 900))
EndIf
PixelSearch(90, 71, 127, 81, $mana)
If Not @error Then
Else
Sleep(Random(9000, 10000))
EndIf
PixelSearch(90, 64, 127, 71, $health)
If Not @error Then
Else
Sleep(Random(9000, 10500))
EndIf
Send($findmob)
Sleep(Random(500, 700))
PixelSearch(260, 48, 290, 59, $mobtargeted)
If Not @error Then
Send($attack)
Sleep(Random(300, 600))
Send($Cast)
Sleep(Random(10000, 15000))
Do
$mobalive = PixelSearch(260, 48, 290, 59, $mobtargeted)
Sleep(Random(500, 700))
If @error Then
dead()
Else
alive()
EndIf
Until Not IsArray($mobalive)
EndIf
If $Loop = 1 Then
Sleep(1000)
Else
ExitLoop
EndIf
EndIf
WEnd
Func Start()
$Loop = 1
EndFunc;==>Start
Func Stop()
$Loop = 0
EndFunc;==>Stop
Func died($deathini)
If $deathini = $logout Then logout()
If $deathini = $shutdownn Then shutdownn()
If $deathini = $quit Then Quit()
EndFunc;==>died
Func logout()
Sleep(Random(800, 1000))
Send('{enter}')
Sleep(Random(800, 1000))
Send('/logout')
Sleep(Random(800, 1000))
Send('{enter}')

Exit
EndFunc;==>logout
Func shutdownn()
Shutdown(9)
EndFunc;==>shutdownn
Func Quit()
Exit
WinClose($WoW)
EndFunc;==>Quit
Func alive()
Send($Cast)
Sleep(Random(3000, 5000))
EndFunc;==>alive
Func dead()
Send("{w down}")
Send("{d down}")
Sleep(Random(500, 1500))
Send("{d up}")
Send("{w up}")
$Loop = 1
EndFunc;==>dead

What it basically does now is, Checks a bunch of colors if they don't exist then does what it says.

heres where the problem is for me,

$mobalive = PixelSearch(260, 48, 290, 59, $mobtargeted)
Sleep(Random(500, 700))
If @error Then
dead()
Else
alive()
EndIf
Until Not IsArray($mobalive)

if it finds the color then it goes to alive() function and that works properly, else it goes to dead() function

but when it goes to the dead() function it seems to skip

Send("{w down}")
Send("{d down}")
Sleep(Random(500, 1500))
Send("{d up}")
Send("{w up}")

and just go to

$loop = 1

what do I need to change to make it not ignore the send commands?

Edited by will88

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

WinActivate("[CLASS:Notepad]")
Send("{a down}")
Sleep(2000)
Send("{a up}")

If you run that, you'll see that even with {a down} it still only sends one key. Not sure why it does this, but regardless I would try to put your send commands in a loop.

I might try using a TimerInit and TimerDiff for something like:

$time = TimerInit()
$rnd = Random(500, 1500)

Do
    Send("{w down}")
    Send("{d down}")
    $tDif = TimerDiff($time)
Until $tDif > $rnd

Send("{d up}")
Send("{w up}")
Edited by JFee

Regards,Josh

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Not sure why it does this

your trying to send one key while another is still holded before you relise it?

:P

WinActivate("[CLASS:Notepad]")
Send("{w down}") ;<== start holding the key W
Sleep(Random(500, 1500)) ;<==sleep some time
Send("{w up}") ;<== stop holding the key W

Send("{d down}");<== start holding the key D
Sleep(Random(500, 1500)) ;<==sleep some time
Send("{d up}");<== stop holding the key D

Opt("SendKeyDownDelay", 1000) ;<== 1= 1 millisecond   1000 = 1 sec
Send("{g}")
Opt("SendKeyDownDelay", 5) ;<== return to normal

Opt("SendKeyDelay", 1000) 
Send("{f}")
Opt("SendKeyDelay", 5) ;<== return to normal

Opt("SendKeyDelay", 1000) 
Send("{f 5}");<== send If 5 times on every second
Opt("SendKeyDelay", 5) 

Opt("SendKeyDownDelay", 1000) ;<== 1= 1 millisecond   1000 = 1 sec
Send("{g 5}");<== send If 5 times holding the button 1 second
Opt("SendKeyDownDelay", 5) ;<== return to normal

send it more then once

Send("{g 5}");<==
and canculate Opt("SendKeyDelay", 5) or Opt("SendKeyDelay", 5) to see how many times you need to send one key to fit your time

or relise first key before you put another key to send

its all almost the same, its your choise

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

I'm not.... look at my notepad code

WinActivate("[CLASS:Notepad]")
Send("{a down}")
Sleep(2000)
Send("{a up}")

It isn't actually being held down.


Regards,Josh

Share this post


Link to post
Share on other sites

I'm not.... look at my notepad code

WinActivate("[CLASS:Notepad]")
Send("{a down}")
Sleep(2000)
Send("{a up}")

It isn't actually being held down.

It is being "held" down, it just doesn't work like when you hold down a key on the keyboard does. I'm not sure how to make it work like you want, except doing Send("{a 5}") or similar...

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Alright, I don't really care. Bet the OP does though :P Although my TimerDiff idea works

Although I am very curious about the behavior difference. The help file says it is mostly use in games... does this mean that it will act as if you hold down W in a game?

Edited by JFee

Regards,Josh

Share this post


Link to post
Share on other sites

it's still not working ive tried using

send('{w 6}')
sleep(random(500, 1000))
send('{d 6}')
sleep(random(500, 1000))

aswell as

$time = TimerInit()
$rnd = Random(500, 1500)

Do
    Send("{w down}")
    Send("{d down}")
    $tDif = TimerDiff($time)
Until $tDif > $rnd

Send("{d up}")
Send("{w up}")

after the color doesen't exist its still not sending w, d or holding w or d.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

First things first....

what game are you trying to hack?

does it have an "anti-cheat" program running?

Many of the Korean MMO's (example: Fiesta Online) discourage use of "hook" type programs like AutoIt by preventing the use of them, and/or detecting them rather easily.

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

this script is for WoW

Edited by will88

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

WoW did recently change its code to screw with the spambots... you may have to look into your options and tweak with the "Sendkeydowndelay" for it to work properly. I had to tweak with my mouse options for it to start registering the clicks properly.

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

I am not into scripting for any game but just a general remark:

Doing {w down} isn't the same as physically pressing the w key which activated the key repeat function.


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

WoW did recently change its code to screw with the spambots... you may have to look into your options and tweak with the "Sendkeydowndelay" for it to work properly. I had to tweak with my mouse options for it to start registering the clicks properly.

I just put

Sleep(4000)
Send("{w down}")
Send("{d down}")
Sleep(random(500, 1000))
Send("{w up}")
Send("{d up}")

into a script, and tested it. It worked 100% as it should

Share this post


Link to post
Share on other sites

Run("Notepad.exe")
WinWait("Untitled - Notepad")
WinActivate("Untitled - Notepad")
$timer = TimerInit()
While TimerDiff($timer) < 20 * 1000
    Send("{w down}")
WEnd

Works fine for me, I get a screen full of the letter "w" after 20 seconds.


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

Well...it's just a proof of concept. I don't have access to my WoW account on my work computer.


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

all im trying to do is hold d key and w key down for random 500-1000 miliseconds.

but in my script this does not work for some reason and just ignores, goes to $loop = 1

Edited by will88

Share this post


Link to post
Share on other sites

Well...it's just a proof of concept. I don't have access to my WoW account on my work computer.

Understood.... It was a way of saying how ignorant I am on this subject... nothing else :P

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

its for world of warcraft

all im trying to do is hold d key and w key down for random 500-1000 miliseconds.

but in my script this does not work for some reason and just ignores, goes to $loop = 1

The loop method would be better then, since sleep will halt script processing.

Run("Notepad.exe")
WinWait("Untitled - Notepad")
WinActivate("Untitled - Notepad")
$timer = TimerInit()
While TimerDiff($timer) < Random(500, 1000, 1)
    Sleep 10 ; this sleep is to keep the fast while/wend loop from hogging the CPU
    Send("{w down}")
    Send("{d down}")
WEnd
Send {"w up"}
Send {"d up"}
Exit

Again, used the notepad example.

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

The loop method would be better then, since sleep will halt script processing.

Run("Notepad.exe")
WinWait("Untitled - Notepad")
WinActivate("Untitled - Notepad")
$timer = TimerInit()
While TimerDiff($timer) < Random(500, 1000, 1)
    Sleep 10 ; this sleep is to keep the fast while/wend loop from hogging the CPU
    Send("{w down}")
    Send("{d down}")
WEnd
Send {"w up"}
Send {"d up"}
Exit

Again, used the notepad example.

Thanks for trying to help me lol I'm about to give up :P

I think the function itself is fine with the timer or the other way.

heres what ive edited to

HotKeySet("{F1}", "Start")
HotKeySet("{F2}", "Stop")
Global $Loop = 0

$InI = 'abc123.ini'

Global $deathini = IniRead(@ScriptDir & "\" & $InI, "Options", "Death", "NotFound")
$armorini = IniRead(@ScriptDir & "\" & $InI, "Options", "Armor", "NotFound")
$Cast = IniRead(@ScriptDir & "\" & $InI, "Options", "Cast", "NotFound")
$buffkey = $armorini
$WoW = 'World of Warcraft'
$notset = ''
$logout = 'logout'
$shutdownn = 'shutdown'
$quit = 'quit'
$attack = 't'
$findmob = '{tab}'
$mobtargeted = '0x605F00';target a mob and get the color of the background color where the mob name is
$health = '0x008900';get the color of your health and pick the color of the health at about 25% or 1/2(health doesent have to be at 25% or 1/2 just to get the color)
$mana = '0x000093';get the color of your mana and pick the color of the mana at about 25% or 1/2(mana doesent have to be at 25% or 1/2 just to get the color)
$armor = '0x007BEC';
$dead = '0x710000';release spirit button

$chat = '0xDC73CD';pink
$msg = 'brb';msg here
$msg2 = 'oops mistell sorry'
$death = '/exit'
;
If FileExists(@ScriptDir & "\" & $InI) Then
Sleep(Random(400, 550))
Else
MsgBox(0, "Error", $InI & " does not exist!")
EndIf
If $deathini == $notset Then
$deathini = False
Else
$deathini = True
EndIf
If $armorini == $notset Then
$armorini = False
Else
$armorini = True
EndIf
If $armorini = False And $deathini = False Then
MsgBox(0, $InI, "Armor and Death options need to be setup in the .ini file")
EndIf
If $armorini = True And $deathini = False Then
MsgBox(0, $InI, "Death options need to be setup in the .ini file")
EndIf
If $armorini = False And $deathini = True Then
MsgBox(0, $InI, "Armor key needs to be setup in the .ini file")
EndIf
If $Cast == $notset Then
MsgBox(0, "Error", "Cast not set")
EndIf










While 1
If $Loop = 1 Then
$whsp = PixelSearch(34, 558, 135, 673, $chat)
If Not @error Then
Sleep(500)
Send('r')
Sleep(500)
Send($msg)
Send('{enter}')
Sleep(500)
Send('r')
Sleep(500)
Send($msg2)
Send('{enter}')
Sleep(500)
Send('{enter}')
Sleep(500)
Send('/exit')
Sleep(500)
Send('{enter}')
Sleep(500)
Exit
Else
Sleep(random(10, 15))
EndIf   
    
    
$deathdetect = PixelSearch(451, 180, 570, 192, $dead)
If Not @error Then
died($deathini)
EndIf
$buff = PixelSearch(815, 32, 842, 59, $armor)
If Not @error Then
Sleep(Random(700, 1000))
Else
Send($buffkey)
Sleep(Random(600, 900))
EndIf
PixelSearch(90, 71, 127, 81, $mana)
If Not @error Then
Else
Sleep(Random(9000, 10000))
EndIf
PixelSearch(90, 64, 127, 71, $health)
If Not @error Then
Else
Sleep(Random(9000, 10500))
EndIf
Send($findmob)
Sleep(Random(500, 700))
PixelSearch(260, 48, 290, 59, $mobtargeted)
Sleep(Random(500, 700))
If Not @error Then
Send($attack)
Sleep(Random(300, 600))
Send($Cast)
Sleep(Random(10000, 15000))
Do
$mobalive = PixelSearch(260, 48, 290, 59, $mobtargeted)
Sleep(Random(500, 700))
If @error Then
dead()
Else
alive()
EndIf
Until Not IsArray($mobalive)
EndIf
If $Loop = 1 Then
Sleep(1000)
Else
ExitLoop
EndIf
EndIf
WEnd
Func Start()
$Loop = 1
EndFunc;==>Start
Func Stop()
$Loop = 0
EndFunc;==>Stop
Func died($deathini)
If $deathini = $logout Then logout()
If $deathini = $shutdownn Then shutdownn()
If $deathini = $quit Then Quit()
EndFunc;==>died
Func logout()
Sleep(Random(800, 1000))
Send('{enter}')
Sleep(Random(800, 1000))
Send('/logout')
Sleep(Random(800, 1000))
Send('{enter}')

Exit
EndFunc;==>logout
Func shutdownn()
Shutdown(9)
EndFunc;==>shutdownn
Func Quit()
Exit
WinClose($WoW)
EndFunc;==>Quit
Func alive()
Send($Cast)
Sleep(Random(3000, 5000))
EndFunc;==>alive
Func dead()
$timer = TimerInit()
While TimerDiff($timer) < Random(500, 1000, 1)
Sleep(10); this sleep is to keep the fast while/wend loop from hogging the CPU
Send("{w down}")
Send("{d down}")
WEnd
Send('{w up}')
Send('{d up}')
EndFunc;==>dead

still don't do the dead() function correctly

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

still don't do the dead() function correctly

r you telling me that this

Opt("SendKeyDownDelay", Random(5000, 15000))
Send("{w}")
Opt("SendKeyDownDelay", 5)

is not working 4 you O_o ?

what kinde of game is that when a honest man cant cheat on it :P:P

if this rly dont work then your realy out of luck :/

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0