Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

L2: Game Assistant (Cron 1)


  • Please log in to reply
7 replies to this topic
Harmor
  • Members
  • 182 posts
  • Last active: Sep 20 2007 05:09 AM
  • Joined: 06 Nov 2005
While playing L2 (Lineage 2), I wrote this to assist playing the game. No doubt it may be useful to someone else playing L2 so I'd thought I share.

The macro was written within 1024x768 view. You only have to change the location of the mouseclicks if you need to craft Soulshots/Blessed Spirtshots.

EDIT: Added serveral numpad commands in this version:

Numpad 1: Send message #1
Numpad 2: Send message #2
Numpad 3: Send message #3
Numpad 4: This will create Dual Swords of Revolution at NPC Carson (may need to change on your server)
Ctrl+Numpad 4: This will crystalize the item in the first row, second slot (WARNING: BECAREFUL)
Numpad 5: Send message #4
Numpad 6: You first need to press NumpadDel to get the location of AA in your inventory trade window, then press Numpad6 to trade 99,999 at a time
Numpad 7: Buy Soulshots from the grocer Denkus in Giran (buy a set first)
Numpad 8: Buy Spiritshots from the grocer Denkus in Giran (buy a set first)
Numpad 9: Buy Soulshots from the Trader Uska in Orc Village (buy a set first)

It doesn't matter if you have Numlock on or off because pressing Numpad4 or NumpadLeft will execute the same macro.

EDIT: Added Window support so you can craft and then quickly switch to your second account in the foreground.

EDIT: Holding down the "Backspace" key will continuously craft (999 times). This is good when you have to craft 166 Metal Hardeners, but put the recipe in one of the Soulshot/Blessed Spirtshot recipe slots, move the window slightly so it'll click on the "Create" button, and viola!! This also works if you're getting continuously recharged. So pressing "Backspace + Insert" will craft 999 times whatever is Hotbar 8/Slot 9.

The goal of this is to make a script to assist playing L2, not to make a L2walker program.

During combat all you need to do is hold down the {Tab} key and the macro will continuously press {F4}{F3}, which if you setup your bar will attack your current target with your special ability and soulshot/blessed spirtshot your weapon in the process.

To spam pickup, all you need to do is press the "q" key, and it will continuously press {F7} to pickup any loot. To type the letter "q" in chat you'll need to either hold SHIFT, CTRL or ALT so it doesn't activate the hotkey

To quickly switch weapons (and hotbar), you place your weapons on Bar 5. Pressing {PgUp} will switch to the weapons in {F1} and {F2} on the 5th hotbar and then switch to the 1st hotbar. See below for more details.

Before you run this you'll need to setup your hotbar as follows:

