Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

InGame Scripts HowTo


  • Please log in to reply
56 replies to this topic
_3D_
  • Members
  • 79 posts
  • Last active: Mar 14 2014 07:49 PM
  • Joined: 28 Feb 2013

Why scrips dont work in game?

Theory:

ANY, I mean ANY, game machine have strongly recomendations to work. There more out of logic things that run inside any game: (gold spammers, talk restrictions, impossible key sequences and so on). NOW FIRST THAT WE MUST TO UNDERSTAND is scripts INGAME has individual game specific and if in one game is TRUE in other game may be FALSE :p.

 

Key sequences:

MOST games have internal logic to do keyboard / mouse sequences that manipulate the character. NOW what we just need.

It is simple do this sequences or other one QUICĐšLY and in the end to got dominate to opposite character.

 

 

Where is the problem???

Gamers HATE robots / bots and game masters TOO, ANY game have strongly logic to determinate whoIS player and whoIS BOT.

 

 

And???

Hour problem is to be fast enough and not so fast - LOL

If we ultra fast game will decide that we BOT.

If we not so fast will DIE. LOL in virtual one content.

 

Now how THE GAME check if YOU are BOT - simple SOME statistic MAN got result that HUMAN cant press keys so quickly so BOT do it.

 

AND we need to be furious but not so quick. LOL

1::
  Send {button1}
  Send {button2}
  Send {button3}
return

actually this one script cant work - but we need to do just that.

1::
  Send {Button1}
  Sleep 100
  Send {Button2}
  Sleep 100
  Send {Button3}
return

now we wait 100ms between any "pressed" button - and if HUMAN press button for about 80ms - we are not BOT :p

BUT script still not work and if true no so fast

1::
  Send {Button1 down}
  Sleep 20
  Send {Button up}
  Sleep 100
...
return

now we press and hold given button and wait enough - but what the CODE we must to write

 

LETS think what this waitings do it?

 

Waiting between pressed buttons and buttons must be holded down that GIVE us HUMAN state not BOT one. AND in the last we must wait to press wait to release and so wait and wait. 

In AutoHotKey has SetKeyDelay, waitBefore, waitPress

1::
  SetKeyDelay, 10, 20
  Send {button1}
  Sleep 100
  Send {button2}
return

now we have 10ms waiting then pressing and holding for 20ms button1 then waiting 100ms then the same with button2

let we sed that is possible in ANY game player to press two different buttons together that give us fastnest 

1::
  SetKeyDaley, 10, 20
  Send {button1}
  Send {button2}
retuen

we avoid 100ms waiting (BUT IF not RESULT WE NEED TO WAIT ANYWAY)

now we need fine triggered 10 and 20 arguments to produce working script INGAME (dont forget that must trigger and 100ms also)

1::
  SetKeyDelay, 10, 20
  Send {button1 2}{button2 2} ;fast pressing button1 then fast pressing button2
return

DO IT - KILL THEM ALL - ENJOY

~1::
  SetKeyDelay, 10, 20
  Send {button1 2}{button2 2}
return

OFCOURSE we need tricky to send and the initial one button to game - in example we send button "1" together with botton1 (pressed quickly 2 times) and button2 (pressed quickly 2 times). YEA I know it is ultra button and together and so ... 

;real one example that work FINE
~1::
  SetKeyDelay, 10, 20
  Send {Numpad1 2}{Numpad2 2}
return
;pressed together 1 and Numpad1 and Numpad 2 last two 2 times if first one missed (for any reason)

CAPSLOCK ON

ANY GAME HAVE INDIVIDUAL INTERNAL AND SECRET LOGIC YOU MUST PRODUCE MANY, MANY, MANY TEST TO DO STABLE WORKING SCRIPT. IT DEPEND FROM CURRENT GAME AND CURRENT HARDWARE AND CURRENT INTERNET CONNECTION AND CURRENT .... ASTROLOGY LOL.

 

