help with variables

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

help with variables

Post by axo » 02 Jul 2022, 13:45

i have this in my code:

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
return

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 can see here %ResolutionHeight% and %ResolutionWidth% are variables from dropdownlist
but when i press "select" button the variables in script dont apply
why ? can u please change the script so it would work
when i type the %ResolutionHeight% and %ResolutionWidth% myself 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)
its working but i dont want to type it myself i want to select it in dropdownlist pls help D:

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

Re: help with variables

Post by axo » 02 Jul 2022, 13:46

the whole code :

Code: Select all

Gui, Add, DropDownList,x1 y1 w150 vVar1 , 1920||1440|1280
Gui, Add, DropDownList,x1 y50 w150 vVar2 , 1080||1024|960
gui,add,button, x1 y80 gselect, select
gui, show,, DDLBuzzer
return

select:
Gui, Submit, nohide
return

Var1 := 1920
Var2 := 1080

#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(Var2  // 2) - OffsetX
ZeroY := Floor(Var1 // 2) - OffsetY
CFovX := deg2coord(2, game_fov, Var2, Var1) ;aimbot fov x. range: 0 ~ game_fov/2
CFovY := deg2coord(2, game_fov, Var2, Var1) ;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, Var2, Var1) * (full360/360) * SpeedX)
        ,MoveY := Floor(coord2deg(AimY, game_fov, Var2, Var1) * (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
 
 

User avatar
boiler
Posts: 16768
Joined: 21 Dec 2014, 02:44

Re: help with variables

Post by boiler » 02 Jul 2022, 13:49

The % symbols don’t belong around your variables in an expression, except for a special purpose that you are not implementing here.

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

Re: help with variables

Post by axo » 02 Jul 2022, 14:16

but when i removed it it still doesnt work can u show it to me how to do it ?

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

Re: help with variables

Post by axo » 02 Jul 2022, 14:26

@boiler
ok i have it "D

Post Reply

Return to “Gaming Help (v1)”