Post Reply Home » Forums » Knight Online » KO Submissions

My unfinished Macro source : KO Submissions

Posted: May 3rd, 2005
tault_arad
long time ago, very long time ago, i played KO and made an autoit 3 macro.
like i usually do, when i was about to finish it i stopped playing KO and stopped making the macro.
now, about a year later i decided to show you the source code, maybe it will help u.
this macro is for old KO, when there were just ARES 1 and ARES 2, maybe some other stuff are different too.
i made the macro for all characters, u can choose your'e attack squence, check the ini for feathers.

the files are the autoit 3 file (EXE), KO.ini- settings Beep1.wav and Beep2.wav- low health sounds.
here i'll just post the source and the ini.
never finished the mana system but its the same like the HP with different colors and cords, here's the KO.ini:


***made by 3PF/Arad/Killer-a:***

Code: Select all


[Global]

;//Your KO folder.
KOPath=C:\Program Files\KnightOnline\

;//Your KO exe name.
EXEName=KnightOnline.exe

;//KO Window title.
WinTitle=Knight OnLine Client

;//While in game, show information about the script actions. (0 for off)
ShowInfo=1

;//Key that will reload the bot's settings.
ReloadSettingsKey=F10

********************************************************

[Login]

;//To lunch the game and login at all? (0 for no)
ToggleLogin=1

;//Account Name
AccountName=Arad

;//Account Password
AccountPassword=vrumj

;//Character location, 1 2 3, for left character  1, for middle character 2 and for right character 3.
CharLocation=2

;//What Ares to log into
ARES=1

;//Your race, needed for pixel detection. (Human or Orc)
Race=Human

********************************************************

[Health&Mana]

;//Key to Toggle Health&Mana On and Off
ToggleHealthKey=F5

;//Beep while you HP is lower than a certain %. 0 if off. (A number between 1 and 100)
HpBeep1=75

;//Same as HpBeep1, but other beep, off by default.
HpBeep2=0

;//When your HP gets to certain %, use healing potion. 0 is off (A number between 1 and 100)
HpPotion=50

;//Healing Potion toolbar (F1/F2/F3/F4)
HpPotionF=F1

;//Healing Potion key. (1-8)
HpPotionNumber=8

;//When your MP gets to certain %, use mana potion. 0 is off (A number between 1 and 100)
MpPotion=5

;//Mana Potion toolbar (F1/F2/F3/F4)
MpPotionF=F2

;//Mana Potion key. (1-8)
MpPotionNumber=6

********************************************************

[AutoAttack]

;//Key to Start/Stop Automatic Attacking.
StartStopAttackKey=F11

;//Auto Attack Sequence after selection a target.
;//Hotkey,Repeat,Delay;Key,RepeatDelay;... etc.
;//Delay is in miliseconds, 1000=1 second
;//Example: 1,1,2500;2,1,2500;1,1,1500;3,2,3000;
;//This will attack with skill 1, and wait 2.5 seconds, after that it will use skill 2 and wait 2.5 seconds, and the use skill 3 twice, with 3 seconds delay.
;//To start normal attack, write R in the Hotkey place.
;//Example: R,1,2000;1,2,2000;2,1:2500;
AttackSequence=1,1,2500;2,1,2500;1,1,1500;3,2,3000;

********************************************************

Macro Source(au3 file):

Code: Select all

Opt("CaretCoordMode", 0)
Opt("MouseCoordMode", 0)
Opt("PixelCoordMode", 0)
Opt("TrayIconDebug", 1)

;ini Read

;Global
$KOPath = iniRead("KO.ini", "Global", "KOPath", "")
$EXEName = IniRead("KO.ini", "Global", "EXEName", "")
$WinTitle = IniRead("KO.ini", "Global", "WinTitle", "")
$ShowInfo = IniRead("KO.ini", "Global", "ShowInfo", "")
$ReloadSettingsKey = IniRead("KO.ini", "Global", "ReloadSettingsKey", "")

