viewing paste Unknown #7283 | Autohotkey

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598
; @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
; @@@@@@@@@@@@@@@@@@@@@@@@@ BEFORE RUNNING @@@@@@@@@@@@@@@@@@@@@
; @@@@@@@@@@@@@@@@@@@@@@@@@ READ THIS SHIT @@@@@@@@@@@@@@@@@@@@@
; @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 
;
; @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
; @@@ before starting, Ctrl+F for every instance of Send/ControlSend
; @@@ update the hotkeys to the hotkeys you have set
; @@@ also, F1 assumes @go savepoint is your preferred location, if
; @@@ you use a different key, set that as necessary
; @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
;
; @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
; @@ STEP 1 @@
;     zoom however you want to zoom. THEN NEVER FUCK WITH IT
;     (or else shit will be super fucked)
;     the search works by first finding mobs near your char, a narrow search first
;     after that if it finds no poring, it will do a wider search
;     if it fails to find them it'll teleport
;
; @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
; @@ STEP 2 @@
;   set the boundaries of each search this way:
;     TOP LEFT NARROW    -> ctrl+1
;     BOTTOM RIGHT NARROW -> ctrl+2
;     TOP LEFT WIDE     -> ctrl+3
;     BOTTOM RIGHT WIDE -> ctrl+4
;
;     TOP LEFT of HP/SP info     -> ctrl+5
;     BOTTOM RIGHT of HP/SP info -> ctrl+6
;
;     BLACK FLY WING IN A HOTKEY BAR -> ctrl+7
;   see http://i.imgur.com/HoOge.jpg for visual instructions
;
; @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
; @@ STEP 3 @@ (if any of these is desired, do their steps)
;
;   if you use these chars, be sure that they are all placed and zoomed in the exact same way as your main client, or they will fail to heal
;
;     alt tab to clown   -> win+c
;     alt tab to gypsy   -> win+g
;     alt tab to paladin -> win+p
;
; @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
; @@ STEP 4 @@
;     hover mouse over healer -> win+h
;     hover mouse over warper -> win+w
;     hover mouse over tooldealer -> win+t
;     hover mouse over buy button to open tooldealer -> win+b
;     hover mouse over down arrow in the dealer -> win+d
;
; @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
; @@ STEP 5 @@
;     set your last warp to the desired destination
;
; @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
; @@ STEP 6 @@
;     start off in town and press Home and it'll work :D
;
; @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
; @@  OTHER NOTES:  
;     make sure you check the variables for configuration at the start
;     of the script. if you use a min texture grf you can turn the map
;     change delay to 1000 ms or so.
;     try to keep it high so that if you lag and you don't fuck yourself :D
;
; @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
; IF YOU WISH TO PAUSE AT ANY TIME, PRESS End AND IT WILL PAUSE. 
; HOWEVER! Be sure to resume from the same step you were on
; @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 
^1::
{
    MouseGetPos tl_n_xpos, tl_n_ypos
    return 
}
^2::
{
    MouseGetPos br_n_xpos, br_n_ypos
    return
}
^3::
{
    MouseGetPos tl_w_xpos, tl_w_ypos
    return
}
^4::
{
    MouseGetPos br_w_xpos, br_w_ypos
    return
}
^5::
{
    MouseGetPos tl_bar_xpos, tl_bar_ypos
    return
}
^6::
{
    MouseGetPos br_bar_xpos, br_bar_ypos
    return
}
^7::
{
    MouseGetPos fwing_xpos, fwing_ypos
    purchaseWings := 1
    return
}
 
^8::
{
    MouseGetPos tl_inventory_xpos, tl_inventory_ypos
    return
}
^9::
{
    MouseGetPos br_inventory_xpos, br_inventory_ypos
    return
}
 
#H:: ; healer position
{
    MouseGetPos hxpos, hypos
    return
}
#W:: ; the location you drop your warp portal to morroc
{
    MouseGetPos wxpos, wypos
    return
}
#T:: ; the tool dealer location
{
    MouseGetPos txpos, typos
    return
}
#B:: ; the buy button location
{
    MouseGetPos bxpos, bypos
    return
}
#D:: ; the down arrow shit
{
    MouseGetPos dxpos, dypos
    return
}
 
 
 
