Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- ; #Warn ; Enable warnings to assist with detecting common errors.
- SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
- SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
- #Include,<gdip>
- SetBatchLines, -1
- global dir1
- global dir2
- global y10:=100
- global step0:=40
- global abc
- global cba
- abc:= ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
- cba:= ["21111","33210","14111","31111","41111","12200","12100","11211","41211","42200","31211","11111","43211","33211","33110","13011","31221","41221","12110","34221","33201","13221","11021","13201","32210","11121"]
- pToken := Gdip_Startup()
- global game:={h:500,w:100,x:400,y:100}
- gui,1: -caption +lastfound -dpiscale +E0x80000 +AlwaysOnTop
- GUI,1:Show,% "x" game.x " y" game.y " w" game.w " h" game.h
- hwndl:=WinExist()
- hbm := CreateDIBSection(game.w, game.h)
- hdc:=CreateCompatibleDC()
- obm:=SelectObject(hdc,hbm )
- G := Gdip_GraphicsFromHDC(hdc)
- Gdip_SetSmoothingMode(G, 4)
- pbrush1:=Gdip_BrushCreateSolid("0xffaf0c0b")
- pbrush2:=Gdip_BrushCreateSolid("0xff00ff00")
- pbrush3:=Gdip_BrushCreateSolid("0xff0000ff")
- pbrush4:=Gdip_BrushCreateSolid("0x00ffffff")
- pbrush5:=Gdip_BrushCreateSolid("0xffffffff")
- pbrush6:=Gdip_BrushCreateSolid("0xff0c00b0")
- pbrush7:=Gdip_BrushCreateSolid("0xff000000")
- pPen1 := Gdip_CreatePenFromBrush(pBrush1, 5)
- pPen2 := Gdip_CreatePenFromBrush(pBrush7, 1)
- pPen3 := Gdip_CreatePenFromBrush(pBrush7, 3)
- Gdip_FillRectangle(g, pBrush5, 0, 0, game.w, game.h)
- gosub lay
- UpdateLayeredWindow(hwndl, hdc, game.x, game.y, game.w, game.h)
- global mass_x:=[]
- global mass_y:=[]
- loop {
- ;~ ToolTip,% "x1 : " x1 " " x2 " : x2 `n" "y1 : " y1 " " y2 " : y2 `n"pos(y2)
- ToolTip,% pos(y2)
- MouseGetPos,x2,y2
- key:=GetKeyState("lbutton")
- if(key==1 and ( x1<>x2 or y1<>y2 )){
- x1:=x2
- y1:=y2
- mass_x.Insert(x1)
- mass_y.Insert(y1)
- }
- gosub update
- }
- a::
- mass_x:=[]
- mass_y:=[]
- return
- update:
- Gdip_FillRectangle(g, pBrush5, 0, 0, game.w, game.h)
- gosub lay
- for i,value in mass_x {
- Gdip_FillEllipse(g, pBrush7, value, mass_y[i], 2, 2)
- }
- UpdateLayeredWindow(hwndl, hdc)
- gosub dir1
- gosub dir2
- return
- lay:
- x10:=10
- x20:=350
- y10:=100
- ;~ step0:=40
- loop 4 {
- Gdip_DrawLine(g, pPen2 , x10, y10, x20, y10)
- y10+=step0
- }
- loop 2 {
- Gdip_DrawLine(g, pPen1 , x10, y10, x20, y10)
- y10+=step0
- }
- return
- ;~ loop {
- ;~ key:=GetKeyState("lbutton")
- ;~ if(key==0)
- ;~ continue
- ;~ ToolTip,1
- ;~ MouseGetPos,x1,y1
- ;~ loop {
- ;~ key:=GetKeyState("lbutton")
- ;~ if(key==0){
- ;~ ToolTip,0
- ;~ Sleep 150
- ;~ MouseGetPos,x2,y2
- ;~ Gdip_DrawLine(g, pPen1 , x1, y1, x2, y2)
- ;~ UpdateLayeredWindow(hwndl, hdc)
- ;~ ToolTip
- ;~ break
- ;~ }
- ;~ }
- ;~ }
- GuiClose:
- GuiEscape:
- *x::
- Gdip_Shutdown(pToken)
- ExitApp
- dir1:
- dir1_x:=sg(mass_x[8]-mass_x[1])
- dir1_y:=sg(mass_y[8]-mass_y[1])
- (dir1_x = 1 and dir1_y = -1)?(dir1:=1):(dir1_x = -1 and dir1_y = -1)?(dir1:=2):(dir1_x = -1 and dir1_y = 1)?(dir1:=3):(dir1_x = 1 and dir1_y = 1)?(dir1:=4)
- ;~ MsgBox,% dir1
- return
- dir2:
- max:=mass_x.MaxIndex()
- dir1_x:=sg(mass_x[max]-mass_x[max-3])
- dir1_y:=sg(mass_y[max]-mass_y[max-3])
- (dir1_x = 1 and dir1_y = -1)?(dir2:=1):(dir1_x = -1 and dir1_y = -1)?(dir2:=2):(dir1_x = -1 and dir1_y = 1)?(dir2:=3):(dir1_x = 1 and dir1_y = 1)?(dir2:=4)
- ;~ MsgBox,% dir2
- return
- sg(x){
- if(x=0)
- return 0
- return abs(x)/x
- }
- pos(y){
- y10:=100
- val:=abs(4*step0+y10-y)//step0
- return val
- }
- f::
- find_out()
- return
- find_out(){
- comp1:=dir1
- comp2:=dir2
- comp3:=pos(mass_y[1])
- comp4:=pos(mass_y[mass_y.MaxIndex()])
- comp5:=0
- (mass_x[mass_x.MaxIndex()]-mass_x[1] > 0 )?(comp5:=1)
- comp=%comp1%%comp2%%comp3%%comp4%%comp5%
- for i,value in cba {
- if(value = comp ){
- MsgBox,% abc[i]
- return abc[i]
- }
- }
- MsgBox,% comp
- SoundBeep,,250
- }
- 1::
- gosub dir1
- return
- 2::
- gosub dir2
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement