Help with dropdownlist variables.

Ask gaming related questions (AHK v1.1 and older)
axo
Posts: 32
Joined: 10 May 2022, 10:50

Help with dropdownlist variables.

Post by axo » 02 Jul 2022, 11:50

Code: Select all

#NoEnv
#SingleInstance, Force
#Persistent
#InstallKeybdHook
#UseHook
#KeyHistory, 0
#HotKeyInterval 1
#MaxHotkeysPerInterval 127
SetKeyDelay,-1, -1
SetControlDelay, -1
SetMouseDelay, -1
SetWinDelay,-1
SendMode, InputThenPlay
SetBatchLines,-1
ListLines, Off
CoordMode, Pixel, screen
 
 
DllCall("QueryPerformanceFrequency", "Int64*", freq)
FlickBefore := 0
 
 
aim_key := "xbutton2" ;List of Keys: https://www.autohotkey.com/docs/KeyList.htm
 
game_sens := 0.31 ;Game sens
game_fov  := 103 ;Game fov
game_fps  := 84 ;Display refresh rate
 
 
;use this tool and set sensitivity and dpi to 1, then copy In/360 value https://gamingsmart.com/mouse-sensitivity-converter
;Apex Legends: 16363.64
;CSGO: 16363.64
;Halo Infinite: 17454.6
full360 := 16363.64/game_sens ;Modify it to the value of the corresponding game
 
