need help with my multi script

Ask gaming related questions (AHK v1.1 and older)
otylerhd
Posts: 6
Joined: 06 Jul 2020, 10:45

need help with my multi script

11 Aug 2020, 18:17

i built a script with mulitlple modes, 1-4 so far. i need help with my tooltip when i press say 1 i gotta press it twice for my tooltip to show up and same thing thru 1-4, and also if someone could look at my adjustable no recoil script, it works fine on its own but since i have everything in one script it stop working as good, i need help removing the suspend off the norecoil part when ever i remove it it stops working

Code: Select all

#NoEnv
SetWorkingDir %A_ScriptDir%
#SingleInstance force
#MaxThreadsBuffer on
SetTitleMatchMode, 2
;#IfWinActive r5apex.exe
SetBatchLines -1						;removes default 10ms delay between lines
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#KeyHistory 0
ListLines Off
SetKeyDelay, -1, -1
SetMouseDelay, -1
SetDefaultMouseSpeed, 0
SetWinDelay, -1

*1::CADMode = 1

*2::CADMode = 2

*3::CADMode = 3

*4::CADMode = 4
#If (CADMode = 1)
1::
ttflagw1 = ((ttflagw1 +1) & 1)
if (ttflagw1)
ToolTip, Dropshot, 200, 2000
SetTimer RemoveToolTip, 300
*~$LButton::
KeyWait, LButton, T0.20
If (ErrorLevel)
{
  while GetKeyState("LButton")
  {
  ; if not GetKeyState("q")
Send, {ctrl}
KeyWait, LButton
Send, {ctrl}
  }
}
return


; Mode #2
#If (CADMode = 2)
2::
ttflagw1 = ((ttflagw1 +1) & 1)
if (ttflagw1)
   ToolTip, RapidFire, 200, 2000
SetTimer RemoveToolTip, 300

*~$LButton::
Loop
{
SetMouseDelay 20
Click
If (GetKeyState("LButton","P")=0)
Break
}

; Mode #3
#If (CADMode = 3)
    _nr := False
    Compensation = 1
    _compVal = 1 ; Compensation value

    ~LButton::norecoil()  ; Left Trigger
    ~3::
  Suspend
SetTimer RemoveToolTip, 1
  Pause ,,1
SetTimer RemoveToolTip, 3000
  if A_IsPaused {
ToolTip, Recoil/OFF, 200, 2000 ,
return
SetTimer RemoveToolTip, 1
  } else {
    ToolTip, Recoil/ON, 200, 2000
    SetTimer RemoveToolTip, 1000
  }
     
    _nr := ! _nr ; dont touch
    return
     
     
     
    norecoil()
    {
        global 
        if _nr
        {
            Loop{
                if Compensation = 1 
                if GetKeyState("LButton", "P")
                {
                    mouseXY(0, _compVal)
                    Sleep 30
                    mouseXY(0, _compVal)
                    Sleep 50
                }
                else
                break
            } ;; loop
        } ;; if
    } ;; norecoil()
     

    mouseXY(x,y)
    {
      DllCall("mouse_event",uint,1,int,x,int,y,uint,0,int,0)
    }
     
    ToolTip(Text)
    {
     
      ToolTip, %Text%, xPos, yPos
      SetTimer, RemoveToolTip, 1300
      return
      RemoveToolTip:
      SetTimer, RemoveToolTip, Off
      ToolTip
      Return
    }
     
    ~NumpadAdd:: ; Adds compensation.
      _compVal := _compVal + 1
      ToolTip("more " . _compVal)
    Return
     
    ~NumpadSub:: ; Substracts compensation.
    if _compVal > 0
    {
      _compVal := _compVal - 1
      ToolTip("less " . _compVal)
     }
    return

    ~*$LButton::
    Loop
    {
    GetKeyState, state, Lbutton, P
    if state=u
    break
    mouseXY(1,1)
    sleep 1
    mouseXY(Slider,1)
    sleep 1
    mouseXY(Slider,-1)
    sleep 1
    mouseXY(-1,0)
    sleep 1
    mouseXY(Slider,1)
    sleep 1
    mouseXY(Slider,-1)
    sleep 1
    }
    return
    mouseXY(x,y)

#If (CADMode = 4)
4::
ttflagw1 = ((ttflagw1 +1) & 1)
if (ttflagw1)
   ToolTip, OFF, 200, 2000