IT IS TO BE FAST IN BATTLE, IT IS NOT TO BE FAST IN SPAM - I BELIEVE GOLDSPAMMERS TO DONT READ THIS ONE AND I BELIEVE THAT GM (GAME MASTERS) TO READ THIS AND TO DISABLE SPAM TO BE PRODUCED IN GAME (OFCOURSE MOST SECRETS ARE SECRET LOL).

 

Enjoy.

PS. My English not so English but AutoHotKey is lol.



Sanctus
  • Members
  • 283 posts
  • Last active: Dec 06 2014 04:05 PM
  • Joined: 30 Nov 2012

I fancy myself quite the grammar nazi, even though English is not my mother language,

I still highly enjoyed your post, it was entertaining and straight to the point.

 

Different games have different ways of dealing with "automation".

There are still a lot of ways to fake the automation to look human.

Using random generated numbers helps but what helps the most is just not to be too greedy when it comes to speed.

 

Completely based on the game and its developers.

 

How I work through gaming scripting related issues:

 

First:

If Send fails, use SendInput

If SendInput fails try SendPlay and SendEvent

If those fail, try SendInput with sleep between button down and up

If that fails try sending same key multiple times (Send {W 3})

If that fails go all in and use dllcall keybd event and last if that doesnt work

try dllcall keybd event with sleep between button down and up

example:

dllcall("keybd_event", int, 57, int, 0x049, int, 0, int, 0)
Sleep, 64
dllcall("keybd_event", int, 57, int, 0x049, int, 2, int, 0)

^It sends 8 :) very simple

 

Hope this is useful for someone ^^


Check out ALL My Scripts  ;)


hollow
  • Members
  • 125 posts
  • Last active: Dec 21 2014 09:12 AM
  • Joined: 19 May 2011

This is a very good tutorial. I find it very useful as I'm the one with much interest in Autohotkey though I'm not intelligent enuf to learn scripting...I'm still enjoying it..when scripting small small things..for enjoyment.

 

This community is helpful since I joint. :)



_3D_
  • Members
  • 79 posts
  • Last active: Mar 14 2014 07:49 PM
  • Joined: 28 Feb 2013

ImageSerch - why I cant find a picture?

 

;AutoHotKey syntax

ImageSearch, foundX, foundY, topLeftX, topLeftY, rightDownX, rightDownY, imageFile

http://www.autohotke...ImageSearch.htm

 

Ofcource there hiden tricks (before imageFile) but let some teory first:

 

1. What the comparing mean ?

It is very native and stuppid question BUT is that so true. Comparing two different values is a quiet simple if A=B

but what in the real happens > if A-B = 0 

 

2.What actually we find (search, compare) between two pictures?

Let for simple we sed that one picture is a rectangular set of pixels it mean dimentions Width: Height and pixelValues.

Now if we have two diferent sets with equal structure we may do next:

;IT IS NOT REAL CODE

if picture_1_Width = picture_2_Width
  if picture_1_Height = picture_2_Height
  {
    width:= 0
    Loop picture_1_Width
    {
      height:= 0
      Loop picture_1_Height
      {
        ;comparing pixel by pixel
        if picture_1_[height * picture_1_Width + width] != picture_2_[height * picture_1_Width + width]
          return 1
        height++  
      }
      width++
    }
    return 0 ;mean all parameters of two diferent pictures ARE equal
  } 
return 1 ;mean picture_1 not equal to picture_2 

now we have STRONGLY comparing parameters Width and Height and pixel by pixel of pictures

 

It is rare in real world, actually all the time we have different width and height and not so equal pixels

;IT IS NOT REAL CODE

