ecmonk.mac

Macro depository for macros written before the user variable changes that broke all of them.

Moderator: MacroQuest Developers

User avatar
L124RD
Site Admin
Site Admin
Posts: 1343
Joined: Fri Jun 14, 2002 12:15 am
Location: Cyberspace
Contact:

ecmonk.mac

Post by L124RD » Fri Jun 14, 2002 8:51 pm

Salutations,
This macro is one for monks in east commonlands. Put your special attacks (roundkick etc..) into ability 9 (third combat slot) mend into ability 8 (second combat slot) and kick into ability 7 (1st combat slot). Go into east commons and run it. Seems to work fine, though sometimes it will screw up and try to attack corpses around the guard...

Code: Select all

| ecmonk.mac -- East Commons
|  Fights in East commons, even returns you to EC when you die
|  usage: /macro ecmonk.mac <level>
|   where <level> is the level at which you want the macro to stop running...
| -----------------------------
| Written by: L124RD

#include routines.mac

sub main
 /echo "newbfight.mac now running..."
 /mqlog newbfight.mac now running...
 :attackloop
  /doevents
  /if "$zone()"!="East Commonlands" /goto :attackloop

  /if n $distance(-127,126)>750 /call gohome

  /varset v1 $char(level)
  /varadd v1 0
  /varset v2 $char(level)
  /if n $v2<4 /varset v2 0 
  /if n $v2>3 /varsub v2 3

  /varset v4 $char(level)
  /varsub v4 1
  /varset v5 $char(level)
  /varsub v5 2
  /varset v6 $char(level)
  /varsub v6 3

  /if n $char(level)==$p0 /goto :camp

  /target npc
  /if "$target()"=="FALSE" /goto :werestnow

  /if n $hp(pct)<50 /call rest

  /press esc
  /target npc range $v2 $v1

  /if "$target()"=="FALSE" /goto :werestnow
  /if "$target(type)"=="Corpse" /goto :werestnow
  /if n $target(hp)!=100 /goto :werestnow
  
  /if n $target(level)==$v1 /if n $hp(pct)>89 /call attackandfollow
  /if n $target(level)==$v1 /if n $hp(pct)<89 /goto :werestnow

  /if n $target(level)==$v4 /if n $hp(pct)>69 /call attackandfollow
  /if n $target(level)==$v4 /if n $hp(pct)<69 /goto :werestnow

  /if n $target(level)==$v5 /if n $hp(pct)>49 /call attackandfollow
  /if n $target(level)==$v5 /if n $hp(pct)<49 /goto :werestnow

  /if n $target(level)==$v6 /if n $hp(pct)>49 /call attackandfollow
  /if n $target(level)==$v6 /if n $hp(pct)<49 /goto :werestnow

  /press esc

  /call autoloot

  /if n $freeinv(size)==0 /call sell

  /stand

  /goto :attackloop
 
  :werestnow
   /call rest
   /goto :attackloop
  
  :camp
   /call campin
/return

Sub Rest
   /if n $hp(pct)<50 /echo You are under 50% hp! Running to guard...
   /if n $hp(pct)<50 /mqlog Current hp is at $hp(cur) out of $hp(max) possible hit points...
   /if n $hp(pct)>50 /echo You are above 50% hp... resting here...
   /if n $hp(pct)>50 /goto :DontMove
   /call AutoRun 1
   :CloserRest
   /face loc -127,126
   /if n $distance(-127,126)>$rand(15) /goto :CloserRest
   /call AutoRun 0
   :DontMove
   /if n $hp(pct)>80 /return
   /sit
   :KeepResting
    /if n $hp(pct)<80 /goto :KeepResting
/return

Sub AttackAndFollow
 /varset v3 $target(id)
 /varset s1 $target(name)
 /echo Going after $target(name)...
 /mqlog Attacking: $target(name). It is level $target(level) and is $target(distance) clicks away...
 /face
 /attack on
 /varset t0 4m
 :CloserAF
  /if "$target(id)"!="$v3" /goto :EndAF
  /if n $target(distance)>20 /sendkey down up
  /if n $target(distance)<21 /sendkey up up
  /if n $target(distance)<11 /sendkey down down
  /if n $target(distance)>10 /sendkey up down
  /if n $t0==0 /press esc
  /doability 9
  /doability 8
  /doability 7
  /face
  /if n $hp(pct)<33 /goto :run
  /goto :CloserAF

 :EndAF
  /echo "$s1 slain successfully"
  /mqlog $s1 slain successfully
  /call AutoRun 0
  /attack off
  /return
 
 :run
  /if $target(hp)<15 /goto :CloserAF
  /call AutoRun 0
  /mqlog Under 33% hp! running for it...
  /attack off
  /call rest
  /stand

/return

Sub AutoLoot
   /varset v7 0
   /press esc
   /target mycorpse
   /if "$target()"!="FALSE" /goto :TargetMyCorpse
   /target corpse

   :TargetMyCorpse
   /echo looting corpse of $target(name)
   /mqlog looting corpse of $target(name)
   /face
   /if n $target(distance)<15 /goto :CloseEnough
   /call AutoRun 1
   /varset t0 3m
   :CloserAL
      /face
   /if n $target(distance)>14 /if n $t0>0 /goto :CloserAL

   :CloseEnough
   /call AutoRun 0
   /loot
   /Delay 10
   /for v10 0 to 9
      /Delay 5
      /click left corpse $v1
      /Delay 10
      /if "$cursor(name)"=="NULL" /goto :continue
      /if "$target(name)"~~$char(name) /click left auto
      /if "$cursor(name)"~~"Fire" /varset v7 1
      /if n $cursor(value)<10 /click left destroy
      /if "$cursor(name)"!="NULL" /mqlog looted $cursor(name). $cursor(name)'s value: $cursor(value)
      /if n $cursor(value)>9 /click left auto
   /next v10
   :continue
   /delay 5
   /delay $rand(5)
   /if n $v7==1 /call dealwithfireeyes
   /delay $rand(5)
   /press esc
/return   

sub sell
 /echo Inventory full! Going to sell items...
 /mqlog Inventory full! Going to sell items...
 /call gotoloc -127,126
 /call gotoloc -157,116
 /press u

 /delay 10
 /dealy $rand(5)
 /target "Innkeep Harold"
 /call gototarg "Innkeep Harold"
 /delay $rand(5)
 /press u
 /delay 20
 /delay $rand(5)
 /sendkey down shift
 /for v3 2 to 7
  /for v4 0 to 7
   /click left bag $v3 $v4
   /delay 5
   /delay $rand(5)
   /click left merchant sell
   /delay 5
   /delay $rand(5)
  /next v4
 /next v3
 /sendkey up shift
 /cleanup
 /press i
 /delay 10
 /delay $rand(5)
 /call gotoloc -167,116
 /press u
 /delay 10
 /delay $rand(5)
 /call gotoloc -106,126
/return

sub campin
 /mqlog Logging off...
 /call AutoRun 1
 :gotoguard
 /face loc 62.25,96.25
 /if n $distance(62.25,96.25)>$rand(15) /goto :gotoguard
 /call AutoRun 0
 /sit
 /delay 5
 /delay $rand(5)
 /camp
/return

Sub Event_Zone
 /echo "zoned... $zone()"
 /mqlog zoned... $zone()
 /if "$zone()"=="West Freeport" /goto :died
 /sendkey up up
 /return
 :died
  /echo "Character has died... heading back to East Commonlands..."
  /mqlog Character has died... heading back to East Commonlands...
  /sendkey down up
 :diedloop
  /face loc 215,800
  /if "$zone()"!="East Commonlands" /goto :diedloop
/return

sub dealwithfireeyes
 /mqlog dealing with fire beetle eyes...
 /click left equip primary
 /if "$cursor()"=="TRUE" /call fireloop
 /click left equip secondary
 /if "$cursor()"=="TRUE" /call fireloop
/return

sub fireloop
 /for v3 2 to 7
  /for v4 0 to 7
   /click left bag v3 v4
   /delay 5
   /delay $rand(5)
  /next v4
 /next v3
/return

sub gohome
 /echo "You are away from the guard, Running toward him..."
 /mqlog Character to far away from the guard... running back to his vicinity...
 /sendkey down up
 :gohomeloop
  /face loc -127,126
  /if n $distance(-127,126)>250 /goto :gohomeloop
 /sendkey up up
/return
Last edited by L124RD on Sat Jun 15, 2002 8:35 pm, edited 1 time in total.

User avatar
L124RD
Site Admin
Site Admin
Posts: 1343
Joined: Fri Jun 14, 2002 12:15 am
Location: Cyberspace
Contact:

Post by L124RD » Sat Jun 15, 2002 8:23 pm

Salutations,
Bumping since I made an update... Now checks to make sure targets hp is 100, if its not that means it is being attacked (or just killed something i guess) but this will greatly reduce the amount of attempted (or succedded) kill steals the macro makes. The line where it runs if you are under 1/3 health was moved to the bottom as with another line added where if you were running away while they had half the health you did (33 vs 15 at max) then you would keep fighting. With the run line where it was you would not use your abilities when you were at this low health fighting stage.

Wally
decaying skeleton
decaying skeleton
Posts: 6
Joined: Wed Jun 26, 2002 11:18 am

needs update

Post by Wally » Tue Jul 16, 2002 4:17 pm

I decided to test this one, and it doesn't work anymore
$hp(pct) is now $char(hp,pct)
$target(hp) is now $target(hp,xxx) where xxx=cur,max,pct

after resting, he doesn't stand up, in sub rest is only a /sit command.

when you die, you zone into WFP, and nothing happens anymore

most of the times when you kill something the macro will target NULL after that, and start running backwards. nothing happens then anymore.


I'll see how far I can get this one fixed, and post my updated version.