Home::
{
    WinGet mPID, PID, A
    SetKeyDelay -1
    SetControlDelay -1
    SetMouseDelay -1
    
    ; time spent (in ms) waiting for maps to load
    mapChangeDelay := 2000
    ; time between sending stuff to npc
    npcDelay := 700
    ; your aspd delay
    aspdDelay := 600        
    
    ; return time to town (brotip: agi/bless last 240000, so i do 235000)
    returnTime := 235000
    
    ; amoutn of times to press enter to get to the last warp
    lastWarpEnterCount := 3
    
    ; set to >0 so your char buys fly wings
    purchaseWings := 99
    
    ; set to 1 to reheal after buffing
    rehealAfterBuffs := 1
    
    ; how many times to re-up the skills of each class before healing
    clownUsesBeforeHeal := 15
    gypsyUsesBeforeHeal := 15
    pallyUsesBeforeHeal := 10
    
    ; if using riff, 120000
    ; if bragi/apples, 180000
    clownReuseTime := 180000
    
    ; if using service, 180000
    ; if using critsong, 120000
    gypsyReuseTime := 180000
    
    ; gospel has a timer of 60 seconds so this shouldn't require changing
    pallyReuseTime := 60000
    
    ; irrelevant if no clown is setup
    ; 0 = only use 1 song
    ; 1 = flash between 2 songs
    ; 2 = flash between 3 songs
    multiClown := 0
    
    ; jokers = 0x8894F9
    ; porings = 0x8C94FF
    searchColor := 0x8C94FF
    
    ; jokers = 5
    ; porings = 0
    searchTolerance := 0
    
    ; internal, do not change
    clownUsages := 0
    gypsyUsages := 0
    paladinUsages := 0
    mapAddr := 0x814290
    weightMaxAddr := 0x83C54C
    weightCurAddr := 0x83C558
    
    maxWeight := ReadMemory(weightMaxAddr, mPID)
    
    
    loop
    {
        Sleep %mapChangeDelay%
 
        wingAttempts := 0
        ;UseHealer()
        
        ;Prebuff()
                
        ;if ( rehealAfterBuffs = 1 )
        ;{
        ;   UseHealer()
        ;}
    
        UseStorage()
        UseWarper(lastWarpEnterCount)
        
        Sleep %mapChangeDelay%
        
        
        ; you are now in your last warp area
        
        result := ReadMemory(mapAddr, mPID)
        gefeniaNum := 1701209447
        
        if ( result != gefeniaNum )
        {
            ReturnToTown()
            Continue
        }
        
        Loop
        {
        
            Sleep 100
        
        
            if ( (A_TickCount - Tick_LastBuff) >= returnTime )
            {
                ReturnToTown()
                Break
            }
            
            
            if ( CheckFlyWings() = 0)
            {
                ReturnToTown()
                BuyFlyWings(100)
                Break
            }
            
            
            if ( CheckHPSP() = 0)
            {
                ReturnToTown()
                Break
            }
            
            if ( wingAttempts >= 100)
            {
                ReturnToTown()
                Break
            }   
            else 
            {
            
            
                ; first, a nearby search of yourself
                ; i recommend 6 character widths wide and 3 character heights tall
                PixelSearch FoundX, FoundY, %tl_n_xpos%, %tl_n_ypos%, %br_n_xpos%, %br_n_ypos%, %searchColor%, %searchTolerance%, Fast  
                if ErrorLevel = 0
                {
                    Cast(FoundX, FoundY)
                    
                    if ( CheckWeight() >= 89 )
                    {
                        ReturnToTown()
                        Break
                    }
                }
                else
                {
                    ; a more wide search range. make sure no part of your ui is in range
                    PixelSearch FoundX, FoundY, %tl_w_xpos%, %tl_w_ypos%, %br_w_xpos%, %br_w_ypos%, %searchColor%, %searchTolerance%, Fast  
                    if ErrorLevel = 0
                    {
                        Cast(FoundX,  FoundY)
                        
                        if ( CheckWeight() >= 89 )
                        {
                            ReturnToTown()
                            Break
                        }
                    }
                    else        
                    {
                        ; TELEPORT
                        ControlSend ,,{F5}, ahk_pid %mPID% ; teleport hotkey
                        Sleep 1000
                        wingAttempts := wingAttempts + 1
                    }
                }
            }
            
        }
        
    }
    
    return
 
    
UseStorage()
{
    global
 
    ControlSend ,,=, ahk_pid %mPID% ; @storage hotkey
    Sleep %npcDelay%
    
    PixelSearch FoundX, FoundY, %tl_inventory_xpos%, %tl_inventory_ypos%, %br_inventory_xpos% , %br_inventory_ypos% , 0x29216B, 0, Fast  
    if ErrorLevel = 0
    {
        SetMouseDelay 20
        Sleep 100
        ;msgbox %FoundX% %FoundY%
        MouseMove %FoundX%, %FoundY%
        Sleep 1000
        MouseClickDrag L, 0, 0, 0, -300, 50, R
        
        Sleep 1000
        Send {Enter}
        Sleep %npcDelay%
        SetMouseDelay -1
        ReturnToTown()
    }
    
    return
}return
}
 
 
CheckWeight()
{
    global
    
    currentWeight := ReadMemory(weightCurAddr, mPID)
    
    return round(currentWeight * 100 / maxWeight)
}
 
