AFK Melee Macro 4.0 Updated 5-24-11
VERSION 4.0 (UPDATED 5/24/11)
Description:
This runs out to the Y, X location that is saved in SpawnXLOC[1]/SpawnYLOC[1]. Upon reaching said location it targets nearest NPC and if it is within 160 units it will use Monk Ability Vigorous Shurikun. There is a PLAYERCHECK in this macro. Declare any bots in the ini. If any player is within 300 units of your camp you will just sit there and do nothing, but as soon as they get further away it will continue.
4.0 brings .INI file support (Thanks Maskoi)
This Macro requires the following pre-requisites
-MQ2Melee and all dependents loaded
-Get LOC of pull location by typing /loc and filling in SpawnXLoc SpawnYLoc
afkmelee_charactername.ini
Hook me up with a red cent if you enjoy the macro 
VERSION 4.0 (UPDATED 5/24/11)
Description:
This runs out to the Y, X location that is saved in SpawnXLOC[1]/SpawnYLOC[1]. Upon reaching said location it targets nearest NPC and if it is within 160 units it will use Monk Ability Vigorous Shurikun. There is a PLAYERCHECK in this macro. Declare any bots in the ini. If any player is within 300 units of your camp you will just sit there and do nothing, but as soon as they get further away it will continue.
4.0 brings .INI file support (Thanks Maskoi)
This Macro requires the following pre-requisites
-MQ2Melee and all dependents loaded
-Get LOC of pull location by typing /loc and filling in SpawnXLoc SpawnYLoc
Rich (BB code):
|----------------
|- AFKMELEE v4.0 -
|----------------
|Required Plugins: MQ2Melee Loaded (Dependant plugins MQ2Moveutils, MQ2Cast, MQ2Exchange, MQ2Bagwindow)
|Setup:
|-Set SpawnXLoc/YLoc for to pull spots
|-Set # of pull spots into locstospot
|-Set HealerName to any friend that wants to attend
|-Set Loot Array information on what you want
|---------------------------------------------------------------
|-Notes: MQ2Melee setup to do all combat and heals, and Feign Death on low health.
|
|-Version 4.0
|------------
|-INI Support Added (Thanks Maskoi for Code)
|-Removed all Monk Stuff (Please use MQ2Melee holyshits for special abilities)
#event Stunned "You are too distracted to use a skill.#*#"
#event Stunned "You are stunned#*#"
#event Stunned "You can't cast spells while stunned!#*#"
#event Stunned "You can't attack while stunned!#*#"
#event Stunned "You cannot use a skill while stunned!#*#"
#event Stunned "You *CANNOT* cast spells, you have been silenced!#*#"
#event TargetSight "You cannot see your target.#*#"
Sub Main
/declare MacroName string outer afkmelee
/declare IniFileName string outer ${MacroName}_${Me.CleanName}.ini
/declare myzone int outer ${Zone.ID}
/call LoadIni General HealerName string outer NULL
/call LoadIni General locstospot int outer 6
/call LoadIni General dolootz int outer 0
/declare RV_LootArray[10] string outer
/call LoadIni Lootz RV_LootArray string NULL RV_LootArray
/declare SpawnXloc[10] int outer
/call LoadIni XLocs SpawnXloc int 0 SpawnXloc
/declare SpawnYloc[10] int outer
/call LoadIni YLocs SpawnYloc int 0 SpawnYloc
/declare targetspotted int outer 1
/declare targetwait timer outer 0
/declare lootwait timer outer 0
|------------------------------------------------------------
|Declare Safe Players.
|------------------------------------------------------------
/alert add 2 pc ${HealerName}
/alert add 2 pc ${Me}
/if (${Me.Pet}) /echo WARNING! Player Pet Detected...
:mainwatch
/if (${Me.Casting}) /delay 2s
/if (${myzone}!=${Zone.ID}) {
/doability "Feign Death"
/end
}
/call AquireTarget
/if (${Me.CombatState.Equal[COMBAT]}) /call Combatmelee
/call playercheck
/goto :mainwatch
/return
|--------------------------------------------------------------------------------
|SUB: Aquire Target
|--------------------------------------------------------------------------------
Sub AquireTarget
/if (${targetspotted}>${locstospot}) /varset targetspotted 1
/call MoveToLoc ${SpawnYloc[${targetspotted}]} ${SpawnXloc[${targetspotted}]}
/if ((${Me.State.Equal[STAND]}) && (!${Spawn[NPC los targetable].ID}) && (${targetspotted}==1)) /sit
:Waitforspawn
/delay 1s
/if ((!${Spawn[NPC los targetable].ID}) && (${targetspotted}==1)) /goto :Waitforspawn
/if (${NearestSpawn[NPC los targetable].Distance}<160) /target ${NearestSpawn[NPC los targetable]}
/if (${Target.ID}) {
/face
/doability "Vigorous Shuriken Rk. III"
/varset targetwait 30s
:waitfortarget
/doevents
/delay 1s
/if ((${Target.Distance}<30) || (${targetwait}==0)) {
/attack on
/return
}
/goto :waitfortarget
} else {
/varset targetspotted ${Math.Calc[${targetspotted}+1]}
}
/return
|--------------------------------------------------------------------------------
|SUB: Combat
|--------------------------------------------------------------------------------
Sub Combatmelee
:combatstart
/doevents
/call playercheck
/if (${Me.CombatState.Equal[COMBAT]} && !${Me.Combat}) {
/keypress esc
/delay 1s
/attack on
}
/if (${Target.Type.Equal[Corpse]}) /keypress esc
/if (${Target.Distance}>70) /keypress esc
/if ((${Me.CombatAbilityReady["Fifth Wind Rk. II"]}) && (${Me.Endurance}<30000)) /doability "Fifth Wind Rk. II"
/if (!${Target.ID}) {
/keypress esc
/if (${Spawn[NPC los targetable radius 50].ID}) {
/target ${NearestSpawn[NPC los targetable]}
/attack on
/goto :combatstart
}
/attack off
/if (${Me.AbilityReady["Mend"]}) /doability "Mend" |----DOES MEND IF UP AT END OF FIGHTS
/if (${dolootz}==1) /call Loot
/return
}
}
/goto :combatstart
/return
Sub Event_Stunned
/delay 1s
/return
Sub Event_TargetSight
/if (${Me.CombatState.NotEqual[COMBAT]}) {
/varset targetspotted ${Math.Calc[${targetspotted}+1]}
/call AquireTarget
}
/return
|--------------------------------------------------------------------------------
|SUB: Playercheck
|--------------------------------------------------------------------------------
Sub playercheck
/if (${Spawn[pc noalert 2 radius 300].ID}) {
:playerhold
/if (${Me.State.NotEqual[FEIGN]}) /doability "Feign Death"
/if (!${Spawn[pc noalert 2 radius 350].ID}) {
/stand
/return
}
/goto :playerhold
}
/return
Sub MoveToLoc(MoveToY, MoveToX)
/moveto loc ${MoveToY} ${MoveToX}|on
:moveToLocation
/if (${Math.Distance[${Me.Y},${Me.X}:${MoveToY},${MoveToX}]} > 20) {
/delay 5
/goto :moveToLocation
}
/return
|--------------------------------------------------------------------------------
|SUB: Loot w/ Array
|--------------------------------------------------------------------------------
Sub Loot
/declare LootSlot int inner 0
/declare LootCheck int inner 0
/declare LootTotal int inner 0
/lootnodrop never
/target corpse los radius 100
/stick 5 hold
/varset lootwait 1m
:Moveto
/if (${Target.Distance} > 15) {
/delay 1s
/goto :Moveto
}
/stick off
/loot
/delay 1s
/if (!${Corpse.Items}) {
/goto :endofloot
}
/varset LootTotal ${Corpse.Items}
/for LootSlot 1 to ${LootTotal}
/nomodkey /shift /itemnotify ${Corpse.Item[${LootSlot}].InvSlot} leftmouseup
/delay 1s
|---------Keep Good Stuff---------------------
/for LootCheck 1 to ${RV_LootArray.Size}
/if (${Cursor.Name.Find[${RV_LootArray[${LootCheck}]}]}) {
/timed 5 /autoinventory
/delay 2s !${Cursor.ID}
}
/next LootCheck
|---------Destroy Bad Stuff-------------------
/if (${Cursor.ID}) {
/echo Destroying a ${Cursor.Name}...
/destroy
/delay 1s
}
/next LootSlot
:endofloot
/nomodkey /notify LootWnd LW_DoneButton leftmouseup
/delay 1s
/if (${Spawn[corpse los targetable radius 100].ID}) /target corpse los radius 100
/if (${lootwait}==0) /return
/if (${Target.ID}) {
/stick 5 hold
/goto :Moveto
}
/return
|----------------------------------------------------------------------------
| SUB: Load Ini
|----------------------------------------------------------------------------
Sub LoadIni(string sectionName, string varName, string varType, string varValue, string varArray)
/if (${${varArray}.Size}>0) {
/declare i int local
/for i 1 to ${${varArray}.Size}
/if (!${Ini[${IniFileName},${sectionName},${varArray}${i}].Length}) /ini "${IniFileName}" "${sectionName}" "${varArray}${i}" "${varValue}"
/if (${Ini[${IniFileName},${sectionName},${varArray}${i}].Length}) /varset ${varArray}[${i}] ${Ini[${IniFileName},${sectionName},${varArray}${i}]}
/next i
/return
} else {
/if (!${Defined[${varName}]} && ${Defined[varType]}) /declare ${varName} ${varType} outer
/if (!${Ini[${IniFileName},${sectionName},${varName}].Length}) {
/if (${varValue.Length}) {
/ini "${IniFileName}" "${sectionName}" "${varName}" "${varValue}"
/varset ${varName} ${varValue}
DEBUG Sub Loadini /varset ${varName} ${varValue}
}
} else {
/varset ${varName} ${Ini[${IniFileName},${sectionName},${varName}]}
}
}
/return
afkmelee_charactername.ini
Rich (BB code):
[General]
dolootz=1
locstospot=9
HealerName=NameofSecondPlayer
[Lootz]
RV_LootArray1=Diamond
RV_LootArray2=Spell
RV_LootArray3=Geode
RV_LootArray4=Powder
RV_LootArray5=Ore
RV_LootArray6=Paper
RV_LootArray7=Vellum
RV_LootArray8=Parchment
RV_LootArray9=Arcanum
RV_LootArray10=Taaffeite
[XLocs]
SpawnXloc1=-443
SpawnXloc2=-443
SpawnXloc3=-443
SpawnXloc4=-251
SpawnXloc5=-251
SpawnXloc6=-251
SpawnXloc7=-347
SpawnXloc8=-347
SpawnXloc9=-347
SpawnXloc10=0
[YLocs]
SpawnYloc1=1391
SpawnYloc2=1515
SpawnYloc3=1714
SpawnYloc4=1714
SpawnYloc5=1515
SpawnYloc6=1391
SpawnYloc7=1280
SpawnYloc8=1122
SpawnYloc9=1280
SpawnYloc10=0

Last edited:


Will red cent you of course.