EMCol := 0x ;Enemy color
ColVn := 10 ;Variation
OffsetX := 0
OffsetY := 4
ZeroX := Floor(%ResolutionHeight% // 2) - OffsetX
ZeroY := Floor(%ResolutionWidth% // 2) - OffsetY
CFovX := deg2coord(2, game_fov, %ResolutionHeight%, %ResolutionWidth%) ;aimbot fov x. range: 0 ~ game_fov/2
CFovY := deg2coord(2, game_fov, %ResolutionHeight%, %ResolutionWidth%) ;aimbot fov y. range: 0 ~ game_fov/2
SpeedX := 0.13 ;aimbot speed. range: 0 ~ 1
SpeedY := 0.13 ;aimbot speed. range: 0 ~ 1
ScanL := ZeroX - CFovX
ScanT := ZeroY - CFovY
ScanR := ZeroX + CFovX
ScanB := ZeroY + CFovY
 
 
Loop {
    KeyWait, %aim_key%, D
    AimPixel := _PixelSearch(ScanL, ScanT, ScanR, ScanB, EMCol, ColVn)
    if (!ErrorLevel) {
        AimX := AimPixel[1] - ZeroX
        ,AimY := AimPixel[2] - ZeroY
        ,MoveX := Floor(coord2deg(AimX, game_fov, %ResolutionHeight%, %ResolutionWidth%) * (full360/360) * SpeedX)
        ,MoveY := Floor(coord2deg(AimY, game_fov, %ResolutionHeight%, %ResolutionWidth%) * (full360/360) * SpeedY)
        DllCall("QueryPerformanceCounter", "Int64*", FlickAfter)
        if ((FlickAfter-FlickBefore)/freq*1000 >= 1000/game_fps) {
            DllCall("QueryPerformanceCounter", "Int64*", FlickBefore)
            DllCall("mouse_event", "uint", 0x0001, "uint", MoveX, "uint", MoveY, "uint", 0, "int", 0)
        }
    }
}
 
;full360 test
/*
F::
DllCall("mouse_event", "uint", 0x0001, "uint", 6666, "uint", 0, "uint", 0, "int", 0)
return
*/
 
_PixelSearch(X1, Y1, X2, Y2, ColorID, Variation:=0) {
    PixelSearch, OutputVarX, OutputVarY, X1, Y1, X2, Y2, ColorID, Variation, Fast RGB
    Return [OutputVarX, OutputVarY]
}
 
deg2rad(degrees) {
    return degrees * ((4*ATan(1)) / 180)
}
 
rad2deg(radians) {
    return radians * (180 / (4*ATan(1)))
}
 
coord2deg(delta, fov, winwidth, winheight) {
    ;lookAt := delta * 2 / winwidth
    ;return rad2deg(atan(lookAt*tan(deg2rad(fov*0.5)))) ;degrees
    return rad2deg(atan(((delta<<1)/winwidth)*tan(deg2rad(fov*0.5))))
}
 
deg2coord(delta, fov, winwidth, winheight) {
    return winwidth*0.5/tan(deg2rad(fov*0.5))*tan(deg2rad(delta))
}
 
 
 
F6::reload
F7::Exitapp


I want a lil gui like this:

Code: Select all

Gui, Add, DropDownList,x1 y1 w150 vResolutionHeight, 1920|1440|1280|1280
Gui, Add, DropDownList,x1 y50 w150 vResolutionWidth, 1080|1080|1024|960
gui, add, button, x1 y90 gselect, select
gui, show
return

select:
Gui, Submit
return
And i want to select the resolution hight and width when i start the script and then the resolution hight and width will apply like in the script, but when i press button select it doesnt work. Please help me with it.
In the script you can find %ResolutionHeight% and %ResolutionWidth% but it simply doesnt want to work D:
Last edited by BoBo on 02 Jul 2022, 12:02, edited 1 time in total.

BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Help with dropdownlist variables.

Post by BoBo » 02 Jul 2022, 12:10

Code: Select all

Gui, Add, DropDownList,x1 y1 w150 vResolutionHeight, 1920||1440|1280
Gui, Add, DropDownList,x1 y50 w150 vResolutionWidth, 1080||1024|960
gui, add, button, x1 y90 gselect, select
gui, show,, DDLBuzzer
return

select:
Gui, Submit, NoHide
MsgBox % "You've selected: `t" ResolutionHeight "/" ResolutionWidth	; expression style
MsgBox You've selected:`t %ResolutionHeight%/%ResolutionWidth%	; legacy style
return

axo
Posts: 32
Joined: 10 May 2022, 10:50

Re: Help with dropdownlist variables.

Post by axo » 02 Jul 2022, 12:20

yea but how to use it in script .. so it will be there:

ZeroX := Floor(%ResolutionHeight% // 2) - OffsetX
ZeroY := Floor(%ResolutionWidth% // 2) - OffsetY
CFovX := deg2coord(2, game_fov, %ResolutionHeight%, %ResolutionWidth%) ;aimbot fov x. range: 0 ~ game_fov/2
CFovY := deg2coord(2, game_fov, %ResolutionHeight%, %ResolutionWidth%) ;aimbot fov y. range: 0 ~ game_fov/2
.....
,MoveX := Floor(coord2deg(AimX, game_fov, %ResolutionHeight%, %ResolutionWidth%) * (full360/360) * SpeedX)
,MoveY := Floor(coord2deg(AimY, game_fov, %ResolutionHeight%, %ResolutionWidth%) * (full360/360) * SpeedY)

u see there is %ResolutionHeight% and %ResolutionWidth% but it dont work (look at the first script i sent)

BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Help with dropdownlist variables.

Post by BoBo » 02 Jul 2022, 12:40

(look at the first script i sent)
Regarding which you haven't said a single word :roll:

You're setting the variables wrong within functions. Check out AHK's help about legacy vs. expression style:
https://www.autohotkey.com/docs/Variables.htm

axo
Posts: 32
Joined: 10 May 2022, 10:50

Re: Help with dropdownlist variables.

Post by axo » 02 Jul 2022, 13:00

so it should be like this ... without %

Code: Select all

ZeroX := Floor(ResolutionWidth // 2) - OffsetX
ZeroY := Floor(Resolutionheight // 2) - OffsetY
CFovX := deg2coord(2, game_fov, ResolutionWidth, ResolutionHeight) ;aimbot fov x. range: 0 ~ game_fov/2
CFovY := deg2coord(2, game_fov, ResolutionWidth, ResolutionHeight) ;aimbot fov y. range: 0 ~ game_fov/2
,MoveX := Floor(coord2deg(AimX, game_fov, ResolutionWidth, ResolutionHeight) * (full360/360) * SpeedX)
,MoveY := Floor(coord2deg(AimY, game_fov, ResolutionWidth, ResolutionHeight) * (full360/360) * SpeedY)
but it still dont work but when i type the height and width myself it works like this:

Code: Select all

ZeroX := Floor(1920 // 2) - OffsetX
ZeroY := Floor(1080 // 2) - OffsetY
CFovX := deg2coord(2, game_fov, 1080, 1920) ;aimbot fov x. range: 0 ~ game_fov/2
CFovY := deg2coord(2, game_fov, 1080, 1920) ;aimbot fov y. range: 0 ~ game_fov/2
,MoveX := Floor(coord2deg(AimX, game_fov, 1080, 1920) * (full360/360) * SpeedX)
,MoveY := Floor(coord2deg(AimY, game_fov, 1080, 1920) * (full360/360) * SpeedY)
now it work when i type it myself but idk how can i do it with variables

Post Reply

Return to “Gaming Help (v1)”