In fact to make it clearer, do this.
I got the info from your link to this post here:
http://www.macroquest2.com/phpBB2/viewtopic.php?t=8662 And from having done it before.
Copy and paste the text in the code box here to a new and empty text file and rename it as your money.mac file.
Code: Select all
| Killandloot.mac
|
| syntax:
| /macro killandloot <MobName> <Partial loot name>
| Example:
| /macro killandloot skel bone
|
|You need MQ2MoveUtils plugin
#include travel.inc
#include move.inc
#Event Death "You have slain#*#"
#Event NoTarget "You must first click on the being#*#"
#Event NoSpawn "[MQ2] There are no spawns matching#*#"
Sub Main
/deletevar DeathYet
/deletevar LootName
/deletevar MobName
/deletevar NoSpawn
/deletevar NoTarget
/declare DeathYet int Global
/declare LootName string Global
/declare MobName string Global
/declare NoSpawn int Global
/declare NoTarget int Global
/varset LootName ${Param1}
/varset MobName ${Param0}
/varset NoSpawn 0
/varset NoTarget 0
:Top
/if (${Me.Combat}) /attack off
/varset DeathYet 0
/call GMCheck
/target ${MobName} npc
/delay 5
/doevents
/if (${NoSpawn}==1) {
/echo No spawns up, waiting for 60sec
/delay 60s
/varset NoSpawn 0
/mqgoto :Top
}
/if (${String[${Target}].Find["corpse"]}) /mqgoto :Top
/if (${String[${Target}].Find["NULL"]}) /mqgoto :Top
/if (${Target.Level}>=35) {
/echo Target is above levl 35, waiting for 60sec
/delay 60s
/varset NoSpawn 0
/mqgoto :Top
}
/call MoveToSpawnName ${Target} 9
/stick 9
:DeathYet
/if (!${Me.Combat}) /attack on
/if (${Target.Distance3D}>20 || ${Target.Level}>11 || ${Me.PctHPs}<80) {
/delay 4
/cast "Touch of Mujaki"
/delay 2
/cast "Touch of Mujaki"
/delay 2
/cast "Touch of Mujaki"
/delay 2
/cast "Touch of Mujaki"
/delay 40
}
/if (${String[${Target}].Find["NULL"]}) {
/echo You lost your target, attempting to loot a corpse, then starting over . . .
/mqgoto :Loot
}
/doevents
/delay 5
/if (${NoSpawn}==1) {
/echo No spawns up, waiting for 60sec
/delay 60s
/varset NoSpawn 0
/mqgoto :Top
}
/if (${NoTarget}==1) {
/echo No Target reached
/varset NoTarget 0
/mqgoto :Top
}
/if (${DeathYet}==0) /mqgoto :DeathYet
:Loot
/delay 2
/if (${Me.Combat}) /attack off
/call lootmob ${LootName}
/mqgoto :Top
/return
|--------------------------------------
Sub Event_Death
/varset DeathYet 1
/return
|--------------------------------------
Sub Event_NoSpawn
/varset NoSpawn 1
/return
|--------------------------------------
Sub Event_NoSpawn
/varset NoTarget 1
/return
Now copy the text in the code box below to another new and empty text file and rename it move.inc
Code: Select all
|
| move.inc
|
|Advanced moving and object-avoidance routines
|
|Originally by beatnik007 (Who credits Mckorr)
|
|Revised and converted to MQ2Data by Terramantian
|
|Signifagant and on-going Improvments by EQBot_Man 8.9.04
| Added /call MoveToSpawnName
| This will take a partial name and a distance and reliably target and move
| to the nearest spawn of that name
| Added code to get you to stop a lot closer than 10 units. You should stop almost
| right at the location you want when using MoveToLoc
| Sometimes you would get stuck at a door and if you were macroing unattended
| you would continue to strafe for hours making it obvious you were
| macroing. Added code that if the strafe function is called more
| than 10 times in 60 sec to /quit you out
| Have added lots of little checks including NULL targets and corpse checks and a lot
| of little things that I can't remember now but I needed to add due to rare
| circumstances of the subroutines failing to do what they were desigend to do.
|
| Subroutines:
| Sub MoveToLoc
| Moves you to a specified xy loc
| Sub MoveToSpawn
| Moved you to a specified ID number(pretty pointless)
| Sub MoveToSpawnName
| Moves you to the nearest spawn given a partial or full name
|
|===================================================|
| Sub MoveToLoc |
|---------------------------------------------------|
|This simply moves the player to within 1 unit of |
|the requested location, while avoiding obstacles |
| |
|This is beatnik007's original sub, with a few minor|
|changes and rewritten in MQ2Data format |
| |
|SYNTAX: /call MoveToLoc Y X |
Sub MoveToLoc(MoveToY, MoveToX)
/echo Moving to Location: ${MoveToY}, ${MoveToX}.
/echo Distance: ${Math.Distance[${Me.Y},${Me.X}:${MoveToY},${MoveToX}]}
/declare FailureTimer timer local 0
/declare StrafeFailure int local
/declare running int local
/declare MaxSpeed int local
/declare StopDistance int local
/declare distanceNow float local
/declare distanceBefore float local
/declare distanceModifier int local
/varset running 0
/declare distanceTimer timer 15
/varset distanceBefore ${Math.Distance[${Me.Y},${Me.X}:${MoveToY},${MoveToX}]}
/varset distanceModifier 1
/varset MaxSpeed 0
:moveToLocation
/if (${Me.Speed}>=${MaxSpeed}) /varset MaxSpeed ${Me.Speed}
/if (${MaxSpeed}<=166) {
/varset StopDistance 3
} else {
/varset StopDistance 10
}
/face fast nolook loc ${MoveToY},${MoveToX}
/if (${Math.Distance[${Me.Y},${Me.X}:${MoveToY},${MoveToX}]}<${StopDistance}) {
/keypress forward
/return
}
/if (${distanceTimer}==0) {
/if (${Me.Sneaking}) {
/varset distanceModifier 2
} else {
/varset distanceModifier 1
}
/varset distanceNow ${Math.Distance[${Me.Y},${Me.X}:${MoveToY},${MoveToX}]}
/if (${Math.Calc[${distanceBefore}-${distanceNow}]}<${Math.Calc[10/${distanceModifier}]}) {
/if (${FailureTimer}==0) {
/varset StrafeFailure 0
/varset FailureTimer 600
}
/if (${FailureTimer}>0) {
/varset StrafeFailure ${Math.Calc[${StrafeFailure} + 1]}
}
/if (${StrafeFailure}>=10 && ${FailureTimer}>0) {
/keypress forward
/keypress back hold
/delay 5
/keypress back
/afk Be back later, leave a message
/echo Your movement failed more than 10 times in 30 seconds and most likely looked macroed. Ending macro. . .
/endmacro
/quit
}
/call strafePastObstacle ${StrafeFailure}
}
/varset distanceBefore ${Math.Distance[${Me.Y},${Me.X}:${MoveToY},${MoveToX}]}
/varset distanceTimer 15
}
/if (${running}==0) {
/keypress forward
/if (${Math.Distance[${Me.Y},${Me.X}:${MoveToY},${MoveToX}]}>${StopDistance}) {
/varset running 1
/keypress forward hold
}
} else {
/if (${Math.Distance[${Me.Y},${Me.X}:${MoveToY},${MoveToX}]}<${StopDistance}) {
/varset running 0
/keypress forward
}
}
/mqgoto :moveToLocation
/return
| Sub MoveToSpawn |
|---------------------------------------------------|
|This moves the player to within a provided distance|
|of the provided spawn, while avoiding obstacles |
| |
|I "wrote" this, but as you can see, it's the same |
|as MoveToLoc with a few variable replacements. |
| |
|The second parameter, Distance, allows for the |
|player to stop short of the target by a certain |
|amount, to provide for different aggro radii, etc. |
| |
|SYNTAX: /call MoveToSpawn ID Distance |
Sub MoveToSpawn(MoveToID, StopDistance)
/if (!(${Defined[MoveToID]})||(${Spawn[MoveToID].ID})) {
/echo Spawn ID not found or no ID provided. Aborting...
/return
}
/if (!(${Defined[StopDistance]})) {
/echo Stopping point not defined, using default distance of 70
/declare StopDistance int local
/varset StopDistance 70
}
/echo Moving to Spawn: ${MoveToID} (${Spawn[${MoveToID}].CleanName}).
/echo Current Location: ${Spawn[${MoveToID}].Y}, ${Spawn[${MoveToID}].X}
/echo Current Distance: ${Spawn[${MoveToID}].Distance}
/declare FailureTimer timer local 0
/declare StrafeFailure int local
/declare running int local
/declare distanceNow float local
/declare distanceBefore float local
/declare distanceModifier int local
/varset running 0
/declare distanceTimer timer 15
/varset distanceBefore ${Spawn[${MoveToID}].Distance}
/varset distanceModifier 1
:moveToSpawn
/squelch /face fast nolook id ${MoveToID}
/if (${Spawn[${MoveToID}].Distance}<${StopDistance}) {
/keypress forward
/return
}
/if (${distanceTimer}==0) {
/if (${Me.Sneaking}) {
/varset distanceModifier 2
} else {
/varset distanceModifier 1
}
/varset distanceNow ${Spawn[${MoveToID}].Distance}
/if (${Math.Calc[${distanceBefore}-${distanceNow}]}<${Math.Calc[10/${distanceModifier}]}) {
/if (${FailureTimer}==0) {
/varset StrafeFailure 0
/varset FailureTimer 600
}
/if (${FailureTimer}>0) {
/varset StrafeFailure ${Math.Calc[${StrafeFailure} + 1]}
}
/if (${StrafeFailure}>=10 && ${FailureTimer}>0) {
/keypress forward
/keypress back hold
/delay 5
/keypress back
/sit
/afk Be back later, leave a message
/echo Your movement failed more than 10 times in 30 seconds and most likely looked macroed. Ending macro. . .
/endmacro
/quit
}
/call strafePastObstacle ${StrafeFailure}
}
/varset distanceBefore ${Spawn[${MoveToID}].Distance}
/varset distanceTimer 15
}
/if (${running}==0) {
/keypress forward
/if (${Spawn[${MoveToID}].Distance}>=${StopDistance}) {
/varset running 1
/keypress forward hold
}
} else {
/if (${Spawn[${MoveToID}].Distance}<${StopDistance}) {
/varset running 0
/keypress forward
}
}
/mqgoto :moveToSpawn
/return
| Sub MoveToSpawnName |
|---------------------------------------------------|
|This moves the player to within a provided distance|
|of the provided spawn, while avoiding obstacles |
| |
|I "wrote" this, but as you can see, it's the same |
|as MoveToLoc with a few variable replacements. |
| |
|The second parameter, Distance, allows for the |
|player to stop short of the target by a certain |
|amount, to provide for different aggro radii, or to|
|attack. |
| |
|SYNTAX: /call MoveToSpawnName Name Distance |
| Does take partial names: |
| /call MoveToSpawnName skel 9 |
| to move you to the nearest skeleton |
| |
| I use this for farming bone chips and silks |
Sub MoveToSpawnName(Name, StopDistance)
/keypress esc
/target ${Name} npc
/delay 2
/if (${String[${Target}].Find["NULL"]}) /return
/if (${String[${Target}].Find["corpse"]}) /return
/if (!${Target.ID}) {
/echo Name not found or no name provided. Aborting...
/return
}
/if (!(${Defined[StopDistance]})) {
/echo Stopping point not defined, using default distance of 70
/declare StopDistance int local
/varset StopDistance 70
}
/echo Moving to Spawn: ${Target.CleanName}.
/declare FailureTimer timer local 0
/declare StrafeFailure int local
/declare running int local
/declare distanceNow float local
/declare distanceBefore float local
/declare distanceModifier int local
/varset running 0
/declare distanceTimer timer 15
/varset distanceBefore ${Target.Distance}
/varset distanceModifier 1
:moveToSpawn
/if (${String[${Target}].Find["NULL"]}) /return
/face fast predict
/if (${Target.Distance}<${StopDistance}) {
/keypress forward
/return
}
/if (${distanceTimer}==0) {
/if (${Me.Sneaking}) {
/varset distanceModifier 2
} else {
/varset distanceModifier 1
}
/varset distanceNow ${Target.Distance}
/if (${Math.Calc[${distanceBefore}-${distanceNow}]}<${Math.Calc[10/${distanceModifier}]}) {
/if (${FailureTimer}==0) {
/varset StrafeFailure 0
/varset FailureTimer 600
}
/if (${FailureTimer}>0) {
/varset StrafeFailure ${Math.Calc[${StrafeFailure} + 1]}
}
/if (${StrafeFailure}>=10 && ${FailureTimer}>0) {
/keypress forward
/keypress back hold
/delay 5
/keypress back
/sit
/afk Be back later, leave a message
/echo Your movement failed more than 10 times in 30 seconds and most likely looked macroed. Ending macro. . .
/endmacro
/quit
}
/call strafePastObstacle ${StrafeFailure}
}
/varset distanceBefore ${Target.Distance}
/varset distanceTimer 15
}
/if (${running}==0) {
/keypress forward
/if (${Target.Distance}>=${StopDistance}) {
/varset running 1
/keypress forward hold
}
} else {
/if (${Target.Distance}<${StopDistance}) {
/varset running 0
/keypress forward
}
}
/mqgoto :moveToSpawn
/return
| Only to be used by the previous functions - It's obvious what it does. |
sub strafePastObstacle(Number)
/keypress forward
/keypress back hold
/delay ${Math.Calc[${Number}*3/2+4]}
/keypress back
/if (!${Me.State.Equal["STAND"]}) /stand
/if (${Math.Rand[99]}>50) {
/keypress strafe_right hold
} else {
/keypress strafe_left hold
}
/delay ${Math.Calc[${Number}*4+5]}
/keypress strafe_right
/keypress strafe_left
/keypress forward hold
/return
Sub Turn(THeadingY,THeadingX)
/declare PHeading outer 0
/declare THeading outer 0
/declare Bearing outer 0
/declare IsTurning outer 0
/declare TurnKey outer NULL
:TurnLoop
/delay 0
/if (${Me.Sitting}) /sit off
/varset PHeading ${Me.Heading.Degrees}
/if (${Defined[THeadingX]}) {
/varset THeading ${Heading[${THeadingY},${THeadingX}].Degrees}
} else {
/varset THeading ${Target.HeadingTo.Degrees}
}
/varset Bearing ${Math.Calc[(${PHeading}-${THeading}+540)%360-180]}
/if (${Bearing}>=-7 && ${Bearing}<=7) {
/if (${String[${TurnKey}].NotEqual[NULL]}) /keypress ${TurnKey}
/face heading ${Heading[${THeading}].Degrees} nolook
/return
} else /if (${Bearing}>=-180 && ${Bearing}>=7) {
/if (${String[${TurnKey}].NotEqual[LEFT]}) /varset TurnKey LEFT
} else /if (${Bearing}<=180 && ${Bearing}<=7) {
/if (${String[${TurnKey}].NotEqual[RIGHT]}) /varset TurnKey RIGHT
}
/if (!${IsTurning}) {
/keypress ${TurnKey} hold
/varset IsTurning 1
}
/mqgoto :TurnLoop
/return
Also copy the text in the code box below here to a new and empty text file and rename it to travel.inc
Code: Select all
sub LootMob(Loot)
| Note: the number 4.3 in the /varset MoveDelay was empirically
| set for IRS5 ( Speed = 150 )
/declare MoveDelay int local
/declare LootSlot int local 1
/keypress ESC
/keypress ESC
/keypress ESC
/keypress ESC
/timed 150 /stand
/timed 155 /notify LootWnd DoneButton leftmouseup
:Top
/target npc corpse
/delay 2
/if (${Target.Distance}<15) {
/face fast
} else /if (${Target.Distance}>=15 && ${Target.Distance}<120) {
/face fast
/keypress forward hold
/varset MoveDelay ${Math.Calc[(${Target.Distance})/4.3]}
/keypress forward hold
/delay ${MoveDelay}
/keypress forward
/mqgoto :Top
} else {
/echo Corpse is too far away
/keypress ESC
/return
}
/echo Looking for "${Loot}"
:LootWnd
/loot
/if (!${Window[LootWnd].Open}) /mqgoto :LootWnd
:lootloop
/if (${Me.State.Equal["STAND"]}) /mqgoto :doneloot
/if (${Corpse.Items}==0) {
/mqgoto :doneloot
}
/if (${LootSlot}>=32) /mqgoto :doneloot
:Loot
/itemnotify Loot${LootSlot} leftmouseup
/delay 1s
/if (${Window[ConfirmationDialogBox].Open}) {
/notify ConfirmationDialogBox Yes_Button leftmouseup
/delay 1s
}
/if (${String[${Cursor.Name}].Find[${Loot}]}) {
/echo YOU WIN: ${Cursor.Name}
/autoinv
/delay 2
|/call FindWand
} else {
/if (${Cursor.Value}>5000 || ${Cursor.Tribute}>500) {
/echo ${Cursor.Name} is worth more than 5pp or tribute is greater than 500
/autoinv
/delay 5
} else {
/echo Destroying ${Cursor}
/destroy
/delay 5
}
}
/varcalc LootSlot ${LootSlot}+1
/mqgoto :lootloop
:doneloot
/notify LootWnd DoneButton leftmouseup
/varset LootSlot 0
/return
|=================================================
Sub GMCheck
/if (${Spawn[gm].ID}) {
/keypress forward
/keypress back
:FD
/delay 5
/cast "Death Peace"
/if (!${Me.SpellReady["Death Peace"]}) /mqgoto :FD
/if (!${Me.State.Equal[FEIGN]}) /mqgoto :FD
/afk Be back later, leave a message
/echo GM in the zone
/endmacro
}
/return
|=======================================================
Sub LoH
:Mujaki
/if (!${Me.State.Equal["STAND"]}) /stand
/if (${Me.PctHPs}<=60) {
/if (${String[${Target}].Find["NULL"]}>0) /mqgoto :Mujaki
/if (${Spawn[npc Radius 100].ID} && ${Spawn[npc Radius 100].LineOfSight}) {
/target ${Spawn[npc Radius 100]}
} else {
/return
}
/if (!${Me.SpellReady["Touch of Mujaki"]}) /mqgoto :Mujaki
/cast "Touch of Mujaki"
/delay 2
/cast "Touch of Mujaki"
/delay 2
/cast "Touch of Mujaki"
/delay 2
/cast "Touch of Mujaki"
/delay 2
/if (${Me.PctHPs}>60) /return
/mqgoto :Mujaki
} else {
/return
}
/return
Now you can take these 3 files you have made and copy them to your ...Desktop\New Folder\macros folder (or where ever your mq2 files are).
Sometimes macros are tweaked for one character and will not work right for some others so it may need more work if you can get it to run. I also see that it is looks to be made to kill one type of mob and loot one type of item so the proper command to run it would be:
/mac money skel bone
To kill skellies and loot bone chips. If you just want to loot the coin you still need to tell it what mob to kill so you could use:
/mac money skel xyz
Since no loots start with xyz it would kill skellies and just loot the coin.