Page 1 of 1

fix please

Posted: 19 Apr 2021, 20:59
by vitorcastro

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.]

Re: fix please

Posted: 19 Apr 2021, 21:00
by vitorcastro
i tried to edit a script to mix 3 in one so i dont need to open 3 files all the time

Re: fix please

Posted: 19 Apr 2021, 21:01
by vitorcastro
this is the original one

Re: fix please

Posted: 19 Apr 2021, 21:27
by vitorcastro

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.]

Re: fix please

Posted: 19 Apr 2021, 21:44
by mikeyww

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

Re: fix please

Posted: 19 Apr 2021, 22:19
by vitorcastro
nothing happens

Re: fix please

Posted: 19 Apr 2021, 22:30
by vitorcastro

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

Re: fix please

Posted: 19 Apr 2021, 22:31
by vitorcastro
i edit that but only working outside of the player now lol

Re: fix please

Posted: 19 Apr 2021, 22:38
by mikeyww
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

Re: fix please

Posted: 20 Apr 2021, 00:27
by vitorcastro
should i replace cord mode with pixelsearch?

Re: fix please

Posted: 20 Apr 2021, 01:19
by vitorcastro
i tried everything lol be a good boy

Re: fix please

Posted: 20 Apr 2021, 06:16
by mikeyww
What happened when you ran the latest script? Did it do what you want?

Re: fix please

Posted: 20 Apr 2021, 08:19
by vitorcastro
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

Re: fix please

Posted: 20 Apr 2021, 09:36
by mikeyww
OK. Feel free to post questions if any remain.

Re: fix please

Posted: 20 Apr 2021, 12:12
by vitorcastro
well i need a fix

Re: fix please

Posted: 20 Apr 2021, 12:30
by mikeyww
Describe what should happen, step by step, along with an example.

Re: fix please

Posted: 20 Apr 2021, 14:40
by vitorcastro
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

Re: fix please

Posted: 20 Apr 2021, 16:11
by mikeyww
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.