ACTOOL Farming bot

04/05/2010 23:21 Bambi666#1
A FFXI Melee farming bot by Dragoons Version 1.1

Copy and past to a txt rename to: *.mac
Second code Copy and past to a txt and rename to: ffxi_info.dat
Past the file into your ACTOOL macro folder.
Find the PID of POL.EXE you can use [Only registered and activated users can see links. Click Here To Register...]
launch FFXI with windower, in ff option set keyboard to compact mode

Macros:
Setup macros as needed. Change commands in parenthesis as needed

Ctrl 1- target
/targetnpc

Ctrl 2- lockon
/lockon

Ctrl 3- weapon skill
/ws "(your weapon skill's name)" <t>

Ctrl 4- attack
/attack

Ctrl 5- cure
/ma "(Cure I, II, III, etc.)" <me>

Ctrl 6- heal
/heal

Ctrl 7- pull
(use something like /ma Dia <t> or /ra <t>)

Ctrl 8- special attack *optional*
(use something like a nuke or ranged attack or whatever needed)

Code:
//Melee farming bot by Dragoons Version 1.1
//Need the PID method determined by edgecom. 


Constants

	window = 2132              // pol PID
	_delay				= 250					//Delay set higher if macro is to fast or messing up. Default = 250
	_keydelay 		= 200					//Key delay set higher if macro is to fast or messing up. Default = 200
	player = yourname						//Set to your characters name
	mob = none		 							//Set to none to target any mob otherwise set to part of a mob's name to target specific creatures. EX. Crawler to target all crawlers.
	invintorymax = 60						//Set to your maximum inventory (ex. 60, 55, 50 etc.)
	cure = 1										//Choose whether to automaticaly cure your charecter when hp gets low
	lowhp = 400									//Set to the amount of hp to start curing at
	weaponskill = 1							//Decide whether to use a weaponskill while meleeing.
	pull = 1										//Decide whether to use a method to claim the mob, highly suggested to make sure it doesn't move out of range. Put a pulling macro under ctrl 7
	specialattack = 1						//Decide whether to use a special attack such as ranged attack or nukes in the ctrl 8 macro
	attackdelay = 10000					//Set the delay needed to perform the special attack. Ex. if a ranged attack takes 5 seconds to complete set to 6 or more
	hp_rest = 1000							//Set to the hp for the bot to start resting at. Setting at max will rest if you are less than full. (default = max)
	mp_rest = 1000							//Set to the mp for the bot to start resting at. Setting at max will rest if you are less than full. (default = max)
	
//	Items to toss
//	Set each number to an item that you want to toss
	I0 = {null}
	I1 = {null}
	I2 = {null}
	I3 = {null}
	I4 = {null}
	I5 = {null}
	I6 = {null}
	I7 = {null}
	I8 = {null}
	I9 = {null}

// Dummy variables, leave alone
  foundit = 0
	right_mob = 0
	mob_name = 0
	scan = 0
	target = 0
	length = 0
End

Include .\FFXi_Info.dat

// This line is necessary to select the proper window
SetActiveWindow $window

//Checking for compact keyboard
If $info_keyboard <> 1
	Keys /echo error, keyboard is not in compact mode, please reset bot
	Stop
End

//changing the number fo hp and mp_rest to save computation time later
If $hp_rest = max
	Setconst hp_rest = $info_hp_max
End
If $mp_rest = max
	Setconst mp_rest = $info_mp_max
End

// Continue trying to find a target that is in attack range
Procedure findtarget
	Setconst mob_name = 0
	Setconst right_mob = 0
	Setconst length = 0
	While $right_mob = 0
		Keydown ^1 $_keydelay //target
		Delay $_delay
		Keydown d $_keydelay
		Delay $_delay
		Call checkmob
	End
	Keydown ^2 $_keydelay //lockon
	Delay $_delay
	Keydown w 10000
	Delay 2000
End


//	Make sure that the mob selected is the one specified
Procedure checkmob
	Strpos mob_name = $mob , $info_target_name
	Strlen length = $info_target_name
	Case
	When $mob = none and $info_target_stat = 0 and $length <> 1
		Setconst right_mob = 1
	When $mob_name <> 0 and $info_target_stat = 0
		Setconst right_mob = 1
	When $info_target_name = $player
		Setconst right_mob = 0
	End
End