;let sed that we still have two different pictures with equal dimentions
if picture_1_Width = picture_2_Width
  if picture_1_Height = picture_2_Height
  {
    width:= 0
    Loop picture_1_Width
    {
      height:= 0
      Loop picture_1_Height
      {
        ;but colors not so equal each to other
        result:= abs(picture_1_[height * picture_1_Width + width] - picture_2_[height * picture_1_Width + width])
        
        ;we need different colors to be not more than Variation diferent
        ;let sed color_1 must no more different than clor_2 by Variation
        ;or color_1 must be IN color_2-Variation , color_2+Variation
        ;now we have RANGE that colors ARE EQUAL
        if result > Variation ;IF Variation = 0 -> strongly equal colors *n0 parameter in ImageSearch :P 
          return 1
        height++  
      }
      width++
    }
    return 0 ;mean all parameters of two different pictures ARE equal
  } 
return 1 ;mean picture_1 not equal to picture_2 

What the COLOR is ?

There many color definitions but let say that color is Red, Green, Blue values connected together

exanple:

Red = 0x11, Green = 0x22, Blue = 0x33 => RGB = 0x112233

 

Any (char 0..255) value control the corresponding channel to forming the color 

 

 

now we know that our camparing must be 3 times complicated

lol camparing - brandying - whiskeying lol - let must be comparing

;IT IS NOT REAL CODE

; ----------------------- RED channel --------------v
if abs(picture_1_[height * picture_1_Width + width]_RED 
      -picture_2_[height * picture_1_Width + width]_RED) > Variation ;it is C like syntax
  return 1      
; --------------------- GREEN channel --------------v
if abs(picture_1_[height * picture_1_Width + width]_GREEN 
      -picture_2_[height * picture_1_Width + width]_GREEN) > Variation ;it is C like syntax
  return 1      
; ---------------------- BLUE channel --------------v
if abs(picture_1_[height * picture_1_Width + width]_BLUE 
      -picture_2_[height * picture_1_Width + width]_BLUE) > Variation ;it is C like syntax
  return 1      

LOL I stray tooooo long away

*n (variation): Specify for n a number between 0 and 255 (inclusive) to indicate the allowed number of shades
                of variation in either direction for the intensity of the red, green, and blue components
                of each pixel's color. For example, *2 would allow two shades of variation. This parameter is
                helpful if the coloring of the image varies slightly or if ImageFile uses a format such as
                GIF or JPG that does not accurately represent an image on the screen.
                If you specify 255 shades of variation, all colors will match.
                The default is 0 shades.

quiet and simple

    0 = 100% coincidence - strongly EQUAL

255 =     0% coincidence - mean ANY two colors match 

 

if we need 80% coincidence that mean 20% UNcoincidence --> Variation must be: 255 * 20 / 100 = 51 (0x33)

 

 

I cant explain how to compare different sized pictures and cant mention about transparency because havent so much letters in keyboard :p

Just want to say that strongly equal is not so useful in picture comparing.

 

 

!!! IMPORTANT !!! 

COLOR THAT YOU SEE AT ONE VIDEO HARDWARE IS NOT SO THE SAME IN DIFFERENT ONE



RHCP
  • Members
  • 1228 posts
  • Last active: Apr 08 2017 06:17 PM
  • Joined: 29 May 2006
dllcall("keybd_event", int, 57, int, 0x049, int, 0, int, 0)
Sleep, 64
dllcall("keybd_event", int, 57, int, 0x049, int, 2, int, 0)

 

Is that actually any different to SendEvent?  Send event uses that doesn't it?

 

Thanks.



_3D_
  • Members
  • 79 posts
  • Last active: Mar 14 2014 07:49 PM
  • Joined: 28 Feb 2013

Is that actually any different to SendEvent?  Send event uses that doesn't it?

 

Thanks.

It is question to AutoHotKey makers - dllcall is a native OS call that we thik is closer to OS enviroment than method worked over the same OS - Actually only AutoHotKey guys may answer. unsure.png

 

But in true dllcall is a good alternative if any other methods dont do effect. 