Bar 1, 4 and 6 and 7: [*:70ogd8fk]F3 - Main Attack Ability (or the Attack Button) (press down TAB to spam {F4}{F3})
[*:70ogd8fk]F4 - Soulshot/Blessed Spirtshot (press down TAB to spam {F4}{F3})Bar 2:[*:70ogd8fk]F1 - Map (press Alt+m)
[*:70ogd8fk]F12 - Return abiltiy or Scroll of Return (Press Alt+o)Bar 3:[*:70ogd8fk]F9 - Primary Tatto (i.e. Tatto of Resolve) (Press Up Arrow)
[*:70ogd8fk]F10 - Secondary Tatto (i.e. Tatto of Soul/Avadon) (Press Down Arrow)
[*:70ogd8fk]F11 - Thiriary Tatto (i.e. Divine) (Press Left Arrow)Bar 5:[*:70ogd8fk]F1+F2 - first weapon combo (i.e. blunt in F1, shield in F2) (Press PgUp)
[*:70ogd8fk]F3+F4: second weapon combo (Press PgDn)
[*:70ogd8fk]F4+F5: third weapon combo (Press Ctrl+PgUp)
[*:70ogd8fk]F6+F7: fourth weapon combo (Press Ctrl+PgDnBar 8 (holding down Backspace when doing a full batch will do 999 single batches continuously - if you have mana pots, getting recharged or the recipe uses so little mana):[*:70ogd8fk]F9 - Recipe: Soulshot C (Press Insert to do a full batch, Home to do a single batch)
[*:70ogd8fk]F10 - Recipe: Blessed Spirtshot C (Press Delete to do a full batch, Home to do a single batch)
[*:70ogd8fk]F11 - Recipe: Soulshot B (Press Ctrl+Insert to do a full batch, Home to do a single batch)
[*:70ogd8fk]F12 - Recipe: Blessed Spirtshot B (Press Ctrl+Delete to do a full batch, Home to do a single batch)
Backspace+Insert -> Craft the recipe in F9, 999 times
Backspace+Delete -> Craft the recipe in F10, 999 times
Ctrl+Backspace+Insert -> Craft the recipe in F11, 999 times
Ctrl+Backspace+Delete -> Craft the recipe in F12, 999 times


;
; AutoHotkey      Version: 1.x
; Language:       English
; Platform:       Win9x/NT
;
; Description:
;     L2 Fighting Macro
;
#SingleInstance force
#InstallKeybdHook 
;
; Supported Classes (Prophet,Cleric,Scavenger,Bounty Hunter,Artisan,Warsmith)
;                   (Shillen Oracle, Palus Knight, Bladedancer, Sword Singer)
; Set to "Unknown" if not specifically in the list above
;
g_szClass = Sword Singer
;
; Supported Combos (FirstCombo,SecondCombo,ThirdCombo,FourthCombo)
;
g_szWeaponCombo = Unknown
;
; Total Mana
;
g_iManaTotal = 1579
;
; Mana Regen every 3 seconds (while sitting)
;
g_iManaRegen = 21
;
; Global Variables - DO NOT TOUCH
;
g_posX = 0
g_posY = 0
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Hotbar Setup
;;; 1,4,6,7 -> Attack Bars (see below)
;;; 2:1 -> Map
;;; 3:9 -> Primary Tatto (i.e. Tatto of Resolve)
;;; 3:10 -> Secondary Tatto (i.e. Tatto of Soul)
;;; 3:11 -> Secondary Tatto (i.e. Divine Tatto)
;;; 2:12 -> Scroll of Escape or Return
;;; 5:1 & 5:2 -> Weapon Combo 1
;;; 5:3 & 5:4 -> Weapon Combo 2
;;; 5:5 & 5:6 -> Weapon Combo 3 
;;; 5:6 & 5:7 -> Weapon Combo 4
;;; 8:9 -> Recipe: D Grade Soulshots
;;; 8:10 -> Recipe: D Grade Blessed Spiritshots
;;; 8:11 -> Recipe: C Grade Soulshots
;;; 8:12 -> Recipe: C Grade Blessed Spiritshots
;;;
;;; Attack Bar Setup (Hotbar 1,4,6,7)
;;; :3 -> Main Attack/Spell (Hold down TAB)
;;; :4 -> Soulshot/Blessed Spiritshot (Hold down TAB)
;;; :7 -> Pickup (Hold down q)
;;; :9 -> Class Specific 2nd abilty/attack (set g_szClass above) (Hold down `)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;
; Only run this script when l2.exe is running in the foreground
;
SetTimer, KeepRunning
return

KeepRunning:

  ; Get the process name of the active window (i.e. Notepad.exe)
  WinGet, szProcessName, ProcessName, A
  if szProcessName = l2.exe
  {
    Suspend, off
  }
  else
  {
    Suspend, on
  }
return

;
; Disable the Window's keys so they don't switch to desktop while in-game
;
$LWin::	; Left Windows Button
$RWin::	; Right Windows Button
	; Do nothing
return

$^CapsLock::
	ExitApp
return

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Press NumpadEnd|Numpad1 for saved message #1
;
$NumpadEnd::
$Numpad1::
  Send, {Enter}{BACKSPACE}
  Sleep 100
  SendRaw, !WTT my Kris Blades for Hell Knife Blades @ 2:3, 3:5, 4:6, 5:8, 6:9, 7:11 or 8:12
  Send, {Enter}
return

;
; Press NumpadDown|Numpad2 for saved message #2
;
$NumpadDown::
$Numpad2::
  Send, {Enter}{BACKSPACE}
  Sleep 100
  SendRaw, !WTB Enchant Armor A/C/D for 20kk/3kk/500k                 (or 200k/30k/5k AA)
  Send, {Enter}
return

;
; Press NumpadPgDn|Numpad3 for saved message #3
;
$NumpadPgDn::
$Numpad3::
  Send, {Enter}{BACKSPACE}
  Sleep 100
  SendRaw, !WTB Enchant Weapon A/B/C/D for 75kk/35kk/10kk/4kk (or 750k/350k/100k/40k AA)
  Send, {Enter}
return

;
; Press NumpadLeft|Numpad4 to make Dual Swords of Revolution
;
$NumpadLeft::
$Numpad4::
   Loop 1
   {
      PressF(3) ; Attack icon will open the window of the NPC
      Sleep 500
      if IsKeyPressed("Ctrl")
         break
      ; Click on "Make C Duals"
      MouseClick, left, 145, 335 ; +25 Y-axis for Windows mode
      Sleep 200
      if IsKeyPressed("Ctrl")
         break
      ; Click on "Sword of Revolution*Sword of Revolution"
      MouseClick, left, 100, 225 ; +25 Y-axis for Windows mode
      Sleep 200
      if IsKeyPressed("Ctrl")
         break
      ; Click on OK
      MouseClick, left, 90, 540 ; +25 Y-axis for Windows mode  
   }
return

;
; Press CTRL+NumpadLeft|CTRL+Numpad4 to crystalize the item in the
; first row, second slot from the left (WARNING: BECAREFUL)
;
$^NumpadLeft::
$^Numpad4::
; 1024x758 Window's mode
  	MouseClick, left, 782, 362, , , D ; +25 Y-axis for Window's mode
  	Sleep 100
  	MouseMove, -32, 163, , R
  	MouseClick, left, , , , , U
  	Sleep 100
   ; Click the OK button in the confirm dialog
   MouseClick, left, 473, 441 ; +25 Y-axis for Window's mode
   Sleep 100
   ; Hover the mouse over the second item in the first row when done
   MouseMove, 782, 362 ; +25 Y-axis for Window's mode
return


;
; Press NumpadClear|Numpad5 for saved message #5
;
$NumpadClear::
$Numpad5::
  Send, {Enter}{BACKSPACE}
  Sleep 100
  SendRaw, !Numbers Event - guess my number between 1..10,000 and win 40k AA!!!
  Send, {Enter}
return

;
; Press NumpadDiv to target and Attack or Spoil the target if a Bounty Hunter
;
$NumpadDiv::
  Send, {Enter}{BACKSPACE}
	Send, /target Fairy Queen Timiniel
	Send, {Enter}
	if( g_szClass = "Bounty Hunter")
	{
    PressF(9) ; Spoil
  }
  else
  {
    PressF(3) ; Attack Button
  }
return

;
; Press NumpadMult to target and Attack or Spoil the target if a Bounty Hunter
;
$NumpadMult::
  Send, {Enter}{BACKSPACE}
	Send, /target Poten
	Send, {Enter}
	if( g_szClass = "Bounty Hunter")
	{
    PressF(9) ; Spoil
  }
  else
  {
    PressF(3) ; Attack Button
  }
return

;
; Press NumpadSub to target and Attack or Spoil the target if a Bounty Hunter
;
$NumpadSub::
  Send, {Enter}{BACKSPACE}
	Send, /target LLILiuxa
	Send, {Enter}
	if( g_szClass = "Bounty Hunter")
	{
    PressF(9) ; Spoil
  }
  else
  {
    PressF(3) ; Attack Button
  }
return

;
; This variable determines which weapon combo you currently are using
;  FirstCombo: {F1} and {F2} on bar 5
;  SecondCombo: {F3} and {F4} on bar 5
;  ThirdCombo: {F5} and {F6} on bar 5
;  FourthCombo: {F7} and {F8} on bar 5
;

$PgUp::
  GotoHotbar(5)
  PressF(1)
  PressF(2)
	GotoHotbar(1)
	g_szWeaponCombo = FirstCombo
return

$PgDn::
  GotoHotbar(5)
  PressF(3)
  PressF(4)
	GotoHotbar(4)
	g_szWeaponCombo = SecondCombo
return

$^PgUp::
  GotoHotbar(5)
  PressF(5)
  PressF(6)
	GotoHotbar(6)
	g_szWeaponCombo = ThirdCombo
return

$^PgDn::
	GotoHotbar(5)
  PressF(7)
  PressF(8)
  GotoHotbar(7)
	g_szWeaponCombo = FourthCombo
return

$Up::
  ; Switch to Primary Tatto
  GotoHotbar(3)
  PressF(9)
  GoBackToPreviousHotkeyBar()
return

$Down::
  ; Switch to Secondary Tatto
  GotoHotbar(3)
  PressF(10)
  GoBackToPreviousHotkeyBar()
return

$Left::
  ; Switch to Thiriary Tatto
  GotoHotbar(3)
  PressF(11)
  GoBackToPreviousHotkeyBar()
return


GoBackToPreviousHotkeyBar()
{
	if(g_szWeaponCombo = "FirstCombo")
	{
	 GotoHotbar(1)
	}
	else if(g_szWeaponCombo = "SecondCombo")
	{
	 GotoHotbar(4)
	}
	else if(g_szWeaponCombo = "ThirdCombo")
	{
	 GotoHotbar(6)
	}
	else if(g_szWeaponCombo = "FourthCombo")
	{
	 GotoHotbar(7)
	}
	else
	{
	 GotoHotbar(1)
	}
}

;
; Pressing Alt+O will Recall
;
$!o::
  GotoHotbar(2)
  PressF(12)
	GoBackToPreviousHotkeyBar()
return

;
; Pressing q will spam pickup (pressing the F7 key continuously)
;
$q::
	Loop
	{
		Sleep, 100
		if IsKeyReleased("q")
			break  ; Key has been released, break out of the loop
    GoBackToPreviousHotkeyBar()
		if(g_szWeaponCombo <> "Unknown")
		{
			; Spam Pickup
		  PressF(7)
		}
	}
return

;
; Pressing ` (key above TAB), will press F9 and F10 on your weapon bar
;
$`::
	Loop
	{
		Sleep, 100
		; SC029 is the keycode for (')
		if IsKeyReleased("SC029")
			break  ; Key has been released, break out of the loop
		if(g_szWeaponCombo <> "Unknown")
		{
		  ; Cleric, Prophet (F9 = Battle Heal)
		  if( g_szClass = "Cleric" or g_szClass = "Prophet" or g_szClass = "Shillen Oracle" )
		  {
		    Send, {Enter}/target `%self{Enter}
  		  PressF(9)
  		  ; Switch to next target
  		  Send, {Enter}/targetnext{Enter}
        Sleep 2000
      }
		  ; Scavenger, Bounty Hunter (F9 = Spoil, F10 = Sweep)
		  ; Bladedancer (F9 = Blessed Spirtshot, F10 = Drain Health)
		  ; Sword Singer (F9 = Entangle, F10 = Blessed Spiritshot)
      else if( g_szClass = "Scavenger" or g_szClass = "Bounty Hunter" 
                or g_szClass = "Bladedancer" or g_szClass = "Sword Singer")
      {
        PressF(9)
        PressF(10)
      }
      else
      {
        ; F9 = Secondary Attack
        PressF(9)
      }
		}
		else
		{
		  Send, {Enter}@%g_szWeaponCombo%
    }
	}

return

;
; Press and HOLD down the CTRL+TAB key when in PvP combat
;
$^Tab::
	Loop
	{
		Sleep, 200
		if IsKeyReleased("Tab")
			break  ; Key has been released, break out of the loop
		if(g_szWeaponCombo <> "Unknown")
		{
			; {F3} is the Attack/Main Spell Button
			; {F4} is your soulshot/blessed spirtshot
			PressF(4)
			PressF(3)
		}
	}

return

;
; Press and HOLD down the TAB key when in PvE combat
;
$Tab::
	Loop
	{
		Sleep, 200
		if IsKeyReleased("Tab")
			break  ; Key has been released, break out of the loop
		if(g_szWeaponCombo <> "Unknown")
		{
			; {F3} is the Attack/Main Spell Button
			; {F4} is your soulshot/blessed spirtshot
			PressF(4)
			PressF(3)
		}
	}

return

;
; Press INSERT to continuously create a batch of C-grade Soulshots
;
$Insert::
  ; Switch to hotbar #8 with the crafting recipies
  GotoHotbar(8)
  ; Hotkey 9, 40 MP per recipe
  ; Press CTRL to stop
  CraftContinuously(9,60)
  GoBackToPreviousHotkeyBar()  
return

;
; Press DELETE to continuously create a batch of C-grade Blessed Spiritshots
;
$Delete::
  ; Switch to hotbar #8 with the crafting recipies
  GotoHotbar(8)
  ; Hotkey 10, 60 MP per recipe
  ; Press CTRL to stop
  CraftContinuously(10,120)
  GoBackToPreviousHotkeyBar()
return

;
; Press CTRL+INSERT to continuously create a batch of B-grade Soulshots
;
$^Insert::
  ; Switch to hotbar #8 with the crafting recipies
  GotoHotbar(8)
  ; Hotkey 11, 60 MP per recipe
  ; Press CTRL to stop
  CraftContinuously(11,100)
  GoBackToPreviousHotkeyBar()  
return

;
; Press CTRL+DELETE to continuously create a batch of B-grade Blessed Spiritshots
;
$^Delete::
  ; Switch to hotbar #8 with the crafting recipies
  GotoHotbar(8)
  ; Hotkey 12, 120 MP per recipe
  ; Press CTRL to stop
  CraftContinuously(12,180)
  GoBackToPreviousHotkeyBar()
return

;
; Press HOME to create a single batch of D-grade Soulshots
;
$Home::
  ; Switch to hotbar #8 with the crafting recipies
  GotoHotbar(8)
  ; Craft D-grade Soulshot in Hotkey slot 9
  Craft(9)
return

;
; Press END to create a single batch of D-grade Blessed Spiritshots
;
$End::
  ; Switch to hotbar #8 with the crafting recipies
  GotoHotbar(8)  
  ; Craft D-grade Blessed Soulshot in Hotkey slot 10
  Craft(10)
return