//	Begin attacking the mob
Procedure fighttarget
	Call startmelee
	Setconst target = $info_target_name
	While $target = $info_target_name //while the target is still alive
		Delay 5000
		If $info_player_stat <> 1	//in case of a link
			Keydown ^4 $_keydelay //attack
			keydown d 100
			Delay 1000
		End
		If $weaponskill = 1
			Delay 1000
			Keydown ^3 $_keydelay //weaponskill
			Delay $_delay
		End
		If $specialattack = 1
			Delay 1000
			Keydown ^8 $_keydelay //special attack
			Delay $attackdelay
		End
		delay $_delay
		If $cure = 1
			Call heal
		End
	End
End

// Pull the mob and move into melee range
Procedure startmelee
	Keydown ^7 $_keydelay //pull
	Delay 6000
	Keydown ^4 $_keydelay //attack
	Delay 1000
	Keydown w 3000
	Delay $_delay
	Keydown s 250
	Delay $_delay
End

//	Cure self
Procedure heal
	If $info_hp_current <= $lowhp
		Keydown ^5 $_keydelay //cure
		Delay 2000
	End
End

//	Rest to full hp and mp
Procedure rest
	Setconst length = 0
	Delay 2000
	Keydown ^6 $_keydelay //heal
	Call sortinventory
	Delay $_delay
	While $info_hp_current < $hp_rest or $info_mp_current < $mp_rest
		Call aggro
		If $info_player_stat <> 33	//in case of poison or similar
			Keydown ^6 $_keydelay //heal
		End
		Delay 10000
	End
	Keydown ^6 $_keydelay //heal
	Delay 5000
End

//	If a name pops up, it is probably aggro so attack it
Procedure aggro
	If $info_target_stat = 1
		If $info_player_stat = 33
			Keydown ^6 $_keydelay //heal
		End
		Delay 4000
		Call fighttarget
		Delay $_delay
	End
End
	
Procedure sortinventory
	KeyDown @n $_keydelay // exit any current window
	Keydown @n $_keydelay
	Delay $_delay
	KeyDown @i $_keydelay
	Delay $_delay
	KeyDown f $_keydelay
  If $info_Menu_TopLeftText <> Auto-sort //error checking to make sure that the bot is not in manual mode
  	KeyDown {up} $_keydelay
		Delay $_delay
	End
	KeyDown {return} $_keydelay
	Delay $_delay
	KeyDown {up} $_keydelay
	Delay $_delay
	KeyDown {return} $_keydelay
	Delay $_delay
  If $info_inv_count = $invintorymax
    Call scan
  End
	KeyDown @n $_keydelay
	Keydown @n $_keydelay
	Delay $_delay
End

Procedure scan
	Call openinventory
	While $info_inv_itemnum < $invintorymax 
		Case $info_item_name
			When $I0
				Call toss
			When $I1
				Call toss
			When $I2
				Call toss
			When $I3
				Call toss
			When $I4
				Call toss
			When $I5
				Call toss
			When $I6
				Call toss
			When $I7
				Call toss
			When $I8
				Call toss
			When $I9
				Call toss
		End
		Keydown {down} $_keydelay
		Delay $_delay
	End
End

Procedure openinventory
	KeyDown @n $_keydelay
	Keydown @n $_keydelay
	Delay $_delay
	KeyDown @i $_keydelay
	Delay $_delay
	While $info_inv_itemnum <> 1 //go to the top of the inventory
		Keydown {left} $_keydelay
	  Delay $_delay
	End
End

Procedure toss
	Delay 200
  Keydown y 200
  Delay 200
  Keydown k 200
  Delay 200
  Keydown y 200
  Delay 200
  Keydown k 200
  Delay 200
  Keydown y 200
  Delay 200
End


//	Main code:
While 1 = 1
	Call findtarget
	Delay $_delay
	Call fighttarget
	Delay $_delay
	If $info_hp_current < $hp_rest or $info_mp_current < $mp_rest
		Call rest
		Delay $_delay
	Else
		Call sortinventory
		delay $_delay
	End