ReadMemory(MADDRESS,PROGRAM)
{
    hModule := DllCall("LoadLibrary", "str", "rpm.dll")
        
    if ( A_LastError )
    {
        MsgBox Error: %A_LastError% | If this value is 193, then you need to use a 32-bit version of AutoHotkey OR rpm.dll is missing
        return -1
    }
    
    value := DllCall("rpm\getMapID", "UInt", MADDRESS, "UInt", PROGRAM)
    
    if ( A_LastError )
    {
        MsgBox Error: %A_LastError% | If this value is 193, then you need to use a 32-bit version of AutoHotkey
        return -1
    }
 
    
    DllCall("FreeLibrary", "UInt", hModule)
    return value  
}
 
CheckHPSP()
{
    global
    
    PixelSearch FoundX, FoundY, %tl_bar_xpos%, %tl_bar_ypos%, %br_bar_xpos%, %br_bar_ypos%, 0x0000FF, 0, Fast ; search in your hp/sp amount for red - eg lower than 25%
    if ErrorLevel = 0
    { 
        return 0
    }
    return 1
}
 
BuyFlyWings(amount)
{
    global
    SetMouseDelay 20
 
 
    MouseMove %txpos%, %typos%, 1 ; Tool Dealer
    Sleep 120
    Click %txpos%, %typos%
    Sleep %npcDelay%
 
    
    ; serebii-ro specific
    Send {Enter}
    Sleep %npcDelay%
    Send {Down}
    Sleep %npcDelay%
    Send {Enter}
    Sleep %npcDelay%
    Send {Enter}
    Sleep %npcDelay%
    ;
    ;MouseMove %bxpos%, %bypos% ; Buy button
    Sleep %npcDelay%
    ;Click %bxpos%, %bypos%
    ;Sleep 500
 
    MouseMove %dxpos%, %dypos%, 1 ; to click arrow down
    Sleep 120
    Loop 3
    {
        Click %dxpos%, %dypos%
        Sleep %npcDelay%
    }
    MouseMove -40, -15, 10, R
    Sleep 500
    MouseClickDrag L, 0, 0, 60, 10, 30, R ; Flywing Drag & Drop Choose amount and choose it. Make sure the y between both is CONSTANT r you will buy other shit
    Sleep 1000
    SendInput %amount%
    Sleep 500
    Send {Enter}
 
    MouseMove %dxpos%, %dypos%, 5 ; to moove mouse to arrow down key
    Sleep 300
    MouseMove 200, 25, 1, R ; to set the mouse on the buy button
    Sleep 500
    Send { Click }
    Sleep 1000
    SetMouseDelay -1
}
CheckFlyWings()
{
    global
    PixelGetColor color, %fwing_xpos%, %fwing_ypos%, 10 ; position of flywings in your hotkey bar 
    if (color = 0xFFFFFF)
    { 
        return 0
    }
    return 1
}
ReturnToTown()
{
    global
    Sleep %aspdDelay%
    ControlSend ,,{F1},ahk_pid %mPID% ;@go town hotkey --> set it to a single key (eg `), because alt sends are completely unreliable
    Sleep %mapChangeDelay%
}
 
UseWarper(lastWarpEnderCount)
{
    global
    Sleep %npcDelay%
    MouseMove %wxpos%, %wypos%
    Click %wxpos%, %wypos%
    Sleep %npcDelay%
    
    Loop %lastWarpEnderCount%
    {
        Sleep %npcDelay%
        ControlSend ,,{Enter},ahk_pid %mPID%
    }
}
 
UseHealer()
{       
    global 
    
    Sleep %npcDelay%
    MouseMove %hxpos%, %hypos%
    Click %hxpos%, %hypos%
    Sleep %npcDelay%
    Tick_LastBuff := A_TickCount
}
 
Prebuff()
{
    global 
    
    ; send skill usage just to make sure you don't get that bullshit message from the healer - likely won't matter except on the first run
    ; this also gives you songs for the first cast and such, too ! yay :D
    if ( cPID != "" or gPID = "" or pPID = "" )
    {
    
        UseHealer()
        
        ControlSend ,,{F3},ahk_pid %mPID% ; first aid
        Sleep aspdDelay + 500
    }
    
    if ( cPID && (Tick_Clown_Timeout >= (clownReuseTime-3000)) )
    {
        ControlSend ,,{J}, ahk_pid %cPID% ; attention concentrate
        Sleep 800
        
        if ( multiClown = 0)
        {
            ControlSend ,,{B}, ahk_pid %cPID% ; encore
        }
        else if ( multiClown = 1)
        {
            ControlSend ,,{G}, ahk_pid %cPID% ; cello
            Sleep 800
            ControlSend ,,{T}, ahk_pid %cPID% ; bragi
            Sleep 800
            ControlSend ,,{G}, ahk_pid %cPID% ; cello
            Sleep 800
            ControlSend ,,{T}, ahk_pid %cPID% ; riff
            Sleep 800
            
        }
        Tick_Clown_Timeout := A_TickCount
    }
    
    if ( gPID && (Tick_Gypsy_Timeout >= (gypsyReuseTime-3000)) )
    {
        
        ControlSend ,, {B}, ahk_pid %gPID% ; encore
        Sleep 500
        Tick_Gypsy_Timeout := A_TickCount
    }
    if ( pPID && (Tick_Pally_Timeout >= (pallyReuseTime-3000)) )
    {
        ControlSend ,, {B}, ahk_pid %pPID% ; gospel
        Sleep 500
        Tick_Pally_Timeout := A_TickCount
    }   
    
    Selfbuff()
 
    
    return
}
 
Selfbuff()
{
    global
    WinGetActiveStats windowName, windowWidth, windowHeight, winX, winY
    winCenterX := windowWidth >> 1
    winCenterY := windowHeight >> 1
    
    
    ; place any of your char's intown buffs here
    
    
    ; If it requires simply touching a hotkey, use this code
    ; If it requires simply using a hotkey, use this code:
    ;       ControlSend ,,{O},ahk_pid %mPID% ; buffkey
    ;       Sleep aspdDelay + 300
    ;
    ; If it has a casting time, put a Sleep equivalent/close to the cast time necessary next to the Sleep already provided
    ;    For example, Zen has ~a 700 ms cast time for me, so I'd use:
    ;       ControlSend ,,{A},ahk_pid %mPID% ; zen hotkey
    ;       Sleep 900
    ;       Sleep aspdDelay + 300
    ;
    ; If it requires clicking on yourself, use this code:
    ;       ControlSend ,,{B},ahk_pid %mPID% ; blessing
    ;       Click %centerX%, %centerY%
    ;       Sleep ( aspdDelay + 300)
    ; Obviously, if a cast time is involved, be sure to add that to the sleep
    ;
}
 
 
Cast(x, y)
{
    global 
    ControlSend ,,{F6},ahk_pid %mPID% ; skill hotkey
    Sleep 50
    Click %x%, %y%
    Sleep 300
    return
}
 
 
}   
 
End::Pause
 
Viewed 1825 times, submitted by Guest.