SetTimer RemoveToolTip, 300
Last edited by gregster on 11 Aug 2020, 18:24, edited 1 time in total.
Reason: [Code] tags added; topic moved to 'Games' subforum.
otylerhd
Posts: 6
Joined: 06 Jul 2020, 10:45

Re: need help with my multi script

12 Aug 2020, 19:32

i got it sorted out other then the tool tip part i have to either hold down the hotkey or click it twice for the tooltip to pop up if someone could help me figure it out that be awesome thanks, also how can i make the tool tip color green and red rather then black and white

Code: Select all

#NoEnv
SetWorkingDir %A_ScriptDir%
#SingleInstance force
#MaxThreadsBuffer on
SetTitleMatchMode, 2
;#IfWinActive r5apex.exe
SetBatchLines -1						;removes default 10ms delay between lines
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#KeyHistory 0
ListLines Off
SetKeyDelay, -1, -1
SetMouseDelay, -1
SetDefaultMouseSpeed, 0
SetWinDelay, -1

numpad1::CADMode = 1

numpad2::CADMode = 2

numpad3::CADMode = 3

numpad4::CADMode = 4
#If (CADMode = 1)
numpad1::
ttflagw1 = ((ttflagw1 +1) & 1)
if (ttflagw1)
ToolTip, Dropshot, 200, 2000
SetTimer RemoveToolTip, 300
*~$LButton::
KeyWait, LButton, T0.20
If (ErrorLevel)
{
  while GetKeyState("LButton")
  {
  ; if not GetKeyState("q")
Send, {ctrl}
KeyWait, LButton
Send, {ctrl}
  }
}
return


; Mode #2
#If (CADMode = 2)
numpad2::
ttflagw1 = ((ttflagw1 +1) & 1)
if (ttflagw1)
   ToolTip, RapidFire, 200, 2000
SetTimer RemoveToolTip, 300

*~$LButton::
Loop
{
SetMouseDelay 20
Click
If (GetKeyState("LButton","P")=0)
Break
}
return

; Mode #3
#If (CADMode = 3)
numpad3::
ttflagw1 = ((ttflagw1 +1) & 1)
if (ttflagw1)
ToolTip, NoRecoil, 200, 2000
SetTimer RemoveToolTip, 300
    _nr := true
    Compensation = 1
    _compVal = 1 ; Compensation value

    ~LButton::norecoil()  ; Left Trigger
    
_nr := ! _nr ; dont touch
    return
     
     
     
    norecoil()
    {
        global 
        if _nr
        {
            Loop{
                if Compensation = 1 
                if GetKeyState("LButton", "P")
                {
                    mouseXY(0, _compVal)
                    Sleep 30
                    mouseXY(0, _compVal)
                    Sleep 50
                }
                else
                break
            } ;; loop
        } ;; if
    } ;; norecoil()
     

    mouseXY(x,y)
    {
      DllCall("mouse_event",uint,1,int,x,int,y,uint,0,int,0)
    }
     
    ToolTip(Text)
    {
     
      ToolTip, %Text%, xPos, yPos
      SetTimer, RemoveToolTip, 1300
      return
      RemoveToolTip:
      SetTimer, RemoveToolTip, Off
      ToolTip
      Return
    }
     
    ~NumpadAdd:: ; Adds compensation.
      _compVal := _compVal + 1
      ToolTip("more " . _compVal)
    Return
     
    ~NumpadSub:: ; Substracts compensation.
    if _compVal > 0
    {
      _compVal := _compVal - 1
      ToolTip("less " . _compVal)
     }
    return

    ~*$LButton::
    Loop
    {
    GetKeyState, state, Lbutton, P
    if state=u
    break
    mouseXY(1,1)
    sleep 1
    mouseXY(Slider,1)
    sleep 1
    mouseXY(Slider,-1)
    sleep 1
    mouseXY(-1,0)
    sleep 1
    mouseXY(Slider,1)
    sleep 1
    mouseXY(Slider,-1)
    sleep 1
    }
    return
    mouseXY(x,y)

#If (CADMode = 4)
numpad4::
ttflagw1 = ((ttflagw1 +1) & 1)
if (ttflagw1)
   ToolTip, OFF, 200, 2000
SetTimer RemoveToolTip, 300
Last edited by gregster on 12 Aug 2020, 19:34, edited 1 time in total.
Reason: [Code] tags added. Please use them. Thank you!
imNotTupid
Posts: 31
Joined: 29 Jul 2020, 23:07