;Login
$ToggleLogin = IniRead("KO.ini", "Login", "ToggleLogin", "")
$AccountName = IniRead("KO.ini", "Login", "AccountName", "")
$AccountPassword = IniRead("KO.ini", "Login", "AccountPassword", "")
$CharLocation = IniRead("KO.ini", "Login", "CharLocation", "")
$ARES = IniRead("KO.ini", "Login", "ARES", "")
$Race = IniRead("KO.ini", "Login", "Race", "")

;Health&Mana
$HpBeep1 = IniRead("KO.ini", "Health&Mana", "HpBeep1", "")
$HpBeep2 = IniRead("KO.ini", "Health&Mana", "HpBeep2", "")
$HpPotion = IniRead("KO.ini", "Health&Mana", "HpPotion", "")
$HpPotionF = IniRead("KO.ini", "Health&Mana", "HpPotionF", "")
$HpPotionNumber = IniRead("KO.ini", "Health&Mana", "HpPotionNumber", "")
$MpPotion = IniRead("KO.ini", "Health&Mana", "MpPotion", "")
$MpPotionF = IniRead("KO.ini", "Health&Mana", "MpPotionF", "")
$MpPotionNumber = IniRead("KO.ini", "Health&Mana", "MpPotionNumber", "")
$ToggleHealthKey = IniRead("KO.ini", "Health&Mana", "ToggleHealthKey", "")

;AutoAttack
$StartStopAttackKey = IniRead("KO.ini", "AutoAttack", "StartStopAttackKey", "")
$AttackSequence = IniRead("KO.ini", "AutoAttack", "AttackSequence", "")



Func ReloadSettings()

;Global
$KOPath = iniRead("KO.ini", "Global", "KOPath", "")
$EXEName = IniRead("KO.ini", "Global", "EXEName", "")
$WinTitle = IniRead("KO.ini", "Global", "WinTitle", "")
$ShowInfo = IniRead("KO.ini", "Global", "ShowInfo", "")

;Login
$AccountName = IniRead("KO.ini", "Login", "AccountName", "")
$AccountPassword = IniRead("KO.ini", "Login", "AccountPassword", "")
$CharLocation = IniRead("KO.ini", "Login", "CharLocation", "")
$ARES = IniRead("KO.ini", "Login", "ARES", "")
$Race = IniRead("KO.ini", "Login", "Race", "")

;Health&Mana
$HpBeep1 = IniRead("KO.ini", "Health&Mana", "HpBeep1", "")
$HpBeep2 = IniRead("KO.ini", "Health&Mana", "HpBeep2", "")
$HpPotion = IniRead("KO.ini", "Health&Mana", "HpPotion", "")
$HpPotionF = IniRead("KO.ini", "Health&Mana", "HpPotionF", "")
$HpPotionNumber = IniRead("KO.ini", "Health&Mana", "HpPotionNumber", "")
$MpPotion = IniRead("KO.ini", "Health&Mana", "MpPotion", "")
$MpPotionF = IniRead("KO.ini", "Health&Mana", "MpPotionF", "")
$MpPotionNumber = IniRead("KO.ini", "Health&Mana", "MpPotionNumber", "")
$ToggleHealthKey = IniRead("KO.ini", "Health&Mana", "ToggleHealthKey", "")

;AutoAttack
$StartStopAttackKey = IniRead("KO.ini", "AutoAttack", "StartStopAttackKey", "")
$AttackSequence = IniRead("KO.ini", "AutoAttack", "AttackSequence", "")

If ( $ShowInfo=1 ) Then
	SplashTextOn ( "", "Settings Reloaded" , 150 , 18 , 312 , 0 , 1 , "10")
	Sleep(3000)
	SplashOff()
EndIf

EndFunc


$StartMacro = MsgBox ( 1, "KnightOnline Macro By Arad", "This will start Knight Online Macro" )
If ( $StartMacro = 2 ) Then
    Exit 