_3D_
  • Members
  • 79 posts
  • Last active: Mar 14 2014 07:49 PM
  • Joined: 28 Feb 2013

A little tool getting mouse position (Screen and Active window) and color under mouse position



#Persistent
#SingleInstance Force
;SetBatchLines, 10ms

;must pressent Gdip.ahk includeing
#Include, %A_ScriptDir%\Lib\Gdip.ahk

;Copyright (c) D.Donchev

CoordMode, ToolTip, Screen

getResult:= 1
SetTimer, LABEL_GetMousePosCol, 20 ;set iteration time
return

LABEL_GetMousePosCol:
  if getResult
	{
    CoordMode, Mouse, Screen    ;get mouse position coordinates Screen relative
    MouseGetPos, scrX, scrY
    CoordMode, Mouse, Relative   ;get mouse position coordinates Active Window relative
    MouseGetPos, winX, winY
    ;CoordMode, Mouse, Screen
	
		color:= DD_PixelGetColor(scrX, scrY)
		
		csX:= scrX, csY:= scrY
		cwX:= winX, cwY:= winY
	}
	ToolTip,% DD_leading(csX, 4) ":" DD_leading(csY, 4) "`n" cwX ":" cwY "`n" color
return

#Z::
	getResult:= !getResult
return
		
#Q::
	ExitApp
return

DD_PixelGetColor( X, Y)
{
	chdc:= CreateCompatibleDC(), hbm := CreateDIBSection(1, 1, chdc), obm := SelectObject(chdc, hbm), hhdc:= hhdc ? hhdc : GetDC()
	BitBlt(chdc, 0, 0, 1, 1, hhdc, X, Y, 0x40000000 | 0x00CC0020)

	SetFormat, Integer, H
	RGB := DllCall("GetPixel", "Int",chdc, "Int", 0, "Int", 0)
	SetFormat, Integer, D

	ReleaseDC(hhdc), SelectObject(chdc, obm), DeleteObject(hbm), DeleteDC(hhdc), DeleteDC(chdc)
	
	return RGB
}

DD_leading(v, p:= 2, c:= "0")   ;Adding srting (c) (p) times at the front of (v)
{
  Loop, % p - StrLen(v)    ;if count < 1 no loop iteration (by language DEFAULT)
    v:= % c v
  return v
} ; ==============================================================================

<Win>+Z - freezing results

<Win>+Q- exit

 

!!! Enjoy !!!

 

Sorry, for code view, I try to post it 3 times and ... :(


Edited by _3D, 14 May 2013 - 08:32 AM.


Sanctus
  • Members
  • 283 posts
  • Last active: Dec 06 2014 04:05 PM
  • Joined: 30 Nov 2012
#SingleInstance force

!x::
MouseGetPos, PosX, PosY
PixelGetColor, cRGB , %PosX%, %PosY%,RGB
PixelGetColor, cBGR , %PosX%, %PosY%
gui, new
gui, Default
gui, +LastFound +LabelMyGui
gui, add, groupbox, w205 h210, Info found at Mouse Position
gui, font, s12, Arial
gui, add, text, xm12 ym20 section, MousePos X: 
gui, add, text, xp+110 yp, %PosX%
gui, add, text, xp-110 yp+15, MousePos Y: 
gui, add, text, xp+110 yp, %PosY%
gui, add, text, xp-110 yp+15, BGR Colour: 
gui, add, text, xp+110 yp, %cBGR%
gui, add, text, xp-110 yp+15, RGB Colour: 
gui, add, text, xp+110 yp, %cRGB%
gui, font, s8, Arial
gui, add, button, xp-70 yp+17.5 w100 h20 gClip, Copy to Clipboard
gui, font, s12, Arial
gui, add, button, xp+30 yp+25 gDone, OK
gui, add, Progress, xp-7.5 yp+35 w50 h50 c%cRGB%,100
gui, font, s10, Verdana
gui, add, text, yp+45 xp-65, Version: 1.00 (14.3.2013)
gui, show,, Position/Colour of X&Y
return
Done:
{
gui,submit,nohide
gui, destroy
return
}
Clip:
{
clipboard = %PosX% %PosY% %Colour%
}
return

F5::Reload
F8::ExitApp

Same principle as yours just bit more simple to work with :) no need for extra ahk etc.

 

