Page 1 of 1

Mage Bot v1.0 - Macro

Posted: July 24th, 2005, 9:06 pm
by khaotic3
for actool

Code: Select all

SetActiveWindow Knight OnLine Client
ObjVar 10
CommandDelay 500
KeyRate 100

Constants
     AttackKey1 = 1  // The key used to attack, can't be r, must be in shortcut bar (u can use archery skill)
     AttackKey2 = 2
     AttackKey3 = 3 // your failsafe attack
     HealKey = 7 // the shortcut where u have hp pots
     ManaKey = 6 // the shortcut where u have mana pots
     WolfKey = 5 // the shortcut where u have wolf
     BackupHPPotKey = 8 // the backup health pot, make sure it's not the same as the usual hp pots
                                                                               // cause it's to be used when u have very low hp, to be able to town
     HPScrollKey = 4 // HP scroll shortcut key
     ACScrollKey = 7 // AC scroll shortcut key
     DexScrollKey = 8 // Dex scroll shortcut key
     
     // This are pretty self expanatory!! ( 1 to enable, 0 to disable)
     UseWolf = 0
     UseHPScroll = 1
     UseACScroll = 0
     UseDexScroll = 0

     PotHP = 50 // If hp is less or equal than this value then drop a HP pot
     CriticalHP = 100 // if HP is less or equal than this value then drop backup pots till enough to town and
     RestHP = 150 // if HP is less or equal than this value then take a rest                                                            // town, after that, sits, and stops script
     PotMana = 100 // If mana is less or equal than this value drops a mana pot
     ManaRest = 300 // If mana is less or equal than this value, rest until your mana is fully replenished
     
     ///////////////////////////////////////////////////////
     // DON'T TOUCH BELOW UNLESS U KNOW WHAT U'RE DOING!! //
     ///////////////////////////////////////////////////////
     BaseMemoryLocation = 7AE004
     TotalHPMemAddress = noValue
     HPMemAddress = noValue
     TotalManaMemAddress = noValue
     ManaMemAddress = noValue
     BaseMemoryAddress = noValue
     ChkForWolf = 1      
End

Procedure SetupMemoryAdresses
     ReadMemory $BaseMemoryAddress = $BaseMemoryLocation, LongWord

     Compute $TotalHPMemAddress = $BaseMemoryAddress + 936
     Compute $HPMemAddress = $BaseMemoryAddress + 940
     Compute $TotalManaMemAddress = $BaseMemoryAddress + 1800
     Compute $ManaMemAddress = $BaseMemoryAddress + 1804

     DecToHex $TotalHPMemAddress = $TotalHPMemAddress
     DecToHex $HPMemAddress = $HPMemAddress
     DecToHex $TotalManaMemAddress = $TotalManaMemAddress
     DecToHex $ManaMemAddress = $ManaMemAddress
End

Procedure CheckHealth
     Constants
             CurrentHP = noValue
             LastHP = noValue
             TotalHP = noValue    
     End
                                                                                                                                                                                                   
     ReadMemory $CurrentHP = $HPMemAddress
     If $CurrentHP <= $CriticalHP
             Call Town
             Exit
     End
     
     If $CurrentHP <= $RestHP
             Call HPRest
     End
     
     If $CurrentHP <= $PotHP
             Keys $HealKey
     End
End
                                                                                                                                                                                                   
Procedure CheckMana
     Constants
             CurrentMana = noValue
             LastMana = noValue
             TotalMana = noValue
     End
                                                                                                                                                                                                   
     ReadMemory $CurrentMana = $ManaMemAddress
     If $CurrentMana <= $ManaRest
             Call ManaRest
             Exit
     End
                                                                                                                                                                                                   
     If $CurrentMana <= $PotMana
             Keys $ManaKey
     End
End
                                                                                                                                                                                                   
Procedure CheckWolf
     If $UseWolf = 0
             Exit
     End
                                                                                                                                                                                                   
     If $ChkForWolf = 1
             Delay 1500
             Keys $WolfKey
             Delay 2 sec
             SetConst ChkForWolf = 0
     End
End
                                                                                                                                                                                                   
Procedure WolfTime every 125 sec
     If $ChkForWolf = 0
             SetConst ChkForWolf = 1
     End
End

Procedure DoScrolls every 305 sec
     If $UseHPScroll = 1
             Delay 500
             Keys $HPScrollKey
     End
                                                                                                                                                                                                   
     If $UseACScroll = 1
             Delay 500
             Keys $ACScrollKey
     End
                                                                                                                                                                                                   
     If $UseDexScroll = 1
             Delay 500
             Keys $DexScrollKey
     End
End

Procedure HPRest
                                                                                                                                                                                                           
     ReadMemory $LastHP = $HPMemAddress
     Delay 2 sec
     Keys c
     Loop 60
             ReadMemory $CurrentHP = $HPMemAddress
             If $CurrentHP < $LastHP
                     Exit
                     Setconst LastHP = $CurrentHP
             End
             ReadMemory $CurrentHP = $HPMemAddress
             ReadMemory $TotalHP = $TotalManaMemAddress
             If $CurrentHP = $TotalHP
                   Exit
             End
             Delay 1 sec
     End
End
                                                                                                                                                                                               
Procedure ManaRest
                                                                                                                                                                                                           
     ReadMemory $LastHP = $HPMemAddress
     Delay 2 sec
     Keys c
     Loop 60
             ReadMemory $CurrentHP = $HPMemAddress
             If $CurrentHP < $LastHP
                     Exit
                     Setconst LastHP = $CurrentHP
             End
             ReadMemory $CurrentMana = $ManaMemAddress
             ReadMemory $TotalMana = $TotalManaMemAddress
             If $CurrentMana = $TotalMana
                   Exit
             End
             Delay 1 sec
     End
End
                                                                                                                                                                                                   
Procedure Town
ReadMemory $CurrentHP = $HPMemAddress
 If $CurrentHP <= $CriticalHP
     Keys $BackupHPPotKey
     Delay 1 sec
     keydown h 100
     delay 100
     MousePos 885,340
     LeftMouseDown
     delay 100
   LeftMouseUp
     delay 300
     keydown {RETURN}
     Delay 2 sec
     Keys c
     Stop
End
End

Procedure Attack
     Keys z
     Keys $AttackKey1 300
     Keys $AttackKey2 300
     Keys $AttackKey3 300
     Keys $AttackKey3 300
End
                                                                                                                                                                                                   
Call SetupMemoryAdresses
//Say /Block_Party
//Say /Block_Trade_Request
While 1=1
     ProcessMessages
     Delay 150
     Call CheckHealth
     Call CheckMana
     Call CheckWolf
     Call Attack
End
End

Posted: July 25th, 2005, 8:33 am
by haxhax
nice copy and paste off !@#$%^&*

btw only works on v1279