fix please

Ask gaming related questions (AHK v1.1 and older)
vitorcastro
Posts: 47
Joined: 18 Apr 2021, 19:09

fix please

19 Apr 2021, 20:59

Code: Select all

wTitle = MEmu
Loop {
 WinWait, %wTitle%
 SetTimer, MEmu, 500

 WinWaitClose
 SetTimer, MEmu, Off

}
Memu:

PixelSearch,,, 343, 44, 343, 44, 0x020184, 100
If !ErrorLevel ; Skip if pixel was found

SetKeyDelay, 100
ControlSend,, {F1 2}, %wTitle%
Return

PixelSearch,,, 688, 319, 688, 319, 0x06ce07, 100
If !ErrorLevel ; Skip if pixel was found

SetKeyDelay, 100
ControlSend,, {F3 2}, %wTitle%

PixelSearch,,, 327, 60, 327, 60, 0xa10c1d, 100
If !ErrorLevel ; Skip if pixel was found
 Return
SetKeyDelay, 100
ControlSend,, {F2 2}, %wTitle%
Return

esc::exitapp
F5::Pause ; press F1 to play/pause
[Mod edit: [code][/code] tags added.]
vitorcastro
Posts: 47
Joined: 18 Apr 2021, 19:09

Re: fix please

19 Apr 2021, 21:00

i tried to edit a script to mix 3 in one so i dont need to open 3 files all the time
vitorcastro
Posts: 47
Joined: 18 Apr 2021, 19:09

Re: fix please

19 Apr 2021, 21:01

this is the original one
vitorcastro
Posts: 47
Joined: 18 Apr 2021, 19:09

Re: fix please

19 Apr 2021, 21:27

Code: Select all

wTitle = MEmu
Loop {
 WinWait, %wTitle%
 SetTimer, MEmu, 500

 WinWaitClose
 SetTimer, MEmu, Off

}
Memu:

PixelSearch,,, 343, 44, 343, 44, 0x020184, 100
If !ErrorLevel ; Skip if pixel was found
 Return
SetKeyDelay, 100
ControlSend,, {F1 2}, %wTitle%
Return

esc::exitapp
F5::Pause ; press F1 to play/pause
[Mod edit: [code][/code] tags added.]
User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: fix please

19 Apr 2021, 21:44

Code: Select all

Memu:
SetKeyDelay, 100
PixelSearch,,, 343,  44, 343,  44, 0x020184, 100
ControlSend,, % ErrorLevel ? "{F1 2}" : ""
PixelSearch,,, 688, 319, 688, 319, 0x06CE07, 100
ControlSend,, % ErrorLevel ? "{F3 2}" : ""
PixelSearch,,, 327,  60, 327,  60, 0xA10C1D, 100
ControlSend,, % ErrorLevel ? "{F2 2}" : ""
Return
vitorcastro
Posts: 47
Joined: 18 Apr 2021, 19:09

Re: fix please

19 Apr 2021, 22:19

nothing happens
vitorcastro
Posts: 47
Joined: 18 Apr 2021, 19:09

Re: fix please

19 Apr 2021, 22:30

Code: Select all

wTitle = MEmu
Loop {
 WinWait, %wTitle%
 SetTimer, MEmu, 500

 WinWaitClose
 SetTimer, MEmu, Off

}
MEmu:

PixelSearch,,, 343,  44, 343,  44, 0x020184, 100
If !ErrorLevel ; Skip if pixel was found
 Return
SetKeyDelay, 100
ControlSend,, {F1 2}, %wTitle%

PixelSearch,,, 688, 319, 688, 319, 0x06CE07, 100
If !ErrorLevel ; Skip if pixel was found
 Return
SetKeyDelay, 100
ControlSend,, {F3 2}, %wTitle%

PixelSearch,,, 327,  60, 327,  60, 0xA10C1D, 100
If !ErrorLevel ; Skip if pixel was found
 Return
SetKeyDelay, 100
ControlSend,, {F2 2}, %wTitle%

Return

F5::Pause ; press F1 to play/pause
Last edited by gregster on 19 Apr 2021, 22:31, edited 1 time in total.
Reason: [code] tags added once more. Please use them yourself, next time. Thank you!
vitorcastro
Posts: 47
Joined: 18 Apr 2021, 19:09

Re: fix please

19 Apr 2021, 22:31

i edit that but only working outside of the player now lol
User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: fix please

19 Apr 2021, 22:38

Return will skip all remaining commands in the routine.

You can insert debugging lines to display the results of each search.

If you are using absolute coordinates, then add CoordMode, Pixel to the start of the routine.

Code: Select all

Loop {
 WinWait, MEmu
 SetTimer, MEmu, 500
 SoundBeep, 1500
 WinWaitClose
 SetTimer, MEmu, Off
 SoundBeep, 1000
}
MEmu:
SoundBeep, 1800
SetKeyDelay, 100
CoordMode, Pixel
PixelSearch,,, 343,  44, 343,  44, 0x020184, 100
ControlSend,, % ErrorLevel ? "{F1 2}" : ""
PixelSearch,,, 688, 319, 688, 319, 0x06CE07, 100
ControlSend,, % ErrorLevel ? "{F3 2}" : ""
PixelSearch,,, 327,  60, 327,  60, 0xA10C1D, 100
ControlSend,, % ErrorLevel ? "{F2 2}" : ""
Return
vitorcastro
Posts: 47
Joined: 18 Apr 2021, 19:09

Re: fix please

20 Apr 2021, 00:27

should i replace cord mode with pixelsearch?
vitorcastro
Posts: 47
Joined: 18 Apr 2021, 19:09

Re: fix please

20 Apr 2021, 01:19

i tried everything lol be a good boy
User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: fix please

20 Apr 2021, 06:16

What happened when you ran the latest script? Did it do what you want?
vitorcastro
Posts: 47
Joined: 18 Apr 2021, 19:09

Re: fix please

20 Apr 2021, 08:19

yes did but im using 3 files 1 for mana bar 1 for hp bar and an extra healing to save some gold in game
User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: fix please

20 Apr 2021, 09:36

OK. Feel free to post questions if any remain.
vitorcastro
Posts: 47
Joined: 18 Apr 2021, 19:09

Re: fix please

20 Apr 2021, 12:12

well i need a fix
User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: fix please

20 Apr 2021, 12:30

Describe what should happen, step by step, along with an example.
vitorcastro
Posts: 47
Joined: 18 Apr 2021, 19:09

Re: fix please

20 Apr 2021, 14:40

ok i need that a script that only works on a desired window that search for 3
colors the health bar
second is the mana bar
the third an extra bar when the desired color is not present

color 1 send f1
color 2 send f2
color 3 send f3

aswell with delay in each color found so i can set myself the speed when drinking potions
User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: fix please

20 Apr 2021, 16:11

It looks like that is what the script does-- you can add delays as needed-- but you cannot do a pixel search on a window that is not visible on the screen. I am not sure how else to address your need beyond what the current script is already doing. My advice is that if the script is not working for you, simplify it first: remove the loop, and just do a single pixel search followed by the ControlSend, to get that working. Find out whether the search succeeds-- what the ErrorLevel is, and whether you have the right absolute coordinates and color. Once it is working, add one more search or other action at a time, testing along the way.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 45 guests