Re: need help with my multi script

12 Aug 2020, 20:29

I would move each tooltip to your first hotkey call. This will eliminate you having to press/call numpad twice.

Code: Select all

numpad1::
CADMode = 1
ToolTipColor("Black", "Red")
ToolTip, Dropshot, 200, 2000
SetTimer RemoveToolTip, 300
return

numpad2::
In order to change tooltip colors you need to add the following to your script. Just add to the bottom. You change colors by 6 digit RGB if you want more custom colors.

Code: Select all

ToolTipFont(Options := "", Name := "", hwnd := "") {
    static hfont := 0
    if (hwnd = "")
        hfont := Options="Default" ? 0 : _TTG("Font", Options, Name), _TTHook()
    else
        DllCall("SendMessage", "ptr", hwnd, "uint", 0x30, "ptr", hfont, "ptr", 0)
}
 
ToolTipColor(Background := "", Text := "", hwnd := "") {
    static bc := "", tc := ""
    if (hwnd = "") {
        if (Background != "")
            bc := Background="Default" ? "" : _TTG("Color", Background)
        if (Text != "")
            tc := Text="Default" ? "" : _TTG("Color", Text)
        _TTHook()
    }
    else {
        VarSetCapacity(empty, 2, 0)
        DllCall("UxTheme.dll\SetWindowTheme", "ptr", hwnd, "ptr", 0
            , "ptr", (bc != "" && tc != "") ? &empty : 0)
        if (bc != "")
            DllCall("SendMessage", "ptr", hwnd, "uint", 1043, "ptr", bc, "ptr", 0)
        if (tc != "")
            DllCall("SendMessage", "ptr", hwnd, "uint", 1044, "ptr", tc, "ptr", 0)
    }
}
 
_TTHook() {
    static hook := 0
    if !hook
        hook := DllCall("SetWindowsHookExW", "int", 4
            , "ptr", RegisterCallback("_TTWndProc"), "ptr", 0
            , "uint", DllCall("GetCurrentThreadId"), "ptr")
}
 
_TTWndProc(nCode, _wp, _lp) {
    Critical 999
   ;lParam  := NumGet(_lp+0*A_PtrSize)
   ;wParam  := NumGet(_lp+1*A_PtrSize)
    uMsg    := NumGet(_lp+2*A_PtrSize, "uint")
    hwnd    := NumGet(_lp+3*A_PtrSize)
    if (nCode >= 0 && (uMsg = 1081 || uMsg = 1036)) {
        _hack_ = ahk_id %hwnd%
        WinGetClass wclass, %_hack_%
        if (wclass = "tooltips_class32") {
            ToolTipColor(,, hwnd)
            ToolTipFont(,, hwnd)
        }
    }
    return DllCall("CallNextHookEx", "ptr", 0, "int", nCode, "ptr", _wp, "ptr", _lp, "ptr")
}
 
_TTG(Cmd, Arg1, Arg2 := "") {
    static htext := 0, hgui := 0
    if !htext {
        Gui _TTG: Add, Text, +hwndhtext
        Gui _TTG: +hwndhgui +0x40000000
    }
    Gui _TTG: %Cmd%, %Arg1%, %Arg2%
    if (Cmd = "Font") {
        GuiControl _TTG: Font, %htext%
        SendMessage 0x31, 0, 0,, ahk_id %htext%
        return ErrorLevel
    }
    if (Cmd = "Color") {
        hdc := DllCall("GetDC", "ptr", htext, "ptr")
        SendMessage 0x138, hdc, htext,, ahk_id %hgui%
        clr := DllCall("GetBkColor", "ptr", hdc, "uint")
        DllCall("ReleaseDC", "ptr", htext, "ptr", hdc)
        return clr
    }
}
otylerhd
Posts: 6
Joined: 06 Jul 2020, 10:45

Re: need help with my multi script

14 Aug 2020, 19:12

awesome thank you very much for you help, i appreciate it alot, worked perfectly same with the color
otylerhd
Posts: 6
Joined: 06 Jul 2020, 10:45

Re: need help with my multi script

14 Aug 2020, 19:26

how would i combine the rapid fire script with the norecoil script? i tried but it works but slows the rapidfire and makes the mouse move down go skippy like its clicking in between each time it moves the mouse down

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 37 guests