;
; Press CTRL+HOME to create a single batch of C-grade Soulshots
;
$^Home::
  ; Switch to hotbar #8 with the crafting recipies
  GotoHotbar(8)
  ; Craft C-grade Soulshot in Hotkey slot 11
  Craft(11)
return

;
; Press CTRL+END to create a single batch of C-grade Blessed Spiritshots
;
$^End::
  ; Switch to hotbar #8 with the crafting recipies
  GotoHotbar(8)  
  ; Craft C-grade Blessed Soulshot in Hotkey slot 12
  Craft(12)
return

;
; Press NumpadDel or NumpadDot to save the coordinates of the mouse for other
; functions to use.
;
$NumpadDel::
$NumpadDot::
  MouseGetPos, g_posX, g_posY
return

;
; Move 99,999 AA into the trade window (need coords first by pressing
; NumpadDel or NumpadDot)
;
$NumpadRight::
$Numpad6::
  ; Make sure to press NumpadDel or NumpadDot to first get the position of the
  ; AA in the trade window (TODO: could do a graphics search for the AA icon,
  ; but I found that doing that has problems inside Lineage 2 because of the
  ; Gamma settings)
  MouseClick, left, %g_posX%, %g_posY%  ; Click on AA in the trade Window
  MouseClick, left, %g_posX%, %g_posY%  ; Click on AA in the trade Window
  Sleep 100  
  MouseClick, left, 707, 423 ; 9
  Sleep 100
  MouseClick, left, 707, 423 ; 9
  Sleep 100
  MouseClick, left, 707, 423 ; 9
  Sleep 100
  MouseClick, left, 707, 423 ; 9
  Sleep 100
  MouseClick, left, 707, 423 ; 9
  Sleep 100
  MouseClick, left, 472, 431 ; Quantity Dialog's OK  
  Sleep 100
  ; Hover mouse over AA in trade Window when done
  MouseMove, left, %g_posX%, %g_posY%  ; +25 Y-axis for Window's mode
return

