Page 4 of 180 FirstFirst 123456781454104 ... LastLast
Results 46 to 60 of 2691
  1. #46
    Member masterpulha's Avatar
    Reputation
    1
    Join Date
    Aug 2012
    Posts
    17
    Thanks G/R
    0/0
    CoreCoins
    7
    Trade Feedback
    0 (0%)
    Quote Originally Posted by datz View Post
    idk why but run the script try to join on my char and keeps insta quitting.. idk how to change that

    Hi, im having exactly the same issue.
    Im running game on a vm using 800x600 window resolution, win7.
    I reset - press find all that, but it immediately quit like if im on low health .. i made a video with testing account i use.

    http://www.youtube.com/watch?v=EW3eWhx8AeQ

    Thanks

  2. #47
    Member Nipper's Avatar
    Reputation
    5
    Join Date
    Jun 2013
    Posts
    60
    Thanks G/R
    3/1
    CoreCoins
    51
    Trade Feedback
    0 (0%)
    I was going to point this out as well when I got back on today. It did the same thing. I tried disabling it via modifying script hoping it would not do that. It still quits even set at 0%. Even with it disabled via script to like 10 it wont drink any potions at all. So I just reverted to use the older one.

    config.ini

    AutoQuitMethod=10


    or
    in script like i did with past versions.

    autoQuitMode:=10

  3. #48
    Contributor CoreCoins User gurud's Avatar
    Reputation
    123
    Join Date
    Oct 2013
    Posts
    223
    Thanks G/R
    0/25
    CoreCoins
    23324
    Trade Feedback
    0 (0%)
    Quote Originally Posted by masterpulha View Post
    Hi, im having exactly the same issue.
    Im running game on a vm using 800x600 window resolution, win7.
    I reset - press find all that, but it immediately quit like if im on low health .. i made a video with testing account i use.

    Recording 20131216211623 - YouTube

    Thanks
    Thanks for the video, i'm now installing PoE to my win 7 virtual machine, will try to reproduce your steps.

    By the way with version of AutoHotkey you have installed? 64 bit or 32?

    the 64 bit one had some problems with this script, as reported on the old thread.

    So if you have that you could try to reinstall the AutoHotkey UNICODE 32 bit version

    Edit: From the Original thread:

    Some basic error messages for critical error cases instead of silent failures, will also auto-quit script in that cases:
    Running script on AutoHotkey 64-bit
    Failure to obtain moduleBase, moduleSize
    Failure to obtain valid process handle for client
    (AoBScan failure produced notification, will auto-quit now in addition to make it clear script can't work in that case)


    So that error is probably because of AutoHotkey 64-bit version instaled

    Reinstall it and tell me if it worked.
    http://l.autohotkey.net/AutoHotkey_L_Install.exe
    Last edited by gurud; 12-16-2013 at 06:07 PM.

  4. #49
    Member datz's Avatar
    Reputation
    11
    Join Date
    Aug 2013
    Posts
    393
    Thanks G/R
    82/9
    CoreCoins
    68
    Trade Feedback
    0 (0%)
    Quote Originally Posted by gurud View Post
    Thanks for the video, i'm now installing PoE to my win 7 virtual machine, will try to reproduce your steps.

    By the way with version of AutoHotkey you have installed? 64 bit or 32?

    the 64 bit one had some problems with this script, as reported on the old thread.

    So if you have that you could try to reinstall the AutoHotkey UNICODE 32 bit version

    Edit: From the Original thread:

    Some basic error messages for critical error cases instead of silent failures, will also auto-quit script in that cases:
    Running script on AutoHotkey 64-bit
    Failure to obtain moduleBase, moduleSize
    Failure to obtain valid process handle for client
    (AoBScan failure produced notification, will auto-quit now in addition to make it clear script can't work in that case)
    i have 32 bit installed.. version is like 1.11.1.01 i think

  5. #50
    Contributor CoreCoins User gurud's Avatar
    Reputation
    123
    Join Date
    Oct 2013
    Posts
    223
    Thanks G/R
    0/25
    CoreCoins
    23324
    Trade Feedback
    0 (0%)
    Quote Originally Posted by datz View Post
    i have 32 bit installed.. version is like 1.11.1.01 i think
    Is the old script working fine for you?

    This is the pre- GUI script test it if it's working for you, tnx.

    Code:
    SetBatchLines, -1
    DetectHiddenWindows, On
    
    
    cliname=Path of Exile
    cliexe=PathOfExile.exe
    trayNotifications:=true ;display tray notifications about script actions : drinking potions, autoquitting
    autoPotionsWatchdogPeriod:=10 ;milliseconds, decrease this value to have script recheck life/mana/flasks availability more often/increase chances of getting saved from death in time
    lagCompensation:=20
    
    autoQuitMode:=1 ; default autoQuit method : 0 =winKill, 1 = exit to login screen,  2 = exit to character selection, 3 = Use Portal
    autoQuitPauseBeforeClick:=100
    autoQuitSoftToleranceBeforeKill:=2000 ; try to quit to loginscreen at most milliseconds before killing game window(in case we can't quit by clicking menu option for some reason)
    
    PlayerConfig:={}
    
    PlayerConfig["Default"]:={minLifeRatioToDrink: 0.65, minManaRatioToDrink: 0.80, minManaToDrink: 50, minLifeRatioToPopGranite: 0.65, minLifeRatioToPopJade: 0.65, minLifeRatioToQuit: 0.40} ;  disableAutoPotions:true, minNShieldRatioToPopGranite: , minLifeRatioToPopJade: , minNShieldRatioToPopJade: , minNShieldRatioToQuit: , HasZealotsOath: false, }
    
    PlayerConfig["Default"].FlaskConfig:=[]
    
    PlayerConfig["Default"].FlaskConfig[1]:={Hotkey:"{1 Down 1 UP}"} ; ,OverrideFlaskDuration: 70, instantRecoveryOnLowLife:true, } ;specify override recovery time in deciseconds, e.g. 7 seconds = 70
    PlayerConfig["Default"].FlaskConfig[2]:={Hotkey:"{2 Down 2 UP}"}
    PlayerConfig["Default"].FlaskConfig[3]:={Hotkey:"{3 Down 3 UP}"}
    PlayerConfig["Default"].FlaskConfig[4]:={Hotkey:"{4 Down 4 UP}"}
    PlayerConfig["Default"].FlaskConfig[5]:={Hotkey:"{5 Down 5 UP}"}
    
    PlayerConfig["YourHardcorePlayerName"]:={minLifeRatioToDrink: 0.75, minManaRatioToDrink: 0.25, minManaToDrink: 10, minLifeRatioToPopGranite: 0.80, minLifeRatioToPopJade: 0.80, minLifeRatioToQuit: 0.35}
    
    PlayerConfig["YourHardcorePlayerName"].FlaskConfig:=[]
    
    PlayerConfig["YourHardcorePlayerName"].FlaskConfig[1]:={Hotkey:"{1 Down 1 UP}"}
    PlayerConfig["YourHardcorePlayerName"].FlaskConfig[2]:={Hotkey:"{2 Down 2 UP}"}
    PlayerConfig["YourHardcorePlayerName"].FlaskConfig[3]:={Hotkey:"{3 Down 3 UP}"}
    PlayerConfig["YourHardcorePlayerName"].FlaskConfig[4]:={Hotkey:"{4 Down 4 UP}"}
    PlayerConfig["YourHardcorePlayerName"].FlaskConfig[5]:={Hotkey:"{5 Down 5 UP}"}
    
    autoPotionsState:=true
    
    WindowQueuedFlaskEffects:=[] ;keyed by "%hwnd%%CurrPid%", hpQueueEndtime, manaQueueEndtime
    
    baseMgrPtr:=         ;1.0.1b delete for script to try to auto-scan for it in newer versions, scan takes 4-5 seconds
    
    basePtrAoBArray:=[0x53,0x55,0x56,0x57,0x33,0xFF,0x3B,0xC7]
    basePtrAobOffset:=-0x0A
    
    WindowBasicsCache:=[] ; keyed by "%hwnd%%CurrPid%", entries are objects with properties processHandle, moduleBase, moduleSize, baseFramePtr
    
    #Include AutoHotkeyMemoryLib.ahk
    
    Loop
    {
       AutoPotions()
    }
    
    GetWindowBasics(hwnd, byref mB="", byref pH="", byref mS="")
    {
       
       global WindowBasicsCache
       global cliexe
       
       WinGet, CurrPid, PID, ahk_id %hwnd%
       
       k="%hwnd%%CurrPid%"
       
       mB:=WindowBasicsCache[k].mBase
       mS:=WindowBasicsCache[k].mSize
       
       if mB=
       {
          WindowBasicsCache[k]:=Object()
          GetModuleInfo(cliexe, CurrPid, mB, mS)
          if (mB="" || mS="")
          {
             MsgBox, Failed to obtain moduleBase or moduleSize for PID %CurrPid%, script will now terminate
             ExitApp
          }      
          WindowBasicsCache[k].mBase:=mB
          WindowBasicsCache[k].mSize:=mS
       }
    
       pH:=WindowBasicsCache[k].ProcessHandle
       if pH=
       {
          pH:=GetProcessHandle(CurrPid)
          if (pH="" || pH=-1)
          {
             MsgBox, Invalid process handle obtained for PID %CurrPid%, script will now terminate
             ExitApp
          }      
          WindowBasicsCache[k].ProcessHandle:=pH
       }
    }
    
    ScanBaseMgrPtr(mBase,pH,moduleSize)
    {
       global basePtrAoBArray
       global basePtrAobOffset
       global baseMgrPtr
       aobResult:=AobScan(pH,mBase,moduleSize,basePtrAoBArray)
    
       if aobResult
       {
          SetFormat, IntegerFast, hex
          baseMgrPtr:=ReadMemUInt(pH,mBase+aobResult+basePtrAobOffset)-mBase
          TrayTip, Autoflask Script Attached, baseMgrPtr = %baseMgrPtr%
    	  SetFormat, IntegerFast, dec
    
    	}
       else
       {
          MsgBox, baseMgrPtr not found with AoBScan, script will now terminate
          ExitApp
       }   
    }
    
    GetFrameBase(hwnd)
    {
       global baseMgrPtr
       global WindowBasicsCache
    
       WinGet, CurrPid, PID, ahk_id %hwnd%
       k="%hwnd%%CurrPid%"
    
       fB:=WindowBasicsCache[k].fBase
    
       if fB=
       {
          GetWindowBasics(hwnd, mBase, pH, mSize)
    
          if baseMgrPtr=
          {
             ScanBaseMgrPtr(mBase, pH, mSize)
          }
    
          fB:=GetMultilevelPointer(pH,[mBase+baseMgrPtr,4,0x7C,0x94])
          WindowBasicsCache[k].fBase:=fB
       }
       return fB
    }
    
    GetUiBase(hwnd)
    {
       global baseMgrPtr
    
          GetWindowBasics(hwnd, mBase, pH, mSize)
          
          if baseMgrPtr=
          {
             ScanBaseMgrPtr(mBase, pH, mSize)
          }
          
    	FrameBase:=GetFrameBase(hwnd)
    	if (FrameBase="" || FrameBase=0)
    		return
    	uiBase:=GetMultilevelPointer(pH,[FrameBase+0xBC,0xA4,0x50])
    	return uiBase
    }
    
    ReadClientResolution(hwnd, ByRef w, ByRef h)
    {
       GetWindowBasics(hwnd,mBase,pH)
       if (mBase!=0 && pH && pH!=-1)
       {
          FrameBase:=GetFrameBase(hwnd)
          w:=ReadMemUInt(pH,FrameBase+0x1458)
          h:=ReadMemUInt(pH,FrameBase+0x145C)
          return true
       }   
    }
    
    
    
    ReadPlayerStats(hwnd, byRef PlayerStats)
    {
       GetWindowBasics(hwnd, mBase, pH)
       fBase:=GetFrameBase(hwnd)
       PlayerBase:=GetMultilevelPointer(pH,[fBase+0xBC,0x59C])
       PlayerMain:=ReadMemUInt(pH,PlayerBase+4)
       PlayerStatsOffset:=ReadMemUInt(pH,PlayerMain+0xC)
    	PlayerStats.MaxHP:=ReadMemUInt(pH,PlayerStatsOffset+0x50)
    	PlayerStats.CurrHP:=ReadMemUInt(pH,PlayerStatsOffset+0x54)	
    	PlayerStats.ReservedHPFlat:=ReadMemUInt(pH,PlayerStatsOffset+0x5C)
    	PlayerStats.ReservedHPPercent:=ReadMemUInt(pH,PlayerStatsOffset+0x60)
    	PlayerStats.MaxMana:=ReadMemUInt(pH,PlayerStatsOffset+0x74)
    	PlayerStats.ReservedManaFlat:=ReadMemUInt(pH,PlayerStatsOffset+0x80)
    	PlayerStats.ReservedManaPercent:=ReadMemUInt(pH,PlayerStatsOffset+0x84)
    	PlayerStats.CurrMana:=ReadMemUInt(pH,PlayerStatsOffset+0x78)
    	PlayerStats.MaxNShield:=ReadMemUInt(pH,PlayerStatsOffset+0x98)
    	PlayerStats.CurrNShield:=ReadMemUInt(pH,PlayerStatsOffset+0x9C)
       
       if (ReadMemUInt(pH, ReadMemUInt(pH,PlayerMain+0x14)+0x24)<8) ;names shorter than 7 chars are stored immediately in component
          PlayerStats.Name:=ReadMemStr(pH, ReadMemUint(pH,PlayerMain+0x14)+0x10,100,"UTF-16") ;immediate name in component
       else
          PlayerStats.Name:=ReadMemStr(pH, GetMultilevelPointer(pH,[PlayerMain+0x14,0x10]),100,"UTF-16") ; otherwise pointer to name is stored
    }
    
    ReadFlasksData(hwnd, byRef FlasksData)
    {
       GetWindowBasics(hwnd, mBase, pH)
       
       UiBase:=GetUiBase(hwnd)
       
       if (!UiBase) ;not InGame
          return
       
       FlaskInvBase:=GetMultilevelPointer(pH,[UiBase+0x968,0x980,0x20])
    
       Loop, 5
       {
          currFlaskPtr:=ReadMemUInt(pH,FlaskInvBase+(A_Index-1)*4)
          if (currFlaskPtr!=0) ; there's a flask in said slot
          {
             FlasksData[A_Index]:={}
    
             FlaskChargesPtr:=GetMultilevelPointer(ph,[currFlaskPtr,4,0x1C,4,4,0xC])
             FlasksData[A_Index].ChargesCurrent:=ReadMemUInt(pH,FlaskChargesPtr+0xC)
             FlasksData[A_Index].ChargesPerUse:=ReadMemUInt(pH,ReadMemUInt(pH,FlaskChargesPtr+8)+0xC)
             
             if (FlasksData[A_Index].ChargesCurrent < FlasksData[A_Index].ChargesPerUse) ; not enough charges in this flask to use it, don't bother
                continue
    
             FlaskMetadataPtr:=GetMultilevelPointer(ph,[currFlaskPtr,0,8])
             FlaskMetadataStr:=ReadMemStr(ph,FlaskMetadataPtr,70,"UTF-16")
             FlaskTypeStr:=SubStr(FlaskMetadataStr,23)
             FlasksData[A_Index].type:=FlaskTypeStr
             
             FlaskLocalstatsPtr:=GetMultilevelPointer(ph,[currFlaskPtr,4,0x18,0x20,0xC])
             
             if InStr(FlaskTypeStr, "FlaskLife")
             {
                FlasksData[A_Index].HPRegAmount:=ReadMemUInt(pH,FlaskLocalstatsPtr+4)
                FlasksData[A_Index].EffectDuration:=ReadMemUInt(pH,FlaskLocalstatsPtr+0xC)
             }
    
             if InStr(FlaskTypeStr, "FlaskMana")
             {
                FlasksData[A_Index].ManaRegAmount:=ReadMemUInt(pH,FlaskLocalstatsPtr+4)
                FlasksData[A_Index].EffectDuration:=ReadMemUInt(pH,FlaskLocalstatsPtr+0xC)
             }
             
             if InStr(FlaskTypeStr, "FlaskHybrid")
             {
                FlasksData[A_Index].HPRegAmount:=ReadMemUInt(pH,FlaskLocalstatsPtr+4)
                FlasksData[A_Index].ManaRegAmount:=ReadMemUInt(pH,FlaskLocalstatsPtr+0xC)
                FlasksData[A_Index].EffectDuration:=ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)
             }
    
             if InStr(FlaskTypeStr, "FlaskUtility")
             {
                FlasksData[A_Index].EffectDuration:=ReadMemUInt(pH,FlaskLocalstatsPtr+0x4)
             }
          }
       }
    }
    
    IsInGame(hwnd)
    {
    	if (hwnd=0 || hwnd="")
    		return false
    	GetWindowBasics(hwnd,mBase,pH)
    	if (mBase="" || mBase=0 || pH="" || pH=-1)
    		return false
    	fBase:=GetFrameBase(hwnd)
    	if (fBase="" || fBase=0)
    		return false
    	localConnection:=ReadMemUInt(pH,fBase+0xc0)
    	if (localConnection=0 || localConnection="")
    		return false
    	else
    		return true
    }
    
    SetGameStateMenu(hwnd)
    {
    	if (hwnd=0 || hwnd="")
    		return false
    	GetWindowBasics(hwnd,mBase,pH)
    	if (mBase="" || mBase=0 || pH="" || pH=-1)
    		return false
    	fBase:=GetFrameBase(hwnd)
    	if (fBase="" || fBase=0)
    		return false
    	localConnection:=ReadMemUInt(pH,fBase+0xc0)
    	if (localConnection!="" && localConnection!=0)
    	{
    		WriteMemUInt(pH,localConnection+0x2678,1)
    	}
    }
    
    ReadHeroPos(hwnd,ByRef x, ByRef y)
    {
       GetWindowBasics(hwnd,mBase,pH)
       if (mBase!=0 && pH && pH!=-1)
       {
          FrameBase:=GetFrameBase(hwnd)
          x:=ReadMemFloat(pH,FrameBase+0x16ac)
          y:=ReadMemFloat(pH,FrameBase+0x16b0)
          return true
       }   
    }
    
    
    
    
    ScreenToClient(hwnd, ByRef x, ByRef y)
    {
        VarSetCapacity(pt, 8)
        NumPut(x, pt, 0)
        NumPut(y, pt, 4)
        DllCall("ScreenToClient", "uint", hwnd, "uint", &pt)
        x := NumGet(pt, 0, "int")
        y := NumGet(pt, 4, "int")
       VarSetCapacity(pt, 0)
    }
    
    GetClientCoords(byRef mx, byRef my)
    {
       hwnd:=WinActive("A")   
       CoordMode, Mouse, Screen
       MouseGetPos, mx, my
       ScreenToClient(hwnd,mx,my) ;  x 580   y 435
    }
    
    
    
    QuitToLoginScreen(hwnd)
    {	
    	if (!IsInGame(hwnd))
    	{
    		return
    	}
    	SetGameStateMenu(hwnd)
    }
    
    GetMaxChargesFlaskOfType(ByRef FlasksData,TypeStr)
    {
       currMaxCharges:=0
       Loop, 5
          if (InStr(FlasksData[A_Index].type,TypeStr))
          {
             if FlasksData[A_Index].ChargesCurrent>currMaxCharges
             {
                currMaxI:=A_Index
                currMaxCharges:=FlasksData[A_Index].ChargesCurrent
             }
          }
       return currMaxI
    }
    
    AutoPotions()
    {
       global autoPotionsWatchdogPeriod
       global lagCompensation
       global PlayerConfig
       global WindowQueuedFlaskEffects
       global cliname
       global cliexe
       global trayNotifications
       global autoQuitMode
       
       if (autoPotionsState!=true)
          return
    
       WinGet, WinID, List, %cliname%
       
       Loop, %WinID%
       {
          
          WinGet, ProcModuleName, ProcessName,  % "ahk_id" WinID%A_Index%
          
          If(ProcModuleName!=cliexe) ; got a window with title "Path of Exile" but exe is not Client.exe, perhaps we have browser window open with PoE site, ignore it
             continue
          
          if (!IsInGame(WinID%A_Index%)) ;not ingame
             continue
    		 
    	if (WinID%A_Index%=WinActive("A"))
    	   ThisID:=WinActive("A")
          
          PlayerStats:={}
          ReadPlayerStats(WinID%A_Index%, PlayerStats)
          if (PlayerStats.MaxHP<1 || PlayerStats.CurrHP=0) ;dead, don't bother
             continue
    
          if (PlayerConfig.HasKey(PlayerStats.Name))
             CurrentConfig:=PlayerConfig[PlayerStats.Name]
          else
             CurrentConfig:=PlayerConfig["Default"]
             
          
          if PlayerStats.MaxNShield>0
          {
             currNShieldRatio:=PlayerStats.CurrNShield/PlayerStats.MaxNShield
          }
          
          if (PlayerStats.MaxHP>1)
          {
             currLifeRatio:=PlayerStats.CurrHP/(PlayerStats.MaxHP-PlayerStats.ReservedHPFlat-PlayerStats.MaxHP*PlayerStats.ReservedHPPercent/100)
          }
          
          if CurrentConfig.HasZealotsOath
          {
             currLifeRatio:=currNShieldRatio
          }
             
          if (PlayerStats.MaxMana>0)
          {
             currManaRatio:=PlayerStats.CurrMana/(PlayerStats.MaxMana-PlayerStats.ReservedManaFlat-PlayerStats.MaxMana*PlayerStats.ReservedManaPercent/100)
          }
          
          if (currLifeRatio<CurrentConfig.minLifeRatioToQuit || currNShieldRatio<CurrentConfig.minNShieldRatioToQuit)
          {
             if (autoQuitMode=0)
             {
                TrayTip, PoE autoPotions AutoQuit by closing window, specified min life reached, %A_Space% , 2
                WinKill, % "ahk_id" WinID%A_Index%
             }
             else if (autoQuitMode=1)
             {
                QuitToLoginScreen(WinID%A_Index%)
             }
    		 else if (autoQuitMode=2)
    		 {
    			ExitToCharacterSelection()
    		 }
    		 else if (autoQuitMode=3)
    		 {
    			UsePortal()
    		 }
    		 autoQuit:=1
             continue
          }
          
          if (CurrentConfig.disableAutoPotions)
             continue
          
          FlasksData:=[]
          ReadFlasksData(WinID%A_Index%,FlasksData)
          
          WinGet, CurrPID, PID,  % "ahk_id" WinID%A_Index%
          hwnd:=WinID%A_Index%
          k="%hwnd%%CurrPid%"
          if (!WindowQueuedFlaskEffects.HasKey(k))
          {
             WindowQueuedFlaskEffects[k]:={}
          }
          
          if (currLifeRatio<CurrentConfig.minLifeRatioToPopGranite || currNShieldRatio<CurrentConfig.minNShieldRatioToPopGranite)
             if ((!WindowQueuedFlaskEffects[k].HasKey("graniteQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].graniteQueueEndtime-lagCompensation)))
                {
                   flaskNum:=GetMaxChargesFlaskOfType(FlasksData,"FlaskUtility5") ; granite flask
                   if (flaskNum!="")
                   {
                      if CurrentConfig.FlaskConfig[flaskNum].HasKey("OverrideFlaskDuration")
                         EffectDuration:=CurrentConfig.FlaskConfig[flaskNum].OverrideFlaskDuration
                      else
                         EffectDuration:=FlasksData[flaskNum].EffectDuration
                         
                      WindowQueuedFlaskEffects[k].graniteQueueEndtime:=A_TickCount+EffectDuration*100
    
                      if (trayNotifications)
                      {
                         pname:=PlayerStats.Name
                         TrayTip, PoE autoPotions popping Granite flask %flaskNum% on %pname%, %A_Space% , 2
                      }
                      hKey:=CurrentConfig.FlaskConfig[flaskNum].Hotkey
                      ControlSend,,%hkey%, % "ahk_id" hwnd
                      break
                   }
                }
    
          if (currLifeRatio<CurrentConfig.minLifeRatioToPopJade || currNShieldRatio<CurrentConfig.minNShieldRatioToPopJade)
             if ((!WindowQueuedFlaskEffects[k].HasKey("jadeQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].jadeQueueEndtime-lagCompensation)))
                {
                   flaskNum:=GetMaxChargesFlaskOfType(FlasksData,"FlaskUtility9") ; jade flask
                   if (flaskNum!="")
                   {
                      if CurrentConfig.FlaskConfig[flaskNum].HasKey("OverrideFlaskDuration")
                         EffectDuration:=CurrentConfig.FlaskConfig[flaskNum].OverrideFlaskDuration
                      else
                         EffectDuration:=FlasksData[flaskNum].EffectDuration
                         
                      WindowQueuedFlaskEffects[k].jadeQueueEndtime:=A_TickCount+EffectDuration*100
    
                      if (trayNotifications)
                      {
                         pname:=PlayerStats.Name
                         TrayTip, PoE autoPotions popping Jade flask %flaskNum% on %pname%, %A_Space% , 2
                      }
                      hKey:=CurrentConfig.FlaskConfig[flaskNum].Hotkey
                      ControlSend,,%hkey%, % "ahk_id" hwnd
                      break
                   }
                }
    
          if (currLifeRatio=1)
             WindowQueuedFlaskEffects[k].hpQueueEndtime:=A_TickCount
          
          if (currManaRatio=1)
             WindowQueuedFlaskEffects[k].ManaQueueEndtime:=A_TickCount
          
          if (currLifeRatio<CurrentConfig.minLifeRatioToDrink || (PlayerStats.CurrHP<CurrentConfig.minLifeToDrink))
             if ((!WindowQueuedFlaskEffects[k].HasKey("hpQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].hpQueueEndtime-lagCompensation)))
             {
                      tflaskNum1:=GetMaxChargesFlaskOfType(FlasksData,"FlaskLife")
                      tflaskNum2:=GetMaxChargesFlaskOfType(FlasksData,"FlaskHybrid")
                      if ((tflaskNum1!=) && (tflaskNum2!=))
                         flaskNum:=(FlasksData[tflaskNum1].ChargesCurrent>FlasksData[tflaskNum2].ChargesCurrent) ? tflaskNum1 : tflaskNum2
                      else
                      {
                         if (tflaskNum1!="")
                            flaskNum:=tflaskNum1
                         if (tflaskNum2!="")
                            flaskNum:=tflaskNum2
                      }
                      if (flaskNum!="")
                      {
                         if CurrentConfig.FlaskConfig[flaskNum].HasKey("OverrideFlaskDuration")
                            EffectDuration:=CurrentConfig.FlaskConfig[flaskNum].OverrideFlaskDuration
                         else
                            EffectDuration:=FlasksData[flaskNum].EffectDuration
                         
                         if ((CurrentConfig.FlaskConfig[flaskNum].instantRecoveryOnLowLife) && ((PlayerStats.CurrHP/PlayerStats.MaxHP)<=0.35)) ; "Low life" can be caused by auras hp reservation from blood magic
                            EffectDuration:=lagCompensation
                            
                         WindowQueuedFlaskEffects[k].hpQueueEndtime:=A_TickCount+EffectDuration*100
                         if (FlasksData[flaskNum].HasKey("ManaRegAmount")) ; hybrid flask
                            WindowQueuedFlaskEffects[k].ManaQueueEndtime:=A_TickCount+EffectDuration*100
    
                         if (trayNotifications)
                         {
                            pname:=PlayerStats.Name
                            TrayTip, PoE autoPotions sipping HP flask %flaskNum% on %pname%, %A_Space% , 2
                         }
                         hKey:=CurrentConfig.FlaskConfig[flaskNum].Hotkey
                         ControlSend,,%hkey%, % "ahk_id" hwnd
                         break
                      }
                }
    
          if (PlayerStats.MaxMana>0 && (currManaRatio<CurrentConfig.minManaRatioToDrink || PlayerStats.CurrMana<CurrentConfig.minManaToDrink))      
             if ((!WindowQueuedFlaskEffects[k].HasKey("ManaQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].ManaQueueEndtime-lagCompensation)))
             {
                   tflaskNum1:=GetMaxChargesFlaskOfType(FlasksData,"FlaskMana")
                   tflaskNum2:=GetMaxChargesFlaskOfType(FlasksData,"FlaskHybrid")
                   
                   if ((tflaskNum1!=) && (tflaskNum2!=))
                      flaskNum:=(FlasksData[tflaskNum1].ChargesCurrent>FlasksData[tflaskNum2].ChargesCurrent) ? tflaskNum1 : tflaskNum2
                   else
                   {
                      if (tflaskNum1!="")
                         flaskNum:=tflaskNum1
                      if (tflaskNum2!="")
                         flaskNum:=tflaskNum2
                   }
    
                   if (flaskNum!="")
                   {
                      if CurrentConfig.FlaskConfig[flaskNum].HasKey("OverrideFlaskDuration")
                         {
                            EffectDuration:=CurrentConfig.FlaskConfig[flaskNum].OverrideFlaskDuration
                         }
                      else
                         EffectDuration:=FlasksData[flaskNum].EffectDuration
    
                      if ((CurrentConfig.FlaskConfig[flaskNum].instantRecoveryOnLowLife) && ((PlayerStats.CurrHP/PlayerStats.MaxHP)<=0.35))
                         EffectDuration:=lagCompensation
                      
                      WindowQueuedFlaskEffects[k].ManaQueueEndtime:=A_TickCount+EffectDuration*100
                      if (FlasksData[flaskNum].HasKey("HPRegAmount")) ; hybrid flask
                         WindowQueuedFlaskEffects[k].hpQueueEndtime:=A_TickCount+EffectDuration*100
                      
                      hKey:=CurrentConfig.FlaskConfig[flaskNum].Hotkey
                      if (trayNotifications)
                      {
                         pname:=PlayerStats.Name
                         TrayTip, PoE autoPotions sipping mana flask %flaskNum% on %pname%, %A_Space% , 2
                      }
                      ControlSend,,%hkey%, % "ahk_id" hwnd
                      break
                   }
             }               
       }
       
        if ((autoQuit=1) && (ThisID!="") && (ThisID!=WinActive("A")))
          WinActivate, % "ahk_id" ThisID
    
       Sleep, %autoPotionsWatchdogPeriod%   
    }
    
    
    UsePortal()
    {
    	BlockInput On
    	SendMode Input
    	hwnd:=WinActive("A")
    	GetKeyState, stateR, RButton, P
    	if stateR = D
    	{
    		Send {RButton up}
    	}
    	GetKeyState, stateL, LButton, P
    	if stateL = D
    	{
    		Send {LButton up}
    	}
    	GetKeyState, stateM, MButton, P
    	if stateM = D
    	{
    		Send {MButton up}
    	}
    	GetKeyState, stateQ, Q, P
    	if stateQ = D
    	{
    		Send {Q up}
    	}
    	GetKeyState, stateW, W, P
    	if stateW = D
    	{
    		Send {W up}
    	}
    	GetKeyState, stateE, E, P
    	if stateE = D
    	{
    		Send {E up}
    	}
    	GetKeyState, stateR, R, P
    	if stateR = D
    	{
    		Send {R up}
    	}
    	GetKeyState, stateT, T, P
    	if stateT = D
    	{
    		Send {T up}
    	}
    	GetKeyState, stateI, I, P
    	if stateI = D
    	{
    		Send {I up}
    	}
    	GetKeyState, stateSP, SPACE, P
    	if stateSP = D
    	{
    		Send {SPACE up}
    	}
    	GetKeyState, stateSH, SHIFT, P
    	if stateSH = D
    	{
    		Send {SHIFT up}
    	}
    	ReadClientResolution(hwnd,w,h)
    	Send {SPACE}
    	Send {ENTER}
    	Send {Raw} /oos
    	Send {ENTER}
    	Send {i}
    	ErrorLevel = 1
    	Sleep, 50
    	PixelSearch, ScrollX, ScrollY, w/2, h/2, w, h, 0xFFFFFF, 0, fast	
    	If ErrorLevel = 0
    	MouseMove, (ScrollX), (ScrollY),0
    	else
    	{
    		BlockInput Off
    		return
    	}
    	Send {RButton}
    	Send {SPACE}
    	Sleep, 50
    	MouseMove, (w/2), (h/2),0
    	Sleep, 50
    	Send {LButton}
    	sleep, 250
    	Loop
    	{
    		ErrorLevel = 1
    		PixelSearch, PixX, PixY, (w/4), (h/10), ((w/4)*3), h, 0xddbb30, 34, fast  ;0xdcc8c8 text color
    		if ErrorLevel = 0
    		{
    			MouseMove, (PixX), (PixY),0
    			Sleep, 20
    			Send {LButton}
    			Loop ;only search for portals when not moving
    			{	
    				ReadHeroPos(hwnd,PosX1,PosY1)
    				sleep, 30
    				ReadHeroPos(hwnd,PosX2,PosY2)
    				if PosX1 = %PosX2%
    				{
    					If PosY1 = %PosY2%
    					{
    						break
    					}
    			
    				}
    				else
    				sleep, 30
    			}
    		}
    		else
    		{
    			Break
    		}
    	}
    	Sleep, 50
    	MouseMove, (w/2), (h/2),0
    	Sleep, 50
    	Send {LButton}
    	Sleep, 50
    	BlockInput Off
    }
    
    
    ExitToCharacterSelection()
    {
    	BlockInput On
    	SendMode Input
    	hwnd:=WinActive("A")
    	GetKeyState, stateR, RButton, P
    	if stateR = D
    	{
    		Send {RButton up}
    	}
    	GetKeyState, stateL, LButton, P
    	if stateL = D
    	{
    		Send {LButton up}
    	}
    	GetKeyState, stateM, MButton, P
    	if stateM = D
    	{
    		Send {MButton up}
    	}
    	GetKeyState, stateQ, Q, P
    	if stateQ = D
    	{
    		Send {Q up}
    	}
    	GetKeyState, stateW, W, P
    	if stateW = D
    	{
    		Send {W up}
    	}
    	GetKeyState, stateE, E, P
    	if stateE = D
    	{
    		Send {E up}
    	}
    	GetKeyState, stateR, R, P
    	if stateR = D
    	{
    		Send {R up}
    	}
    	GetKeyState, stateT, T, P
    	if stateT = D
    	{
    		Send {T up}
    	}
    	GetKeyState, stateI, I, P
    	if stateI = D
    	{
    		Send {I up}
    	}
    	GetKeyState, stateSP, SPACE, P
    	if stateSP = D
    	{
    		Send {SPACE up}
    	}
    	GetKeyState, stateSH, SHIFT, P
    	if stateSH = D
    	{
    		Send {SHIFT up}
    	}
    	Send {SPACE}
    	Send {ESC}
    	ReadClientResolution(hwnd,w,h)
    	MouseMove, (w/2), ((h/2)- ((h-674.4)/6.24))  ;Might have to change the height in this line to work.
    	Send {LButton}
    	Sleep, 500
    	BlockInput Off
    }
    
    
    TradeChat()
    {
    	BlockInput On
    	SendMode Input
    	loop
    	{
    		Send {ENTER}
    		Send /trade %A_Index%
    		Send {ENTER}
    		Send {ENTER}	
    		Send {Up 2}
    		Sleep, 150
    		Send {ENTER}
    		If A_Index = 10
    		Break
    		else
    		Sleep, 100
    	}
    	BlockInput Off
    }
    
    
    F1::
       global autoPotionsState
       global trayNotifications
       autoPotionsState:=not autoPotionsState
       if (trayNotifications)
       {
          if (autoPotionsState=true)
             TrayTip, PoE autoPotions is on, %A_Space% , 2
          else
             TrayTip, PoE autoPotions is off, %A_Space%  , 2
       }
    return
    
    F2::
    	UsePortal()
    return
    
    F3::
    	ExitToCharacterSelection()
    return
    
    F4::
       QuitToLoginScreen(WinActive("A"))
    return
    
    F10::
    	TradeChat()
    return
    Last edited by gurud; 12-16-2013 at 06:25 PM.

  6. #51
    Member Nipper's Avatar
    Reputation
    5
    Join Date
    Jun 2013
    Posts
    60
    Thanks G/R
    3/1
    CoreCoins
    51
    Trade Feedback
    0 (0%)
    Quote Originally Posted by gurud View Post
    Is the old script working fine for you?

    This is the pre- GUI script test it if it's working for you, tnx.
    Mine does the same as his by the way. Just finds then quits. Thats why I requested a way to disable the quit with the drop down and not using the sliders. Even if I disabled it via changing the autoquit to 10 like did in older scripts which owrks for them. It wont quit. But wont auto flask.

    Here is the one I am using now. It is the same but took of a few things that were not needed.

    Code:
    SetBatchLines, -1
    DetectHiddenWindows, On
    
    
    cliname=Path of Exile
    cliexe=PathOfExile.exe
    trayNotifications:=true ;display tray notifications about script actions : drinking potions, autoquitting
    autoPotionsWatchdogPeriod:=10 ;milliseconds, decrease this value to have script recheck life/mana/flasks availability more often/increase chances of getting saved from death in time
    lagCompensation:=20
    
    autoQuitMode:=10 ; default autoQuit method : 0 =winKill, 1 = exit to login screen,  2 = exit to character selection, 3 = Use Portal
    autoQuitPauseBeforeClick:=100
    autoQuitSoftToleranceBeforeKill:=2000 ; try to quit to loginscreen at most milliseconds before killing game window(in case we can't quit by clicking menu option for some reason)
    
    PlayerConfig:={}
    
    PlayerConfig["Default"]:={minLifeRatioToDrink: 0.65, minManaRatioToDrink: 0.25, minManaToDrink: 50, minLifeRatioToPopGranite: 0.65, minLifeRatioToPopJade: 0.65, minLifeRatioToQuit: 0.40} ;  disableAutoPotions:true, minNShieldRatioToPopGranite: , minLifeRatioToPopJade: , minNShieldRatioToPopJade: , minNShieldRatioToQuit: , HasZealotsOath: false, }
    
    PlayerConfig["Default"].FlaskConfig:=[]
    
    PlayerConfig["Default"].FlaskConfig[1]:={Hotkey:"{1 Down 1 UP}"} ; ,OverrideFlaskDuration: 70, instantRecoveryOnLowLife:true, } ;specify override recovery time in deciseconds, e.g. 7 seconds = 70
    PlayerConfig["Default"].FlaskConfig[2]:={Hotkey:"{2 Down 2 UP}"}
    PlayerConfig["Default"].FlaskConfig[3]:={Hotkey:"{3 Down 3 UP}"}
    PlayerConfig["Default"].FlaskConfig[4]:={Hotkey:"{4 Down 4 UP}"}
    PlayerConfig["Default"].FlaskConfig[5]:={Hotkey:"{5 Down 5 UP}"}
    
    PlayerConfig["YourHardcorePlayerName"]:={minLifeRatioToDrink: 0.75, minManaRatioToDrink: 0.25, minManaToDrink: 10, minLifeRatioToPopGranite: 0.80, minLifeRatioToPopJade: 0.80, minLifeRatioToQuit: 0.35}
    
    PlayerConfig["YourHardcorePlayerName"].FlaskConfig:=[]
    
    PlayerConfig["YourHardcorePlayerName"].FlaskConfig[1]:={Hotkey:"{1 Down 1 UP}"}
    PlayerConfig["YourHardcorePlayerName"].FlaskConfig[2]:={Hotkey:"{2 Down 2 UP}"}
    PlayerConfig["YourHardcorePlayerName"].FlaskConfig[3]:={Hotkey:"{3 Down 3 UP}"}
    PlayerConfig["YourHardcorePlayerName"].FlaskConfig[4]:={Hotkey:"{4 Down 4 UP}"}
    PlayerConfig["YourHardcorePlayerName"].FlaskConfig[5]:={Hotkey:"{5 Down 5 UP}"}
    
    autoPotionsState:=true
    
    WindowQueuedFlaskEffects:=[] ;keyed by "%hwnd%%CurrPid%", hpQueueEndtime, manaQueueEndtime
    
    baseMgrPtr:= ; 1.0.1b delete for script to try to auto-scan for it in newer versions, scan takes 4-5 seconds
    
    basePtrAoBArray:=[0x53,0x55,0x56,0x57,0x33,0xFF,0x3B,0xC7]
    basePtrAobOffset:=-0x0A
    
    WindowBasicsCache:=[] ; keyed by "%hwnd%%CurrPid%", entries are objects with properties processHandle, moduleBase, moduleSize, baseFramePtr
    
    #Include AutoHotkeyMemoryLib.ahk
    
    Loop
    {
       AutoPotions()
    }
    
    GetWindowBasics(hwnd, byref mB="", byref pH="", byref mS="")
    {
       
       global WindowBasicsCache
       global cliexe
       
       WinGet, CurrPid, PID, ahk_id %hwnd%
       
       k="%hwnd%%CurrPid%"
       
       mB:=WindowBasicsCache[k].mBase
       mS:=WindowBasicsCache[k].mSize
       
       if mB=
       {
          WindowBasicsCache[k]:=Object()
          GetModuleInfo(cliexe, CurrPid, mB, mS)
          if (mB="" || mS="")
          {
             MsgBox, Failed to obtain moduleBase or moduleSize for PID %CurrPid%, script will now terminate
             ExitApp
          }      
          WindowBasicsCache[k].mBase:=mB
          WindowBasicsCache[k].mSize:=mS
       }
    
       pH:=WindowBasicsCache[k].ProcessHandle
       if pH=
       {
          pH:=GetProcessHandle(CurrPid)
          if (pH="" || pH=-1)
          {
             MsgBox, Invalid process handle obtained for PID %CurrPid%, script will now terminate
             ExitApp
          }      
          WindowBasicsCache[k].ProcessHandle:=pH
       }
    }
    
    ScanBaseMgrPtr(mBase,pH,moduleSize)
    {
       global basePtrAoBArray
       global basePtrAobOffset
       global baseMgrPtr
       aobResult:=AobScan(pH,mBase,moduleSize,basePtrAoBArray)
    
       if aobResult
       {
          SetFormat, IntegerFast, hex
          baseMgrPtr:=ReadMemUInt(pH,mBase+aobResult+basePtrAobOffset)-mBase
          TrayTip, Autoflask Script Attached, baseMgrPtr = %baseMgrPtr%
    	  SetFormat, IntegerFast, dec
    Soundbeep
    	}
       else
       {
          MsgBox, baseMgrPtr not found with AoBScan, script will now terminate
          ExitApp
       }   
    }
    
    GetFrameBase(hwnd)
    {
       global baseMgrPtr
       global WindowBasicsCache
    
       WinGet, CurrPid, PID, ahk_id %hwnd%
       k="%hwnd%%CurrPid%"
    
       fB:=WindowBasicsCache[k].fBase
    
       if fB=
       {
          GetWindowBasics(hwnd, mBase, pH, mSize)
    
          if baseMgrPtr=
          {
             ScanBaseMgrPtr(mBase, pH, mSize)
          }
    
          fB:=GetMultilevelPointer(pH,[mBase+baseMgrPtr,4,0x7C,0x94])
          WindowBasicsCache[k].fBase:=fB
       }
       return fB
    }
    
    GetUiBase(hwnd)
    {
       global baseMgrPtr
    
          GetWindowBasics(hwnd, mBase, pH, mSize)
          
          if baseMgrPtr=
          {
             ScanBaseMgrPtr(mBase, pH, mSize)
          }
          
    	FrameBase:=GetFrameBase(hwnd)
    	if (FrameBase="" || FrameBase=0)
    		return
    	uiBase:=GetMultilevelPointer(pH,[FrameBase+0xBC,0xA4,0x50])
    	return uiBase
    }
    
    ReadClientResolution(hwnd, ByRef w, ByRef h)
    {
       GetWindowBasics(hwnd,mBase,pH)
       if (mBase!=0 && pH && pH!=-1)
       {
          FrameBase:=GetFrameBase(hwnd)
          w:=ReadMemUInt(pH,FrameBase+0x1458)
          h:=ReadMemUInt(pH,FrameBase+0x145C)
          return true
       }   
    }
    
    
    
    ReadPlayerStats(hwnd, byRef PlayerStats)
    {
       GetWindowBasics(hwnd, mBase, pH)
       fBase:=GetFrameBase(hwnd)
       PlayerBase:=GetMultilevelPointer(pH,[fBase+0xBC,0x59C])
       PlayerMain:=ReadMemUInt(pH,PlayerBase+4)
       PlayerStatsOffset:=ReadMemUInt(pH,PlayerMain+0xC)
    	PlayerStats.MaxHP:=ReadMemUInt(pH,PlayerStatsOffset+0x50)
    	PlayerStats.CurrHP:=ReadMemUInt(pH,PlayerStatsOffset+0x54)	
    	PlayerStats.ReservedHPFlat:=ReadMemUInt(pH,PlayerStatsOffset+0x5C)
    	PlayerStats.ReservedHPPercent:=ReadMemUInt(pH,PlayerStatsOffset+0x60)
    	PlayerStats.MaxMana:=ReadMemUInt(pH,PlayerStatsOffset+0x74)
    	PlayerStats.ReservedManaFlat:=ReadMemUInt(pH,PlayerStatsOffset+0x80)
    	PlayerStats.ReservedManaPercent:=ReadMemUInt(pH,PlayerStatsOffset+0x84)
    	PlayerStats.CurrMana:=ReadMemUInt(pH,PlayerStatsOffset+0x78)
    	PlayerStats.MaxNShield:=ReadMemUInt(pH,PlayerStatsOffset+0x98)
    	PlayerStats.CurrNShield:=ReadMemUInt(pH,PlayerStatsOffset+0x9C)
       
       if (ReadMemUInt(pH, ReadMemUInt(pH,PlayerMain+0x14)+0x24)<8) ;names shorter than 7 chars are stored immediately in component
          PlayerStats.Name:=ReadMemStr(pH, ReadMemUint(pH,PlayerMain+0x14)+0x10,100,"UTF-16") ;immediate name in component
       else
          PlayerStats.Name:=ReadMemStr(pH, GetMultilevelPointer(pH,[PlayerMain+0x14,0x10]),100,"UTF-16") ; otherwise pointer to name is stored
    }
    
    ReadFlasksData(hwnd, byRef FlasksData)
    {
       GetWindowBasics(hwnd, mBase, pH)
       
       UiBase:=GetUiBase(hwnd)
       
       if (!UiBase) ;not InGame
          return
       
       FlaskInvBase:=GetMultilevelPointer(pH,[UiBase+0x968,0x980,0x20])
    
       Loop, 5
       {
          currFlaskPtr:=ReadMemUInt(pH,FlaskInvBase+(A_Index-1)*4)
          if (currFlaskPtr!=0) ; there's a flask in said slot
          {
             FlasksData[A_Index]:={}
    
             FlaskChargesPtr:=GetMultilevelPointer(ph,[currFlaskPtr,4,0x1C,4,4,0xC])
             FlasksData[A_Index].ChargesCurrent:=ReadMemUInt(pH,FlaskChargesPtr+0xC)
             FlasksData[A_Index].ChargesPerUse:=ReadMemUInt(pH,ReadMemUInt(pH,FlaskChargesPtr+8)+0xC)
             
             if (FlasksData[A_Index].ChargesCurrent < FlasksData[A_Index].ChargesPerUse) ; not enough charges in this flask to use it, don't bother
                continue
    
             FlaskMetadataPtr:=GetMultilevelPointer(ph,[currFlaskPtr,0,8])
             FlaskMetadataStr:=ReadMemStr(ph,FlaskMetadataPtr,70,"UTF-16")
             FlaskTypeStr:=SubStr(FlaskMetadataStr,23)
             FlasksData[A_Index].type:=FlaskTypeStr
             
             FlaskLocalstatsPtr:=GetMultilevelPointer(ph,[currFlaskPtr,4,0x18,0x20,0xC])
             
             if InStr(FlaskTypeStr, "FlaskLife")
             {
                FlasksData[A_Index].HPRegAmount:=ReadMemUInt(pH,FlaskLocalstatsPtr+4)
                FlasksData[A_Index].EffectDuration:=ReadMemUInt(pH,FlaskLocalstatsPtr+0xC)
             }
    
             if InStr(FlaskTypeStr, "FlaskMana")
             {
                FlasksData[A_Index].ManaRegAmount:=ReadMemUInt(pH,FlaskLocalstatsPtr+4)
                FlasksData[A_Index].EffectDuration:=ReadMemUInt(pH,FlaskLocalstatsPtr+0xC)
             }
             
             if InStr(FlaskTypeStr, "FlaskHybrid")
             {
                FlasksData[A_Index].HPRegAmount:=ReadMemUInt(pH,FlaskLocalstatsPtr+4)
                FlasksData[A_Index].ManaRegAmount:=ReadMemUInt(pH,FlaskLocalstatsPtr+0xC)
                FlasksData[A_Index].EffectDuration:=ReadMemUInt(pH,FlaskLocalstatsPtr+0x14)
             }
    
             if InStr(FlaskTypeStr, "FlaskUtility")
             {
                FlasksData[A_Index].EffectDuration:=ReadMemUInt(pH,FlaskLocalstatsPtr+0x4)
             }
          }
       }
    }
    
    IsInGame(hwnd)
    {
    	if (hwnd=0 || hwnd="")
    		return false
    	GetWindowBasics(hwnd,mBase,pH)
    	if (mBase="" || mBase=0 || pH="" || pH=-1)
    		return false
    	fBase:=GetFrameBase(hwnd)
    	if (fBase="" || fBase=0)
    		return false
    	localConnection:=ReadMemUInt(pH,fBase+0xc0)
    	if (localConnection=0 || localConnection="")
    		return false
    	else
    		return true
    }
    
    SetGameStateMenu(hwnd)
    {
    	if (hwnd=0 || hwnd="")
    		return false
    	GetWindowBasics(hwnd,mBase,pH)
    	if (mBase="" || mBase=0 || pH="" || pH=-1)
    		return false
    	fBase:=GetFrameBase(hwnd)
    	if (fBase="" || fBase=0)
    		return false
    	localConnection:=ReadMemUInt(pH,fBase+0xc0)
    	if (localConnection!="" && localConnection!=0)
    	{
    		WriteMemUInt(pH,localConnection+0x2678,1)
    	}
    }
    
    ReadHeroPos(hwnd,ByRef x, ByRef y)
    {
       GetWindowBasics(hwnd,mBase,pH)
       if (mBase!=0 && pH && pH!=-1)
       {
          FrameBase:=GetFrameBase(hwnd)
          x:=ReadMemFloat(pH,FrameBase+0x16ac)
          y:=ReadMemFloat(pH,FrameBase+0x16b0)
          return true
       }   
    }
    
    
    
    
    ScreenToClient(hwnd, ByRef x, ByRef y)
    {
        VarSetCapacity(pt, 8)
        NumPut(x, pt, 0)
        NumPut(y, pt, 4)
        DllCall("ScreenToClient", "uint", hwnd, "uint", &pt)
        x := NumGet(pt, 0, "int")
        y := NumGet(pt, 4, "int")
       VarSetCapacity(pt, 0)
    }
    
    GetClientCoords(byRef mx, byRef my)
    {
       hwnd:=WinActive("A")   
       CoordMode, Mouse, Screen
       MouseGetPos, mx, my
       ScreenToClient(hwnd,mx,my) ;  x 580   y 435
    }
    
    
    
    QuitToLoginScreen(hwnd)
    {	
    	if (!IsInGame(hwnd))
    	{
    		return
    	}
    	SetGameStateMenu(hwnd)
    }
    
    GetMaxChargesFlaskOfType(ByRef FlasksData,TypeStr)
    {
       currMaxCharges:=0
       Loop, 5
          if (InStr(FlasksData[A_Index].type,TypeStr))
          {
             if FlasksData[A_Index].ChargesCurrent>currMaxCharges
             {
                currMaxI:=A_Index
                currMaxCharges:=FlasksData[A_Index].ChargesCurrent
             }
          }
       return currMaxI
    }
    
    AutoPotions()
    {
       global autoPotionsWatchdogPeriod
       global lagCompensation
       global PlayerConfig
       global WindowQueuedFlaskEffects
       global cliname
       global cliexe
       global trayNotifications
       global autoQuitMode
       
       if (autoPotionsState!=true)
          return
    
       WinGet, WinID, List, %cliname%
       
       Loop, %WinID%
       {
          
          WinGet, ProcModuleName, ProcessName,  % "ahk_id" WinID%A_Index%
          
          If(ProcModuleName!=cliexe) ; got a window with title "Path of Exile" but exe is not Client.exe, perhaps we have browser window open with PoE site, ignore it
             continue
          
          if (!IsInGame(WinID%A_Index%)) ;not ingame
             continue
    		 
    	if (WinID%A_Index%=WinActive("A"))
    	   ThisID:=WinActive("A")
          
          PlayerStats:={}
          ReadPlayerStats(WinID%A_Index%, PlayerStats)
          if (PlayerStats.MaxHP<1 || PlayerStats.CurrHP=0) ;dead, don't bother
             continue
    
          if (PlayerConfig.HasKey(PlayerStats.Name))
             CurrentConfig:=PlayerConfig[PlayerStats.Name]
          else
             CurrentConfig:=PlayerConfig["Default"]
             
          
          if PlayerStats.MaxNShield>0
          {
             currNShieldRatio:=PlayerStats.CurrNShield/PlayerStats.MaxNShield
          }
          
          if (PlayerStats.MaxHP>1)
          {
             currLifeRatio:=PlayerStats.CurrHP/(PlayerStats.MaxHP-PlayerStats.ReservedHPFlat-PlayerStats.MaxHP*PlayerStats.ReservedHPPercent/100)
          }
          
          if CurrentConfig.HasZealotsOath
          {
             currLifeRatio:=currNShieldRatio
          }
             
          if (PlayerStats.MaxMana>0)
          {
             currManaRatio:=PlayerStats.CurrMana/(PlayerStats.MaxMana-PlayerStats.ReservedManaFlat-PlayerStats.MaxMana*PlayerStats.ReservedManaPercent/100)
          }
          
          if (currLifeRatio<CurrentConfig.minLifeRatioToQuit || currNShieldRatio<CurrentConfig.minNShieldRatioToQuit)
          {
             if (autoQuitMode=0)
             {
                TrayTip, PoE autoPotions AutoQuit by closing window, specified min life reached, %A_Space% , 2
                WinKill, % "ahk_id" WinID%A_Index%
             }
             else if (autoQuitMode=1)
             {
                QuitToLoginScreen(WinID%A_Index%)
             }
    		 else if (autoQuitMode=2)
    		 {
    			ExitToCharacterSelection()
    		 }
    		 else if (autoQuitMode=3)
    		 {
    			UsePortal()
    		 }
    		 autoQuit:=1
             continue
          }
          
          if (CurrentConfig.disableAutoPotions)
             continue
          
          FlasksData:=[]
          ReadFlasksData(WinID%A_Index%,FlasksData)
          
          WinGet, CurrPID, PID,  % "ahk_id" WinID%A_Index%
          hwnd:=WinID%A_Index%
          k="%hwnd%%CurrPid%"
          if (!WindowQueuedFlaskEffects.HasKey(k))
          {
             WindowQueuedFlaskEffects[k]:={}
          }
          
          if (currLifeRatio<CurrentConfig.minLifeRatioToPopGranite || currNShieldRatio<CurrentConfig.minNShieldRatioToPopGranite)
             if ((!WindowQueuedFlaskEffects[k].HasKey("graniteQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].graniteQueueEndtime-lagCompensation)))
                {
                   flaskNum:=GetMaxChargesFlaskOfType(FlasksData,"FlaskUtility5") ; granite flask
                   if (flaskNum!="")
                   {
                      if CurrentConfig.FlaskConfig[flaskNum].HasKey("OverrideFlaskDuration")
                         EffectDuration:=CurrentConfig.FlaskConfig[flaskNum].OverrideFlaskDuration
                      else
                         EffectDuration:=FlasksData[flaskNum].EffectDuration
                         
                      WindowQueuedFlaskEffects[k].graniteQueueEndtime:=A_TickCount+EffectDuration*100
    
                      if (trayNotifications)
                      {
                         pname:=PlayerStats.Name
                         TrayTip, PoE autoPotions popping Granite flask %flaskNum% on %pname%, %A_Space% , 2
                      }
                      hKey:=CurrentConfig.FlaskConfig[flaskNum].Hotkey
                      ControlSend,,%hkey%, % "ahk_id" hwnd
                      break
                   }
                }
    
          if (currLifeRatio<CurrentConfig.minLifeRatioToPopJade || currNShieldRatio<CurrentConfig.minNShieldRatioToPopJade)
             if ((!WindowQueuedFlaskEffects[k].HasKey("jadeQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].jadeQueueEndtime-lagCompensation)))
                {
                   flaskNum:=GetMaxChargesFlaskOfType(FlasksData,"FlaskUtility9") ; jade flask
                   if (flaskNum!="")
                   {
                      if CurrentConfig.FlaskConfig[flaskNum].HasKey("OverrideFlaskDuration")
                         EffectDuration:=CurrentConfig.FlaskConfig[flaskNum].OverrideFlaskDuration
                      else
                         EffectDuration:=FlasksData[flaskNum].EffectDuration
                         
                      WindowQueuedFlaskEffects[k].jadeQueueEndtime:=A_TickCount+EffectDuration*100
    
                      if (trayNotifications)
                      {
                         pname:=PlayerStats.Name
                         TrayTip, PoE autoPotions popping Jade flask %flaskNum% on %pname%, %A_Space% , 2
                      }
                      hKey:=CurrentConfig.FlaskConfig[flaskNum].Hotkey
                      ControlSend,,%hkey%, % "ahk_id" hwnd
                      break
                   }
                }
    
          if (currLifeRatio=1)
             WindowQueuedFlaskEffects[k].hpQueueEndtime:=A_TickCount
          
          if (currManaRatio=1)
             WindowQueuedFlaskEffects[k].ManaQueueEndtime:=A_TickCount
          
          if (currLifeRatio<CurrentConfig.minLifeRatioToDrink || (PlayerStats.CurrHP<CurrentConfig.minLifeToDrink))
             if ((!WindowQueuedFlaskEffects[k].HasKey("hpQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].hpQueueEndtime-lagCompensation)))
             {
                      tflaskNum1:=GetMaxChargesFlaskOfType(FlasksData,"FlaskLife")
                      tflaskNum2:=GetMaxChargesFlaskOfType(FlasksData,"FlaskHybrid")
                      if ((tflaskNum1!=) && (tflaskNum2!=))
                         flaskNum:=(FlasksData[tflaskNum1].ChargesCurrent>FlasksData[tflaskNum2].ChargesCurrent) ? tflaskNum1 : tflaskNum2
                      else
                      {
                         if (tflaskNum1!="")
                            flaskNum:=tflaskNum1
                         if (tflaskNum2!="")
                            flaskNum:=tflaskNum2
                      }
                      if (flaskNum!="")
                      {
                         if CurrentConfig.FlaskConfig[flaskNum].HasKey("OverrideFlaskDuration")
                            EffectDuration:=CurrentConfig.FlaskConfig[flaskNum].OverrideFlaskDuration
                         else
                            EffectDuration:=FlasksData[flaskNum].EffectDuration
                         
                         if ((CurrentConfig.FlaskConfig[flaskNum].instantRecoveryOnLowLife) && ((PlayerStats.CurrHP/PlayerStats.MaxHP)<=0.35)) ; "Low life" can be caused by auras hp reservation from blood magic
                            EffectDuration:=lagCompensation
                            
                         WindowQueuedFlaskEffects[k].hpQueueEndtime:=A_TickCount+EffectDuration*100
                         if (FlasksData[flaskNum].HasKey("ManaRegAmount")) ; hybrid flask
                            WindowQueuedFlaskEffects[k].ManaQueueEndtime:=A_TickCount+EffectDuration*100
    
                         if (trayNotifications)
                         {
                            pname:=PlayerStats.Name
                            TrayTip, PoE autoPotions sipping HP flask %flaskNum% on %pname%, %A_Space% , 2
                         }
                         hKey:=CurrentConfig.FlaskConfig[flaskNum].Hotkey
                         ControlSend,,%hkey%, % "ahk_id" hwnd
                         break
                      }
                }
    
          if (PlayerStats.MaxMana>0 && (currManaRatio<CurrentConfig.minManaRatioToDrink || PlayerStats.CurrMana<CurrentConfig.minManaToDrink))      
             if ((!WindowQueuedFlaskEffects[k].HasKey("ManaQueueEndtime")) || (A_TickCount>=(WindowQueuedFlaskEffects[k].ManaQueueEndtime-lagCompensation)))
             {
                   tflaskNum1:=GetMaxChargesFlaskOfType(FlasksData,"FlaskMana")
                   tflaskNum2:=GetMaxChargesFlaskOfType(FlasksData,"FlaskHybrid")
                   
                   if ((tflaskNum1!=) && (tflaskNum2!=))
                      flaskNum:=(FlasksData[tflaskNum1].ChargesCurrent>FlasksData[tflaskNum2].ChargesCurrent) ? tflaskNum1 : tflaskNum2
                   else
                   {
                      if (tflaskNum1!="")
                         flaskNum:=tflaskNum1
                      if (tflaskNum2!="")
                         flaskNum:=tflaskNum2
                   }
    
                   if (flaskNum!="")
                   {
                      if CurrentConfig.FlaskConfig[flaskNum].HasKey("OverrideFlaskDuration")
                         {
                            EffectDuration:=CurrentConfig.FlaskConfig[flaskNum].OverrideFlaskDuration
                         }
                      else
                         EffectDuration:=FlasksData[flaskNum].EffectDuration
    
                      if ((CurrentConfig.FlaskConfig[flaskNum].instantRecoveryOnLowLife) && ((PlayerStats.CurrHP/PlayerStats.MaxHP)<=0.35))
                         EffectDuration:=lagCompensation
                      
                      WindowQueuedFlaskEffects[k].ManaQueueEndtime:=A_TickCount+EffectDuration*100
                      if (FlasksData[flaskNum].HasKey("HPRegAmount")) ; hybrid flask
                         WindowQueuedFlaskEffects[k].hpQueueEndtime:=A_TickCount+EffectDuration*100
                      
                      hKey:=CurrentConfig.FlaskConfig[flaskNum].Hotkey
                      if (trayNotifications)
                      {
                         pname:=PlayerStats.Name
                         TrayTip, PoE autoPotions sipping mana flask %flaskNum% on %pname%, %A_Space% , 2
                      }
                      ControlSend,,%hkey%, % "ahk_id" hwnd
                      break
                   }
             }               
       }
       
        if ((autoQuit=1) && (ThisID!="") && (ThisID!=WinActive("A")))
          WinActivate, % "ahk_id" ThisID
    
       Sleep, %autoPotionsWatchdogPeriod%   
    }
    
    
    UsePortal()
    {
    	BlockInput On
    	SendMode Input
    	hwnd:=WinActive("A")
    	GetKeyState, stateR, RButton, P
    	if stateR = D
    	{
    		Send {RButton up}
    	}
    	GetKeyState, stateL, LButton, P
    	if stateL = D
    	{
    		Send {LButton up}
    	}
    	GetKeyState, stateM, MButton, P
    	if stateM = D
    	{
    		Send {MButton up}
    	}
    	GetKeyState, stateQ, Q, P
    	if stateQ = D
    	{
    		Send {Q up}
    	}
    	GetKeyState, stateW, W, P
    	if stateW = D
    	{
    		Send {W up}
    	}
    	GetKeyState, stateE, E, P
    	if stateE = D
    	{
    		Send {E up}
    	}
    	GetKeyState, stateR, R, P
    	if stateR = D
    	{
    		Send {R up}
    	}
    	GetKeyState, stateT, T, P
    	if stateT = D
    	{
    		Send {T up}
    	}
    	GetKeyState, stateI, I, P
    	if stateI = D
    	{
    		Send {I up}
    	}
    	GetKeyState, stateSP, SPACE, P
    	if stateSP = D
    	{
    		Send {SPACE up}
    	}
    	GetKeyState, stateSH, SHIFT, P
    	if stateSH = D
    	{
    		Send {SHIFT up}
    	}
    	ReadClientResolution(hwnd,w,h)
    	Send {SPACE}
    	Send {ENTER}
    	Send {Raw} /oos
    	Send {ENTER}
    	Send {i}
    	ErrorLevel = 1
    	Sleep, 50
    	PixelSearch, ScrollX, ScrollY, w/2, h/2, w, h, 0xFFFFFF, 0, fast	
    	If ErrorLevel = 0
    	MouseMove, (ScrollX), (ScrollY),0
    	else
    	{
    		BlockInput Off
    		return
    	}
    	Send {RButton}
    	Send {SPACE}
    	Sleep, 50
    	MouseMove, (w/2), (h/2),0
    	Sleep, 50
    	Send {LButton}
    	sleep, 250
    	Loop
    	{
    		ErrorLevel = 1
    		PixelSearch, PixX, PixY, (w/4), (h/10), ((w/4)*3), h, 0xddbb30, 34, fast  ;0xdcc8c8 text color
    		if ErrorLevel = 0
    		{
    			MouseMove, (PixX), (PixY),0
    			Sleep, 50
    			Send {LButton}
    			Loop ;only search for portals when not moving
    			{	
    				ReadHeroPos(hwnd,PosX1,PosY1)
    				sleep, 30
    				ReadHeroPos(hwnd,PosX2,PosY2)
    				if PosX1 = %PosX2%
    				{
    					If PosY1 = %PosY2%
    					{
    						break
    					}
    			
    				}
    				else
    				sleep, 30
    			}
    		}
    		else
    		{
    			Break
    		}
    	}
    	Sleep, 50
    	MouseMove, (w/2), (h/2),0
    	Sleep, 50
    	Send {LButton}
    	Sleep, 50
    	BlockInput Off
    }
    
    
    ExitToCharacterSelection()
    {
    	BlockInput On
    	SendMode Input
    	hwnd:=WinActive("A")
    	GetKeyState, stateR, RButton, P
    	if stateR = D
    	{
    		Send {RButton up}
    	}
    	GetKeyState, stateL, LButton, P
    	if stateL = D
    	{
    		Send {LButton up}
    	}
    	GetKeyState, stateM, MButton, P
    	if stateM = D
    	{
    		Send {MButton up}
    	}
    	GetKeyState, stateQ, Q, P
    	if stateQ = D
    	{
    		Send {Q up}
    	}
    	GetKeyState, stateW, W, P
    	if stateW = D
    	{
    		Send {W up}
    	}
    	GetKeyState, stateE, E, P
    	if stateE = D
    	{
    		Send {E up}
    	}
    	GetKeyState, stateR, R, P
    	if stateR = D
    	{
    		Send {R up}
    	}
    	GetKeyState, stateT, T, P
    	if stateT = D
    	{
    		Send {T up}
    	}
    	GetKeyState, stateI, I, P
    	if stateI = D
    	{
    		Send {I up}
    	}
    	GetKeyState, stateSP, SPACE, P
    	if stateSP = D
    	{
    		Send {SPACE up}
    	}
    	GetKeyState, stateSH, SHIFT, P
    	if stateSH = D
    	{
    		Send {SHIFT up}
    	}
    	Send {SPACE}
    	Send {ESC}
    	ReadClientResolution(hwnd,w,h)
    	MouseMove, (w/2), ((h/2)- ((h-674.4)/6.24))  ;Might have to change the height in this line to work.
    	Send {LButton}
    	Sleep, 500
    	BlockInput Off
    }
    
    
    TradeChat()
    {
    	BlockInput On
    	SendMode Input
    	loop
    	{
    		Send {ENTER}
    		Send /trade %A_Index%
    		Send {ENTER}
    		Send {ENTER}	
    		Send {Up 2}
    		Sleep, 150
    		Send {ENTER}
    		If A_Index = 10
    		Break
    		else
    		Sleep, 100
    	}
    	BlockInput Off
    }
    
    
    F1::
       global autoPotionsState
       global trayNotifications
       autoPotionsState:=not autoPotionsState
       if (trayNotifications)
       {
          if (autoPotionsState=true)
             TrayTip, PoE autoPotions is on, %A_Space% , 2
          else
             TrayTip, PoE autoPotions is off, %A_Space%  , 2
       }
    return
    
    F2::
    	UsePortal()
    return
    
    F3::
    	ExitToCharacterSelection()
    return
    
    F4::
       QuitToLoginScreen(WinActive("A"))
    return
    Last edited by Nipper; 12-16-2013 at 06:52 PM.

  7. #52
    Contributor CoreCoins User gurud's Avatar
    Reputation
    123
    Join Date
    Oct 2013
    Posts
    223
    Thanks G/R
    0/25
    CoreCoins
    23324
    Trade Feedback
    0 (0%)
    Quote Originally Posted by Nipper View Post
    Mine does the same as his by the way. Just finds then quits. Thats why I requested a way to disable the quit with the drop down and not using the sliders. Even if I disabled it via changing the autoquit to 10 like did in older scripts which owrks for them. It wont quit. But wont auto flask.

    Here is the one I am using now. It is the same but took of a few things that were not needed.
    edit: Nevermind, bug fixed
    Last edited by gurud; 12-16-2013 at 09:21 PM.

  8. #53
    Member masterpulha's Avatar
    Reputation
    1
    Join Date
    Aug 2012
    Posts
    17
    Thanks G/R
    0/0
    CoreCoins
    7
    Trade Feedback
    0 (0%)
    Hey, thx

    I have the right version.
    vmware7.1.6
    Win7 86x lite
    AutoHotkey UNICODE 32 bit v

    sorry, reinstalled and got exactly the same as in video

  9. #54
    Contributor CoreCoins User gurud's Avatar
    Reputation
    123
    Join Date
    Oct 2013
    Posts
    223
    Thanks G/R
    0/25
    CoreCoins
    23324
    Trade Feedback
    0 (0%)
    UPDATE 12/16/2013

    AutoQuit Bug is now fixed, Script Updated in the first Post.

    The bug was auto quitting characters that had no energy shield.

    Fixed by adding this else statement:

    Code:
          if PlayerStats.MaxNShield>0
          {
             currNShieldRatio:=PlayerStats.CurrNShield/PlayerStats.MaxNShield
          }
          else 
          currNShieldRatio:= 1

    Thanks for the input on it.

  10. #55
    Private IHateThisGame's Avatar
    Reputation
    1
    Join Date
    Sep 2013
    Posts
    2
    Thanks G/R
    0/0
    CoreCoins
    0
    Trade Feedback
    0 (0%)
    It does not currently support CI. I'm being auto logged out everytime.

  11. #56
    Member masterpulha's Avatar
    Reputation
    1
    Join Date
    Aug 2012
    Posts
    17
    Thanks G/R
    0/0
    CoreCoins
    7
    Trade Feedback
    0 (0%)
    Thank you! ill test it later asap!!

  12. #57
    Contributor CoreCoins User gurud's Avatar
    Reputation
    123
    Join Date
    Oct 2013
    Posts
    223
    Thanks G/R
    0/25
    CoreCoins
    23324
    Trade Feedback
    0 (0%)
    Quote Originally Posted by IHateThisGame View Post
    It does not currently support CI. I'm being auto logged out everytime.
    I Updated the script again, see if that solves your issue, and report here, since i don't have a CI build to test myself.


    Also, Added a Disabled option on AutoQuit Method, as requested by Nipper, so now you don't need to put the Life and Es Percent to Quit sliders to 0 to disabled autoquit. (even tho now it's working properly)
    Last edited by gurud; 12-17-2013 at 09:11 AM.

  13. #58
    Master Sergeant PerfectMiscreation's Avatar
    Reputation
    2
    Join Date
    Jun 2013
    Posts
    97
    Thanks G/R
    0/0
    CoreCoins
    36
    Trade Feedback
    0 (0%)
    Am I the only one getting long delays between Mana potting?

  14. #59
    Member murcielago14's Avatar
    Reputation
    1
    Join Date
    Jun 2012
    Posts
    7
    Thanks G/R
    1/0
    CoreCoins
    0
    Trade Feedback
    0 (0%)
    Really loving the GUI so far, seems to work smoothly! +1

    I do have a problem tho, for some reason it keeps using my 'Divination Distallate' as the main source for regenerating my health/mana -- Would it be possible to stop it from doing so? I would like to be the only one activating that pot. Thanks

  15. #60
    Knight-Lieutenant CoreCoins User ReadyToKill's Avatar
    Reputation
    10
    Join Date
    Sep 2012
    Posts
    334
    Thanks G/R
    4/3
    CoreCoins
    453
    Trade Feedback
    0 (0%)
    Not sure if this breaks hybrid pots, but i since i don't use them and use the IQ/IR flask manually change this in the autoflask script

    tflaskNum2:=GetMaxChargesFlaskOfType(FlasksData,"FlaskHybrid")
    to
    tflaskNum2:=GetMaxChargesFlaskOfType(FlasksData,"FlaskDisabled")

    there is 2 spots that needs to be renamed, so just search for it.

 

 

Similar Threads

  1. How to download and update addons when curse is down, with wowmatrix
    By Stans Dad in forum World of Warcraft Guides
    Replies: 27
    Last Post: 06-22-2011, 07:56 PM
  2. Replies: 481
    Last Post: 08-17-2009, 11:33 PM
  3. [Show off] look at my new and updated sig.
    By shadowste in forum Art & Graphic Design
    Replies: 7
    Last Post: 03-31-2008, 01:56 PM
  4. Enchant Scam Improved and maybe unbannable
    By BlackFog in forum WoW Scam Prevention
    Replies: 13
    Last Post: 01-25-2008, 02:37 PM
All times are GMT -5. The time now is 02:05 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2017 vBulletin Solutions, Inc. All rights reserved. Digital Point modules: Sphinx-based search