End
Code:
(*
//ver 0.8r4
//current functions
//mise
timestamp $info_zone_name                               //4-25-06
//timestamp $info_zone //by cgrinds
timestamp $info_keyboard //returns 1=compact 0=full,    //4-25-06

//chat:
timestamp $info_chat_last_line //only shows incomming chat
timestamp $info_chat_last_action            //4-25-06

//self
timestamp $info_tp                   //4-25-06
timestamp $info_hp_current                              //4-25-06
timestamp $info_hp_max                                  //4-25-06
timestamp $info_mp_current                              //4-25-06
timestamp $info_mp_max                                  //4-25-06
timestamp $info_player_stat                             //4-25-06
timestamp $info_view                                    //4-25-06
timestamp $info_player_gil                              //4-25-06
timestamp $info_Player_posX
timestamp $info_Player_posz
timestamp $info_Player_posy
timestamp $info_Player_posr
timestamp $info_Player_posh
timestamp $info_Limit_Points
timestamp $info_Merit_points
timestamp $info_exp_current                             //4-25-06
timestamp $info_exp_max                                 //4-25-06
timestamp $info_job_main                                //4-25-06
timestamp $info_job_main_lv                             //4-25-06
timestamp $info_job_sub                                 //4-25-06
timestamp $info_job_sub_lv                              //4-25-06

//inv
timestamp $info_inv_itemnum                             //4-25-06
timestamp $info_inv_count                               //4-25-06
timestamp $info_inv_itemName //works with AH also       //4-25-06
timestamp $info_item_stack               //4-25-06

//target
timestamp $info_target_sub //returns true/false         //4-25-06
timestamp $info_target_hp                               //4-25-06
timestamp $info_target_name                             //4-25-06
timestamp $info_target_stat                             //4-25-06
timestamp $info_target_posX                             //4-25-06
timestamp $info_target_posZ                             //4-25-06
timestamp $info_target_posY                             //4-25-06
timestamp $info_target_posH                             //4-25-06

//mise
timestamp $info_shopcraft_quantity           //4-25-06
timestamp $info_shopcraft_quantity_max         //4-25-06

//menu
timestamp $info_menu_help                               //4-25-06
timestamp $info_Menu_TopLeftText                        //4-25-06

//AH
//procedure info_ah_bid using amount //by leggmann      //4-25-06
timestamp $info_AH_itemnum               //4-25-06
timestamp $info_ah_lastprice
timestamp $info_bid_amount                               //4-25-06
timestamp $info_bid_place //1s,10s,100s ect              //4-25-06

//fish
timestamp $info_Fish_RodLocation //by DT 3D09CB
timestamp $info_Fish_MaxHP //by DT
timestamp $info_Fish_CurrentHP //by DT
*)
04/06/2010 17:51 corvox#2
Downloaded and tested this script.

I get an error at line 50 Checking for compact keyboard,can anyone help me fix it?

I commented the checking for compact keyboard out, it then gets another error at line 84 or so, it has to do with the checkmob procedure

I Commented both errrors out (not running at 100%) but it can target and step in circles. So this thing kinda works, just dont know code to fix it. =(

So if any one who can code take a few mins and fix this please?
04/06/2010 21:29 Bambi666#3
Quote:
launch FFXI with windower, in ff option set keyboard to compact mode
Ingame go to option and set keyboard to compact mode, i dont get error after this step.

beware bot get stuck if target is friendly (npc or object) best way to avoid this > put a target name in: mob = none (line 11)
06/26/2010 15:23 CrimsonNinja#4
Hey there. I'm having problems with this... I have set the keyboard mode in game to compact but it still not saying I have. D: Is there any work around for this? Pretty much the same Problem Corvox had....

Basically it wont recognise that FFXI is in Compact mode. So I made a new .mac and took out the check for compact rule out. Thinking that would solve my problem it then it comes up with Error in Line 79 "Strpos mob_name = $mob , $info_target_name" I tried changing the Mob name constant ("mob =") to none and other mob names but it still came up with problems suggesting that there is an error somewhere that is unseen.

Any suggestions?
06/29/2010 00:02 Alfarjamie#5
After spending about 2 hours trying to fix this code, i have concluded:

The poster is a troll.

He's either deliberately changed something or knew this didn't work and has reposted something that hasn't worked in years.

Anything to do with info_target_name or info_target_stat doesnt work, ive tried un-cluttering the ffxi_info.dat, placing it in different places, trying to change the checkmob code.. everything i can think of with almost no actools expertise but some programming knowledge.

But no matter what you do it cannot find the constant of these lines.
Everyway i try to make a constant of the lines it does nothing but say its an improper use of setconst.

its almost as if info_target_name and _stat don't exist in the .dat.
at least i have no clue what is going on here...