Alt + X to Get Pos and Colour at Mouse

F5 to Restart Program

F8 to Crash/Close Program


Check out ALL My Scripts  ;)


_3D_
  • Members
  • 79 posts
  • Last active: Mar 14 2014 07:49 PM
  • Joined: 28 Feb 2013

Unfortunately

PixelGetColor, cBGR , %PosX%, %PosY%

cant get color inside the game and return 0x000000 :(

But I liked this Gui method and will rearange it a little thanks Sanctus



Sanctus
  • Members
  • 283 posts
  • Last active: Dec 06 2014 04:05 PM
  • Joined: 30 Nov 2012

Unfortunately

PixelGetColor, cBGR , %PosX%, %PosY%

cant get color inside the game and return 0x000000 sad.png

But I liked this Gui method and will rearange it a little thanks Sanctus

Inside which game? works for every game I've used it for :S


Check out ALL My Scripts  ;)


_3D_
  • Members
  • 79 posts
  • Last active: Mar 14 2014 07:49 PM
  • Joined: 28 Feb 2013

Inside which game? works for every game I've used it for confused.png

I do some experiments and result:

PixelGetColor and DllCall("GetPixel", "Int",chdc, "Int", 0, "Int", 0) both return in any possition 0x000000

 

I mention that 5 sec after character screen loaded both functions start to give only 0x000000 but:

chdc:= CreateCompatibleDC(), hbm := CreateDIBSection(1, 1, chdc), obm := SelectObject(chdc, hbm), hhdc:= hhdc ? hhdc : GetDC()
BitBlt(chdc, 0, 0, 1, 1, hhdc, X, Y, 0x40000000 | 0x00CC0020)

SetFormat, Integer, H
RGB := DllCall("GetPixel", "Int",chdc, "Int", 0, "Int", 0)