EndIf
If ( $ToggleLogin = 1 ) Then
	Run ( $KOPath & "\" & $EXEName, $KOPath )
	WinWaitActive ( $WinTitle )
	
	$WaitIntro=1
	While $WaitIntro=1
	$IntroPix = PixelGetColor(46 , 735 )
	If ( $introPix = 4473924 ) Then
  	$WaitIntro=0
  EndIf
	Sleep(1000)
	$IntroPix = PixelGetColor(46 , 735 )
	WEnd
	
	Send($AccountName, 1);
	Send("{TAB}")
	Send($AccountPassword, 1)
	Send("{ENTER}")
	
	$WaitAres=1
	While $WaitAres=1
	$AresPix = PixelGetColor(33 , 17 )
	If ( $AresPix = 3355443 ) Then
  	$WaitAres=0
  EndIf
	Sleep(1000)
	$AresPix = PixelGetColor(33 , 17 )
	WEnd
	
	If ($ARES=1) Then
  Send("{DOWN}")
  Send("{ENTER}")
	else
  Send("{ENTER}")
	EndIf
	
	If ( $Race="Human" ) Then
  $CharRacePix=2499356
	EndIf
	If ( $Race="Orc" ) Then
  $CharRacePix=4868167
	else
  $CharRacePix=2499356
	EndIf
	
	$WaitChar=1
	While $WaitChar=1
	$CharPix = PixelGetColor(17 , 9 )
	If ( $CharPix = $CharRacePix ) Then
  	$WaitChar=0
  EndIf
	Sleep(4000)
	$CharPix = PixelGetColor(17 , 9 )
	WEnd
	
	
	If ($CharLocation=1) Then
  Send("{LEFT}")
  Sleep(1500)
  Send("{ENTER}")
	else
  If ($CharLocation=3) Then
  	Send("{RIGHT}")
  	Sleep(1500)
  	Send("{ENTER}")
  else
  	Send("{ENTER}")
  EndIf
	EndIf
	
	If ( $Race="Human" ) Then
  $GamePixColor=8934690
	EndIf
	If ( $Race="Orc" ) Then
  $GamePixColor=13417386
	else
  $GamePixColor=8934690
	EndIf
	
	$Waitloading=1
	While $Waitloading=1
	$GamePix = PixelGetColor(133 , 9 )
	If ( $GamePix = $GamePixColor ) Then
  $Waitloading=0
  If ( $ShowInfo=1 ) Then
  	SplashTextOn ( "", "Game Loaded" , 150 , 18 , 312 , 0 , 1 , "10")
  	Sleep(4000)
  	SplashOff()
  EndIf
	EndIf
	Sleep(3000)
	$GamePix = PixelGetColor(133 , 9 )
	WEnd

Endif


$StopAttack=0
$ToggleHealth=1
HotKeySet ( "{" & $StartStopAttackKey & "}", "AutoAttack" )
HotKeySet ( "{" & $ToggleHealthKey & "}", "ToggleHealth" )
HotKeySet ( "{" & $ReloadSettingsKey & "}", "LoadSettings" )


Func ToggleHealth()
If ( $ToggleHealth=1 ) Then
	$ToggleHealth=0
	If ( $ShowInfo=1 ) Then
  SplashTextOn ( "", "Health&Mana System is OFF" , 150 , 18 , 312 , 0 , 1 , "10")
  Sleep(3000)
  SplashOff()
;;;;ToolTip("Health&Mana System is OFF", 312, 0)
;;;;Sleep(3000)
;;;;ToolTip("", 312, 0)
	EndIf
Else
	If ( $ToggleHealth=0 ) Then
  $ToggleHealth=1
  If ( $ShowInfo=1 ) Then
  	SplashTextOn ( "", "Health&Mana System is ON" , 150 , 18 , 312 , 0 , 1 , "10")
  	Sleep(3000)
  	SplashOff()
; ;;;ToolTip("Health&Mana System is ON", 312, 0)
; ;;;Sleep(3000)
; ;;;ToolTip("", 312, 0)
  EndIf
	EndIf
EndIf
EndFunc


Func AutoAttack()

If ( $StopAttack=0 ) Then
	If ( $ShowInfo=1 ) Then
  SplashTextOn ( "", "Starting Auto Attack..." , 150 , 18 , 312 , 0 , 1 , "10")
  Sleep(2000)
  SplashOff()
;;;;ToolTip("Starting Auto Attack...", 312, 0)
;;;;Sleep(2000)
	EndIf
	$StopAttack=1
	StartAttack()

	Else
  If ( $StopAttack=1 ) Then
  	$StopAttack=0
  	If ( $ShowInfo=1 ) Then
    SplashTextOn ( "", "Stopping Attack..." , 150 , 18 , 312 , 0 , 1 , "10")
    Sleep(2500)
    SplashTextOn ( "", "Attack Stopped" , 150 , 18 , 312 , 0 , 1 , "10")
    Sleep(3000)
    SplashOff()
;  ;;;ToolTip("Stopping Attack...", 312, 0)
;  ;;;Sleep(2500)
;  ;;;ToolTip("Attack Stopped", 312, 0)
;  ;;;Sleep(4000)
;  ;;;ToolTip("", 312, 0)
  	EndIf
  EndIf

EndIf

EndFunc



Func StartAttack()
While $StopAttack=1

If ( $ShowInfo=1 ) Then
	SplashTextOn ( "", "Auto Attacking" , 150 , 18 , 312 , 0 , 1 , "10")
	Sleep(3000)
;;;;ToolTip("Auto Attacking", 312, 0)
;;;;Sleep(5000)
EndIf
Send("{b}")
Sleep(300)
$Attacks = StringSplit(StringTrimRight($AttackSequence, 1), ";")
For $i = 1 to $Attacks[0]

	$CurrentAttack = StringSplit($Attacks[$i], ",")
;$CurrentAttack[1] is the hotkey
;$CurrentAttack[2] is the # of repeats
;$CurrentAttack[3] is the delay


;begin attack sequence
	If ($CurrentAttack[2] > 1) Then
  Sleep(20)
  Send("{" & $CurrentAttack[1] & "}")
  Sleep($CurrentAttack[3])

	Else
  For $n = 1 to $CurrentAttack[2]
  	Sleep(20)
  	Send("{" & $CurrentAttack[1] & "}")
  	Sleep($CurrentAttack[3])
  Next
	EndIf
Next
WEnd
EndFunc


While 1
If ( $ToggleHealth=1 ) Then
	$HealthPix1=PixelGetColor( 161+$HpBeep1 , 9 )
	$HealthPix2=PixelGetColor( 161+$HpBeep2 , 9 )
	$HealthPixPotion=PixelGetColor( 161+$HpPotion , 9 )

	If ( $HealthPix1=16724787 ) Then
  Sleep(100)
	else
  If ( $HpBeep1>0 ) AND ( $HealthPix2=16724787) AND ( $HealthPixPotion=16724787 ) AND ( $HealthPix1=0 ) AND ( PixelGetColor(133 , 9 )=$GamePixColor ) Then
  	SoundPlay("Beep1.wav")
; ;;;Sleep(6000)
  else
  	If ( $HpBeep2>0 ) AND ( $HealthPixPotion=16724787) AND ( $HealthPix2=0 ) AND ( PixelGetColor(133 , 9 )=$GamePixColor ) Then
    SoundPlay("Beep2.wav")
;  ;;;Sleep(6000)
  	else
    If ( $HealthPixPotion=0 ) AND ( $HpPotion>0 ) AND ( PixelGetColor(133 , 9 ) =$GamePixColor ) Then
    	Send("{" & $HpPotionF & "}")
    	Send ($HpPotionNumber)
    	If ( $ShowInfo=1 ) Then
      SplashTextOn ( "", "Using Healing Potion..." , 150 , 18 , 312 , 0 , 1 , "10")
      Sleep(4000)
      SplashOff()
;    ;;;ToolTip("Using Healing Potion...", 312, 0)
;    ;;;Sleep(2500)
;    ;;;ToolTip("", 312, 0)
    	EndIf
    EndIf
  	EndIf
  EndIf
	EndIf
	Sleep(5000)
EndIf
WEnd


enjoy
Ready to join the community? Click here and see all of the benefits!
blue large dotWho is online
Users browsing this forum: No registered users and 20 guests