;
; Buy Soulshots from the grocer Denkus in Giran (buy a set first)
;
$NumpadHome::
$Numpad7::
  ; The first time we talk to Denkus the Buy/Sell/Quest dialog will have the
  ;  hyperlinks in a different location so you'll need to have talked to him
  ;  and bought something already so we get the 2nd dialog box without his
  ;  introduction text.
  ;TODO: Support fullscreen (these MouseClicks are in Window's Mode-1024x768)
  MouseClick, left, 15, 250 ; Windows mode (+25 to Y-axis)
  Sleep 300  
  MouseClick, left, 135, 325 ; Click on Soul Ore
  MouseClick, left, 135, 325 ; Click on Soul Ore
  Sleep 500
  MouseClick, left, 707, 423 ; 9
  Sleep 100
  MouseClick, left, 707, 423 ; 9
  Sleep 100
  MouseClick, left, 707, 423 ; 9
  Sleep 100
  MouseClick, left, 472, 431 ; Quantity Dialog's OK  
  Sleep 100
  MouseClick, left, 90, 531 ; Store Dialog's OK
return

;
; Buy Spiritshots from the grocer Denkus in Giran (buy a set first)
;
$NumpadUp::
$Numpad8::
  ; The first time we talk to Denkus the Buy/Sell/Quest dialog will have the
  ;  hyperlinks in a different location so you'll need to have talked to him
  ;  and bought something already so we get the 2nd dialog box without his
  ;  introduction text.
  ;TODO: Support fullscreen (these MouseClicks are in Window's Mode-1024x768)
  MouseClick, left, 15, 250 ; Windows mode (+25 to Y-axis)
  Sleep 300  
  MouseClick, left, 98, 325 ; Click on Spirit Ore
  MouseClick, left, 98, 325 ; Click on Spirit Ore
  Sleep 500
  MouseClick, left, 707, 423 ; 9
  Sleep 100
  MouseClick, left, 707, 423 ; 9
  Sleep 100
  MouseClick, left, 707, 423 ; 9
  Sleep 100
  MouseClick, left, 472, 431 ; Quantity Dialog's OK  
  Sleep 100
  MouseClick, left, 90, 531 ; Store Dialog's OK
return

;
; Buy Soulshots from the Trader Uska in Orc Village (buy a set first)
;
$NumpadPgUp::
$Numpad9::
  ; The first time we talk to the trader the Buy/Sell/Quest dialog will have
  ;  the hyperlinks in a different location so you'll need to have talked to
  ;  him and bought something already so we get the 2nd dialog box without his
  ;  introduction text.
  ;TODO: Support fullscreen (these MouseClicks are in Window's Mode-1024x768)
  MouseClick, left, 15, 277 ; Windows mode (+25 to Y-axis)
  Sleep 300  
  MouseClick, left, 210, 291 ; Click on Soul Ore (last on 3rd row)
  MouseClick, left, 210, 291 ; Click on Soul Ore (last on 3rd row)
  Sleep 500
  MouseClick, left, 707, 423 ; 9
  Sleep 100
  MouseClick, left, 707, 423 ; 9
  Sleep 100
  MouseClick, left, 707, 423 ; 9
  Sleep 100
  MouseClick, left, 472, 431 ; Quantity Dialog's OK  
  Sleep 100
  MouseClick, left, 90, 531 ; Store Dialog's OK
return



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Utility Functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;
;
ChangeChatToAll()
{
  MouseClick, left, 57, 758 ; Make sure we are in "All" chat tab
}

;
; Use a skill named a_szSkillName
;
UseSkill(a_szSkillName,a_iDelay)
{
  if( StrLen(a_szSkillName) > 4 )
    Send, {Enter}/useskill %a_szSkillName%{Enter}
  else
    Send, {Enter}@huh??%a_szSkillName%
  Sleep a_iDelay
}
;
; Switching to the %a_iHotbar%'th Hotbar
;
GotoHotbar(a_iHotbar)
{
  if( a_iHotbar > 0 and a_iHotbar < 11)
    Send, {Alt Down}{F%a_iHotbar%}{Alt Up}
  else
    Send, @huh???%a_iHotbar%
  Sleep 50
}

;
; Press function key %a_iHotkey%
;
PressF(a_iHotkey)
{
  if( a_iHotkey > 0 and a_iHotkey < 13)
    Send, {F%a_iHotkey%}
  else
    Send, @huh????%a_iHotkey%
  Sleep 50
}

;
; Returns 1 if %a_szKeyName% is currently being pressed, 0 otherwise
;
IsKeyPressed(a_szKeyName)
{
   ; Check to see if the Ctrl key has been pressed 
   GetKeyState, state, %a_szKeyName%, P
    if state = D  ; The key has been pressed
    {
      return 1
    }
    return 0
}

;
; Returns 1 if %a_szKeyName% has be released, 0 otherwise
;
IsKeyReleased(a_szKeyName)
{
   ; Check to see if the Ctrl key has been pressed 
   GetKeyState, state, %a_szKeyName%, P
    if state = U  ; The key has been released
    {
      return 1
    }
    return 0
}

;
; Craft the item continuously based on your total mana
; Press the CTRL key to stop
; Hold down BACKSPACE to craft 999 batches
;
CraftContinuously(a_iHotkey,a_iMPPerRecipe)
{
  global g_iManaTotal
  global g_iManaRegen

  Loop
  {
    ; Total Mana / mana used per recipe
    if IsKeyPressed("Backspace")
    {
      iLoopCount = 999
    }
    else
    {
      iLoopCount := Floor(g_iManaTotal/a_iMPPerRecipe)
    }
    Loop, %iLoopCount%
    {
      Craft(a_iHotkey)
      if IsKeyPressed("Ctrl")
        break
    }
    ; Regenerate Mana to Full before trying again
    ; //TODO: Figure out how to PixelSearch and get actual mana
    ; Total Mana / Mana Regen Per second * 3 seconds
    iLoopCount := Floor(g_iManaTotal/g_iManaRegen*3)
    Loop, %iLoopCount%
    {
      if IsKeyPressed("Ctrl")
        break
      Sleep 1000
    }
    if IsKeyPressed("Ctrl")
      break
  }
}
;
; Craft an item
;
Craft(a_iHotkey)
{
  PressF(a_iHotkey)

  if(A_ScreenWidth == 1024 and A_ScreenHeight = 768)
  {
  	MouseClick, left,  474,  417 ; +25 Y-axis for Window's mode
  	Sleep, 100
  
   ; Mousewheel down
   MouseClick, WheelDown, ,, 5
   Sleep 100
 
;  The method below using a mouse click and drag 
;  	MouseClick, left, 294, 276, , , D
;  	Sleep 100
;  	MouseMove, 0, 90, , R
;  	MouseClick, left, , , , , U
;  	Sleep 100
  	
  	MouseClick, left, 147, 496 ; +25 Y-axis for Window's mode
  	Sleep 100
  }
  else
  {
    ; Assume we're in Window's mode
  	MouseClick, left,  474,  432
  	Sleep, 100

   ; Mousewheel down
   MouseClick, WheelDown, ,, 5
   Sleep 100
 
;  The method below using a mouse click and drag 
;  	MouseClick, left, 294, 276, , , D
;  	Sleep 100
;  	MouseMove, 0, 90, , R
;  	MouseClick, left, , , , , U
;  	Sleep 100
  	
  	MouseClick, left, 147, 515
  	Sleep 100
  }
}

;$b::
;   Send, {Alt Down}n{Alt Up}
;   Sleep 300
;  if(A_ScreenWidth == 1024 and A_ScreenHeight = 768)
;  {
;    MouseClick, left, 128, 411
;  }
;  else
;  {
;    MouseClick, left, 128, 429
;  }
;   Sleep 100
;   Send, Restart Server{Enter}
;   Sleep 100
;return

; Testing GetManaValue()
;$^x::
;   results := GetManaValue()
;   Send, {Enter}@Yeah - %results%
;   Sleep 2000
;return

;GetManaValue()
;{
;  if(A_ScreenWidth == 1024 and A_ScreenHeight = 768)
;  {
;    ; We're looking for RGB(0x184163) = dark blue
;    PixelSearch, xPos, yPos, 16, 47, 166, 48, 0x184163, , RGB
;    if ErrorLevel = 0
;    {
;       manaValue := Floor((xPos-16)/(166-16) * g_iManaTotal)
;       return manaValue
;    }
;  }
;  else if(A_ScreenWidth == 1600 and A_ScreenHeight = 1200)
;  {
;    ; Assume we're in Windows Mode
;    ; We're looking for RGB(0x184163) = dark blue
;    CoordMode, Pixel, Relative
;    PixelSearch, xPos, yPos, 16, 47, 166, 48, 0x184163, , RGB
;    if ErrorLevel = 0
;    {
;       manaValue := Floor((xPos-16)/(166-16) * g_iManaTotal)
;       return manaValue
;    }
;  }
;  else
;  {
;    ; Not supported screen resolution
;    Send, {Enter}@wait! %A_ScreenWidth% %A_ScreenHeight%
;    return 0
;  }
;  ; Couldn't find dark blue pixel so we assume mana is full
;  return g_iManaTotal
;}
  



//TODO: Create kewl sig...

Harmor
  • Members
  • 182 posts
  • Last active: Sep 20 2007 05:09 AM
  • Joined: 06 Nov 2005
Here's an update with more features and cleaner code:

Comment from moderator: See top post for latest version.
//TODO: Create kewl sig...

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
To make it easier for visitors to find the latest version, I put it in the top post. Another reason is that the forum's database space is limited.

Thanks for posting your work.

plz help
  • Guests
  • Last active:
  • Joined: --
how i change de key TAB to F1 and ' to F2 ?
how i change these keys?

Harmor
  • Members
  • 182 posts
  • Last active: Sep 20 2007 05:09 AM
  • Joined: 06 Nov 2005

how i change de key TAB to F1 and ' to F2 ?
how i change these keys?

Not sure exactly because what if you actually want to press F1...there would be a loop. I think it has something to do with the $ in the keybind, but I'm not 100% sure.

Just change:
$Tab::
to
$F1::
and
$`::
   Loop
   {
      Sleep, 100
      ; SC029 is the keycode for (')
      if IsKeyReleased("SC029")
to
$F2::
   Loop
   {
      Sleep, 100
      if IsKeyReleased("F2")


====================================

Updated the script to support Tattos and some classes secondary button (`), features. If you have a C4 client then you can use set g_szClass to "Unknown" and setup your in-game macro to do something in the F9 position of your attack bar.

Now pressing the Up Arrow will switch to your primary tatto (2nd hotbar, F5 position). Pressing Down Arrow will switch to your secondary tatoo (2nd hotbar, F6 position).

I would just like to remind that I use this script playing on a private server with Cron 1 installed. Therefore, alot of the features that are available in the Cron 4 client (i.e. recipe book for crafting), this macro doesn't support.

Cron 4 crafting is easy since all you need to do is press the same button continuously. Just use "MouseClick, left, xPos, yPos".
//TODO: Create kewl sig...

Harmor
  • Members
  • 182 posts
  • Last active: Sep 20 2007 05:09 AM
  • Joined: 06 Nov 2005
Added Numpad support and moved Tattoos to Bar3:F9-F11 to support 3 types of tattoos at one time.

Again this version uses Windows mode, 1024x768. I haven't, nor do I plan, on updating all the macros to support any other dimension.

The Windows mode requires that I add +25 to the Y-axis coordinates.


The next version I'm going to add PvP support because currently holding down the Ctrl key and pressing TAB won't execute the auto soulshot/attack macro. I could quickly add it, but I want to test it out a little first to make sure I like pressing Ctrl+Tab for PvP encounters.
//TODO: Create kewl sig...

spal
  • Members
  • 1 posts
  • Last active: Mar 18 2006 03:45 PM
  • Joined: 18 Mar 2006

I would just like to remind that I use this script playing on a private server with Cron 1 installed. Therefore, alot of the features that are available in the Cron 4 client (i.e. recipe book for crafting), this macro doesn't support.

Cron 4 crafting is easy since all you need to do is press the same button continuously. Just use "MouseClick, left, xPos, yPos".


Hi there,

I am desperate!!!!

I tried to make a macro that presses the "Create" button in the "Item Creation" window of L2 C4 craft command.

I am sure that i give the coordinates of the button correct. I checked million times.

Simply the Autohotkey macro seems that it cannnot manipulate the L2 window at all except of making it active (foreground).

I run the game in 800x600 Windowed with borders. Tried to run it 800x600 without window borders too...still the same thing, no mouse action in the L2 window....

Can someone help?


P.S. All i try to do is to make a macro to hit the craft soulshots D damned button while i am afk.


Here is the macro i tried:
----------------------------------------------------------------------------

;
; AutoHotkey Version: 1.x
; Language: English
; Platform: Win9x/NT
; Author: A.N.Other
;
; Script Function:
; Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
;

IfWinExist Lineage II
{
WinActivate
}

MouseClick, left, 296, 468

-----------------------------------------------------------------------------


EDIT: I note again: the problem is not the mouse coordinates! The problem is that the mouse DOES NOT GO into the Lineage 2 window at all...Just stays on the Windows XP desktop...

Razor
  • Guests
  • Last active:
  • Joined: --
Try to kill Game Guard :)

IfWinExist Lineage II
{
WinActivate
}

MouseClick, left, 296, 468

EDIT: I note again: the problem is not the mouse coordinates! The problem is that the mouse DOES NOT GO into the Lineage 2 window at all...Just stays on the Windows XP desktop...