'분류 전체보기'에 해당되는 글 117건

  1. 2024.07.08 오토핫키 디아4 매크로(헬퍼)
풋볼데이/매크로2024. 7. 8. 01:33

애초에 배포 목적으로 만든 건 아니라, 컨버팅 시키진 않고, AHK로 실행.

혹시 사용할 사람이 있다면, 메모장에 붙여넣고, 확장자를 txt가 아닌, ahk로 저장하고 실행하면 됨.

본인의 키세팅이 다를 확률이 매우 높으므로, 코드 수정 없이 그대로 실행할 경우, 원하는 대로 작동되기 어려움.

(본인이 원하는 바가 있다면, 직접 GPT4o 혹은, 클로드를 이용하여 만드는 방법을 추천)

 

내 경우엔, 출혈먼지소용돌이에, 함성스킬 1,3,4 돌진 2, 강철 5, 소용돌이6&우클릭)으로 세팅.

일반모드에서는, 1,3,4,5만 계속 눌러주고,

보스 모드에서는, 일반모드와 동일 하지만, 좌클릭도 끊어서 반복적으로 눌러줌.

 

무한화보 화염탄의 일반 모드 경우는,

3(화염보호막), 4(화염탄)를 계속 눌러주며,

스페이스바를 누르면 그 직후 파이어월을 사용하는 것으로,

보스 모드에서는, 8초간격으로 2(파이어월)를 지속적으로 눌러주도록 함.

이 방법은, 지옥물결의 첨탑, 여제에서도 유효하게 쓰임.

 

GUI가 없기 때문에, 오직 핫키로만 조작 가능하며, 좌측 상단에 상태창이 툴팁으로 나타남.

 

핫키는 다음과 같음.

 

F1::캐릭터 변경(야만전사/화염술사

F2::일반 모드 실행

야만전사(1,3,4,5 반복)

화염술사(

F3::보스 모드 실행

F4::정지

F6::종료

F9::재실행

 

이 코드는 99% 클로드3.5 소넷으로 작성 됨.

 

 

 

#NoEnv
#Persistent
SetWorkingDir %A_ScriptDir%

; Initialize variables
global currentCharacter := "None"
global is4Pressed := false
global macroRunning := false
global activeHotkey := ""
global spacebarEnabled := false
global countdownTime := 8000

; Initial setup
UpdateTooltips() 

; Function to update tooltips
UpdateTooltips() {
    if (currentCharacter = "A") {
        ToolTip, Current Mode: Whirlwind Barbarian, 10, 10, 4
    } else if (currentCharacter = "B") {
        ToolTip, Current Mode: Firewall Firebolt Sorceress, 10, 10, 4
    } else {
        ToolTip, Current Mode: None Selected, 10, 10, 4
    }
    
    if (macroRunning) {
        ToolTip, Status: Macro Running (%activeHotkey%), 10, 40, 2
    } else {
        ToolTip, Status: Macro Stopped, 10, 40, 2
    }

    ; Remove countdown tooltip if macro is not running or active hotkey is not F3
    if (!macroRunning or activeHotkey != "F3") {
        ToolTip,,,3
    }
}

; Main hotkey for both characters
F2::
    if (currentCharacter = "A") {
        if (!macroRunning) {
            SetTimer, MacroA, 150
            macroRunning := true
            activeHotkey := "F2"
            spacebarEnabled := false
        }
    } else if (currentCharacter = "B") {
        if (!macroRunning) {
            Send, {5}{2}  ; Press 5 and 2 immediately
            SetTimer, MacroB, 50
            Send, {4 down}
            is4Pressed := true
            macroRunning := true
            activeHotkey := "F2"
            spacebarEnabled := true
        }
    }
    UpdateTooltips()
return

; Additional hotkey for both characters
F3::
    if (currentCharacter = "A" and !macroRunning) {
        SetTimer, MacroA, 150
        SetTimer, RightClick, 10
        macroRunning := true
        activeHotkey := "F3"
        spacebarEnabled := false
    } else if (currentCharacter = "B" and !macroRunning) {
        Send, {5}{2}  ; Press 5 and 2 immediately
        SetTimer, MacroB, 50
        SetTimer, MacroB2, 8000
        SetTimer, UpdateCountdown, 100
        Send, {4 down}
        is4Pressed := true
        macroRunning := true
        activeHotkey := "F3"
        spacebarEnabled := false
        countdownTime := 8000
    }
    UpdateTooltips()
return

; Stop macros
F4::
    StopAllMacros()
    UpdateTooltips()
return

; Macros
MacroA:
    SendInput, {1}
    SendInput, {3}
    SendInput, {4}
    SendInput, {5}
return

MacroB:
    SendInput, {3}
return

MacroB2:
    SendInput, {2}
    countdownTime := 8000
return

RightClick:
    Click, right
return

; Character switch hotkey
F1::
    if (currentCharacter = "A") {
        currentCharacter := "B"
    } else {
        currentCharacter := "A"
    }
    StopAllMacros()
    UpdateTooltips()
return

; Exit script
F6::
    ToolTip,,,,4
    ToolTip,,,,2
    ToolTip,,,,3
    ExitApp
return

; Function to stop all macros
StopAllMacros() {
    SetTimer, MacroA, Off
    SetTimer, MacroB, Off
    SetTimer, MacroB2, Off
    SetTimer, RightClick, Off
    SetTimer, UpdateCountdown, Off
    if (is4Pressed) {
        Send, {4 up}
        is4Pressed := false
    }
    macroRunning := false
    activeHotkey := ""
    spacebarEnabled := false
    ToolTip,,,,3
}

; Spacebar hotkey for Sorceress F2 mode
$Space::
    if (currentCharacter = "B" and spacebarEnabled) {
        Send, {Space}{2}
    } else {
        Send, {Space}
    }
return

; Function to update countdown
UpdateCountdown:
    if (macroRunning and activeHotkey == "F3") {
        countdownTime -= 100
        if (countdownTime < 0) {
            countdownTime := 0
        }
        remainingSeconds := countdownTime / 1000
        remainingSecondsFormatted := RegExReplace(remainingSeconds, "\.?0+$", "")
        ToolTip, Next 2 key press in %remainingSecondsFormatted% s, 10, 70, 3
    } else {
        ToolTip,,,3
    }
return
F9::reload

Posted by nOne2