| View previous topic :: View next topic |
| Author |
Message |
daspamer Grandmaster Cheater Supreme
Reputation: 54
Joined: 13 Sep 2011 Posts: 1588
|
Posted: Tue Apr 16, 2013 2:41 pm Post subject: Question/Suggestion |
|
|
Hey,
Is it possible to make the LUA file search for X colors in row?
Like for example I do this:
| Code: | a=getPixel(50,50)
b=getPixel(50,51)
c=getPixel(50,52)
d=getPixel(50,53)
print(a,b,c,d) |
Which returning for me this
| Code: | 15987699 16777215 16777215 16777215
|
a=15987699
b=16777215
c=16777215
d=16777215
because doing getPixel from specific location is useful for yourself, but not for everyone.
_________________
I'm rusty and getting older, help me re-learn lua. |
|
| Back to top |
|
 |
mgr.inz.Player I post too much
Reputation: 222
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Tue Apr 16, 2013 5:09 pm Post subject: |
|
|
| Flash hacker wrote: |
Do not test this
Code:
a=1
b=1
repeat
a=b+1
b=a
if b==50 then print(b)
elseif b==50000 then print(b)
elseif b==5000000 then print(b)
elseif b==5000000000 then print(b)
elseif b==50000000001 then print("Done!")
end
until a==50000000001 |
I know better trick. Paste and execute this Lua code
| Code: | repeat
print("nice trick.")
until false |
"Is it possible to make the LUA file search for X colors in row? "
what? More details please.
_________________
|
|
| Back to top |
|
 |
daspamer Grandmaster Cheater Supreme
Reputation: 54
Joined: 13 Sep 2011 Posts: 1588
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25857 Location: The netherlands
|
Posted: Tue Apr 16, 2013 6:42 pm Post subject: |
|
|
you basically do something as you describe in your signature but then use a for loop instead
| Code: |
function checkIfCorrect(x,y)
if (getpixel(x+10,y)==0x00ff00) and
(getpixel(x+20,y)==0x00ff00) and
(getpixel(x+30,y)==0x00ffff) and
(getpixel(x+40,y)==0xffff00)
then
return true
else
return false
end
end
for y=0, 1079 do
for x=0, 1919 do
--check if the current pixel matches the first pixel of the thing you are looking for
if getPixel(x,y)==0x0000ff then
if checkIfCorrect(x,y) then
print("Found at "..x..","..y)
break
end
end
end
end
|
It will take a bit longer than your signature though
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
daspamer Grandmaster Cheater Supreme
Reputation: 54
Joined: 13 Sep 2011 Posts: 1588
|
Posted: Tue Apr 16, 2013 6:54 pm Post subject: |
|
|
| Dark Byte wrote: | you basically do something as you describe in your signature but then use a for loop instead
| Code: |
function checkIfCorrect(x,y)
if (getpixel(x+10,y)==0x00ff00) and
(getpixel(x+20,y)==0x00ff00) and
(getpixel(x+30,y)==0x00ffff) and
(getpixel(x+40,y)==0xffff00)
then
return true
else
return false
end
end
for y=0, 1079 do
for x=0, 1919 do
--check if the current pixel matches the first pixel of the thing you are looking for
if getPixel(x,y)==0x0000ff then
if checkIfCorrect(x,y) then
print("Found at "..x..","..y)
break
end
end
end
end
|
It will take a bit longer than your signature though |
Looks good, but bad that its gonna take that much time.
Any chance to implement it in the future and decrease the process by a lot?
Like you've done with the scanning region in cheat engine
_________________
I'm rusty and getting older, help me re-learn lua. |
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25857 Location: The netherlands
|
Posted: Tue Apr 16, 2013 7:28 pm Post subject: |
|
|
I'm really not into graphical stuff.
I suggest writing a plugin for ce that adds a "scanForPicture(picture)' and then make it call a graphical detection library
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
Rectangle Advanced Cheater
Reputation: 1
Joined: 23 Feb 2013 Posts: 73
|
Posted: Wed Apr 17, 2013 2:55 am Post subject: |
|
|
If 'getpixel' refers to the Win32 API function, it has been deemed as one of the slowest GDI operations available.
Furthermore, it has to go through a Lua binding here, making it that much slower.
Not a big deal for practical applications, but a major impact for anything with a render/image processing loop.
It is far more recommended to use left & right bit-shifting operations alongside GetBitmapBits, other GDI operations, etc. to test the pixel colors of an image.
But since these are not available in the default CE Lua bindings, your best bet is exactly what Dark Byte says... Make one.
Some light reading for you, to implement within your plugin:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd145203%28v=vs.85%29.aspx
But if you don't feel like doing too much research, you could always link your plugin to something like OpenCV or CUVILib:
http://opencv.willowgarage.com/wiki/
http://cuvilib.com/
|
|
| Back to top |
|
 |
daspamer Grandmaster Cheater Supreme
Reputation: 54
Joined: 13 Sep 2011 Posts: 1588
|
Posted: Wed Apr 17, 2013 5:13 am Post subject: |
|
|
Slowlest?
Ugh, I will quit that Idea, No point of trying making any bots/aimbots.
_________________
I'm rusty and getting older, help me re-learn lua. |
|
| Back to top |
|
 |
|