;if i save hbm to file 
SaveHBITMAPToFile(hbm, "c:\temp\temp.bmp")
;color in this 1 pixel file is CORRECT but RGB still 0x000000
;it mean game catch DllCall("GetPixel", "Int",chdc, "Int", 0, "Int", 0) and return 0
;if game active function not work IN game nor OUTSIDE game till I stop the game :(((((((((((
;it is while last update from this morning :((((((((

SetFormat, Integer, D
ReleaseDC(hhdc), SelectObject(chdc, obm), DeleteObject(hbm), DeleteDC(hhdc), DeleteDC(chdc)
return RGB

SaveHBITMAPToFile(hBitmap, fileName)
{
	DllCall("GetObject", "Uint", hBitmap, "int", VarSetCapacity(oi,84,0), "Uint", &oi)
	hFile:=	DllCall("CreateFile", "Uint", &fileName, "Uint", 0x40000000, "Uint", 0, "Uint", 0, "Uint", 2, "Uint", 0, "Uint", 0)
	DllCall("WriteFile", "Uint", hFile, "int64P", 0x4D42|14+40+NumGet(oi,44)<<16, "Uint", 6, "UintP", 0, "Uint", 0)
	DllCall("WriteFile", "Uint", hFile, "int64P", 54<<32, "Uint", 8, "UintP", 0, "Uint", 0)
	DllCall("WriteFile", "Uint", hFile, "Uint", &oi+24, "Uint", 40, "UintP", 0, "Uint", 0)
	DllCall("WriteFile", "Uint", hFile, "Uint", NumGet(oi,20), "Uint", NumGet(oi,44), "UintP", 0, "Uint", 0)
	DllCall("CloseHandle", "Uint", hFile)
}

now I try next one

pbm:= Gdip_CreateBitmapFromHBITMAP(hbm)
RGB:= Gdip_GetPixel(pbm, 1, 1) ; <------ no work atall

ANY SUGGESTIONS ARE WELCOME

 



_3D_
  • Members
  • 79 posts
  • Last active: Mar 14 2014 07:49 PM
  • Joined: 28 Feb 2013
Shame to me but I dont know hBitmap what is and if there possible to get color value directly from hbm somthing about
color:= NumGet(hbm, OFFSET, "UInt")
will be sollution if all GetColor functions not work

LOL
hBitmap - HANDLE to Bitmap - reading is solution any time

Edited by _3D, 17 May 2013 - 09:46 PM.


_3D_
  • Members
  • 79 posts
  • Last active: Mar 14 2014 07:49 PM
  • Joined: 28 Feb 2013

BTW while I thinking about GetPixelFromHBITMAP without system functions...

Sanctus inspired GetPixel.ahk

;gdi+ ahk tutorial 7 written by tic (Tariq Porter)
;Tutorial to draw a rounded rectangle as a gui that you can drag

;Requires Gdip.ahk either in your Lib folder as standard library or using 
;#Include "path_to_gdip\GDIP.ahk"

;#NoEnv  ;Recommended for performance and compatibility with future AutoHotkey releases.
;#Warn   ;Recommended for catching common errors.
SetWorkingDir %A_ScriptDir%  ;Ensures a consistent starting directory.

#Persistent
#SingleInstance, Force
SetBatchLines, 10ms
CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
  
  GUI_ACTIVE:= 1
  
  pToken := Gdip_Startup()
  Gui, -Caption +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs
  
  Gui, Show, NA
  
  hwnd:= WinExist()
  hbm := CreateDIBSection(mwW:=87, mwH:=52)
  hdc := CreateCompatibleDC()
  obm := SelectObject(hdc, hbm)
  G   := Gdip_GraphicsFromHDC(hdc)
  
  Gdip_SetSmoothingMode(G, 4)
  MouseGetPos, mX, mY
  UpdateLayeredWindow(hwnd, hdc, mX, mY, mwW, mwH)
  
  OnMessage(0x200, "WM_MOUSEMOVE")
  
  SetTimer, mainWindowContent, 200
  
mainWindowContent:
  IF !GUI_ACTIVE
    return
;clear window =================================================================
  Gdip_SetCompositingMode(G, 1) ; set to overdraw
  pBrush := Gdip_BrushCreateSolid(0x00000000) ; fully transparent brush 'eraser'
  Gdip_FillRoundedRectangle(G, pBrush, 0, 0, mwW, mwH, 10)
  Gdip_DeleteBrush(pBrush)
  Gdip_SetCompositingMode(G, 0) ; switch off overdraw
;==============================================================================  
  
  MouseGetPos, mX, mY
  color:= DD_PixelGetColor(mX, mY)
  
  pBrush := Gdip_BrushCreateSolid(0x7FC0C0C0)
	Gdip_FillRoundedRectangle(G, pBrush,   0,   0, mwW,  mwH, 10)
	Gdip_DeleteBrush(pBrush)
	
  pBrush := Gdip_BrushCreateSolid(0xFF000000+color)
	Gdip_FillRoundedRectangle(G, pBrush,  10,  10, mwW-20, mwH-20, 5)
	Gdip_DeleteBrush(pBrush)
  
  Gdip_TextToGraphics(G, DD_leading(mX, 4) ":" DD_leading(mY, 4), "x" 11 " y" 13 " cFFFDD017 r4 s" 10 " Bold", "Verdana", 224, 47)
  Gdip_TextToGraphics(G, DD_leading(SubStr(color, 3), 6)        , "x" 21 " y" 27 " cFFFDD017 r4 s" 10 " Bold", "Verdana", 224, 47)
     
;refresh window ===============================================================  
  UpdateLayeredWindow(hwnd, hdc)
;==============================================================================  
return

;#######################################################################
; This function is called every time the user clicks on the gui
; The PostMessage will act on the last found window (this being the gui that launched the subroutine, hence the last parameter not being needed)
WM_MOUSEMOVE()
{
	PostMessage, 0xA1, 2
}
;#######################################################################

#!F4::
Exit:
  SelectObject(hdc, obm)
  DeleteObject(hbm)
  DeleteDC(hdc)
  Gdip_DeleteGraphics(G)
  Gdip_Shutdown(pToken)
	ExitApp
Return

#Z::GUI_ACTIVE:=!GUI_ACTIVE
#F9::Reload

#Space::
	if (HideShow := !HideShow)
		Gui, Hide
	else
  	Gui, Show
return

;DD.ahk libraly =================================================================
DD_leading(v, p:= 2, c:= "0") ;Adding srting (c) (p) times at the front of (v)
{
  Loop, % p - StrLen(v)    ;if count < 1 no loop iteration (by language DEFAULT)
    v:= % c v
  return v
} ;==============================================================================

DD_PixelGetColor(X, Y)  
{
	chdc:= CreateCompatibleDC(), hbm := CreateDIBSection(1, 1, chdc), obm := SelectObject(chdc, hbm), hhdc:= hhdc ? hhdc : GetDC()
  BitBlt(chdc, 0, 0, 1, 1, hhdc, X, Y, 0x40000000 | 0x00CC0020)
  
  SetFormat, Integer, H
	RGB := DllCall("GetPixel", "Int",chdc, "Int", 0, "Int", 0)                    ;BGR color
  RGB := ((RGB & 0xFF0000) >> 16) + (RGB & 0x00FF00) + ((RGB & 0x0000FF) << 16) ;RGB color
	SetFormat, Integer, D
  
	ReleaseDC(hhdc), SelectObject(chdc, obm), DeleteObject(hbm), DeleteDC(hhdc), DeleteDC(chdc)
	return RGB
} ;==============================================================================



_3D_
  • Members
  • 79 posts
  • Last active: Mar 14 2014 07:49 PM
  • Joined: 28 Feb 2013

TY alot to http://www.autohotke...s-or-getdibits/

 

And Finaly GetPixel without using GetPixel method - now work perfect



DD_PixelGetColor(X, Y)  
{
  chdc:= CreateCompatibleDC(), hbm := CreateDIBSection(1, 1, chdc), obm := SelectObject(chdc, hbm), hhdc:= hhdc ? hhdc : GetDC()
  BitBlt(chdc, 0, 0, 1, 1, hhdc, X, Y, 0x40000000 | 0x00CC0020)
  
  ;return value ARGB format
  DllCall("GetBitmapBits", UInt, hbm, UInt, VarSetCapacity(bits,4,0), UInt,&bits)
  SetFormat, Integer, H
  RGB:= NumGet(bits,0, 4) & 0x00FFFFFF
  
  ReleaseDC(hhdc), SelectObject(chdc, obm), DeleteObject(hbm), DeleteDC(hhdc), DeleteDC(chdc)
  return RGB
} ;==============================================================================

Edited by _3D, 18 May 2013 - 09:00 AM.


Sanctus
  • Members
  • 283 posts
  • Last active: Dec 06 2014 04:05 PM
  • Joined: 30 Nov 2012

A very nice trick I often use, when you dont have access to a nice cursor in game when trying to pick locations and colors.

  • Take a screenshot of the game in fullscreen or borderless fullscreen.
  • Open it in paint.
  • Save it to a folder with no other pictures.
  • Open the picture and put it into fullscreen "F11". (Windows Photo Viewer)

Now it is just a freeze frame of your game window so you can

easily access all the colors and take your sweet time making a sweet script ;)

Hope this helps.


Check out ALL My Scripts  ;)