Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Question/Suggestion

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Tue Apr 16, 2013 2:41 pm    Post subject: Question/Suggestion Reply with quote

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
View user's profile Send private message Visit poster's website
mgr.inz.Player
I post too much
Reputation: 222

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Tue Apr 16, 2013 5:09 pm    Post subject: Reply with quote

Flash hacker wrote:

Do not test this Very Happy
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
View user's profile Send private message MSN Messenger
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Tue Apr 16, 2013 6:05 pm    Post subject: Reply with quote

Example..
Quote:

▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒


The above is some screen of some picture that can be changed..
So what I want is to make C.E look for this line of colors
Quote:
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒

Like there is lots of colors, but their orders is different and that makes them unique.

Anyway, I want to find the position of the begging of
Quote:
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒

And return the position (so I will able to do what I want Smile)

In simple, Some sort of 'image' searcher.

_________________
I'm rusty and getting older, help me re-learn lua.
Back to top
View user's profile Send private message Visit poster's website
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25856
Location: The netherlands

PostPosted: Tue Apr 16, 2013 6:42 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Tue Apr 16, 2013 6:54 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25856
Location: The netherlands

PostPosted: Tue Apr 16, 2013 7:28 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
Rectangle
Advanced Cheater
Reputation: 1

Joined: 23 Feb 2013
Posts: 73

PostPosted: Wed Apr 17, 2013 2:55 am    Post subject: Reply with quote

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
View user's profile Send private message
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Wed Apr 17, 2013 5:13 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites