Hunter.mac -- Killer Hunting Script - Updated 12/30/02

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

Moderator: MacroQuest Developers

What do you think of this script?

Tried it, leveled my character fast
2
11%
Tried it, leveled my character slowly
1
6%
Tried it, wasn't impressed
0
No votes
Tried it, Hated it
0
No votes
Couldn't get it to work
5
28%
Didn't try it, don't care to
10
56%
 
Total votes: 18

Fyrestorm
decaying skeleton
decaying skeleton
Posts: 5
Joined: Fri Nov 01, 2002 7:31 pm

Hunter.mac -- Killer Hunting Script - Updated 12/30/02

Post by Fyrestorm » Fri Dec 27, 2002 8:21 pm

Ok, completely inspired by Fippy awesome little hunting script, I rewrote it a couple days ago. I'm new to macroquest, so bare with me on the code. It's far from complete and actually I'm thinking of rewriting it in perl, since I just noticed macroquest supports perl. I ran into a lot of problems with it along the way, but it leveled 2 characters very quickly. I started with a Bard and then a Warrior. I need to add other classes and zones to it. I'd like it to eventually change zones when the character levels to a certain level. That should be very easy to do, I just have to map out the zones and bind points.

Anyway here it is. I separated it into several smaller files to make it easier to develop.

Change Log
12/30/02
- Fixed many errors
- Added reports to the log file

Todo
- Figure out why estimated experience per hour is wrong
- Add Fearlist and Level check
- Add option - Drag corpse back to safe location before looting
- Add option - Pull mobs to camp, then fight
- Move options to beginning of script
- Banking
- Selling Loot
- Buying spells, armor, and weapons
- Add check to see if spells are in book before trying to memorize
- Change spells when level changes
- Add caster and pet logic

Code: Select all

|Hunter.mac
|

| Debug messages
| 1 for on, 0 for off
#define DEBUG 0

#turbo

| Standard Libraries
#include routines.mac
#include spellbook.mac

| Hunter Libraries
#include HunterVariables.mac
#include HunterZone.mac
#include HunterCommon.mac
#include HunterMove.mac
#include HunterRest.mac
#include HunterSpells.mac
#include HunterFight.mac
#include HunterLoot.mac
#include HunterEvents.mac

sub Main

    | Clean things up
    /zapvars
    /call InitVars
    /call CleanUpWins

    | Set these to the Zones you are fighting in and are bound in
    /call SetZone
    /call SetHomePoint

    | These are things to hunt or run from
    /call SetAlerts

    | Set KS radius below. The script will not target a mob if a PC is within this radius of it.
    /varset KSRadius 60


    | These are variables you need to set
    /varset FightZone NRO
    /varset EmergencyZone NRO
    /varset LootMobs No
    /mqlog *************************************************************************************
    /mqlog Hunter Script started at $time(h):$time(m):$time(s) on $date(m)\$date(d)\$date(y)
    /mqlog *************************************************************************************

    | Main Event Loop
    :Start

    | For Debugging new features
|    /goto :HunterOff

      /if $Action==RUNNING_HOME {
          /attack off
          /call SetZone
          /call Debug RunningHome
          /if $EmergencyZone==$CurrentZone {
              /if n $AtTarget==1 {
                  /call Debug RunningHome-BackHome
                  /varset BackHome 1
                  /varset Action RESTING
              } else {
                  /call runtoloc $HomeX $HomeY
              }
          } else {
              /call Zone $EmergencyZone
              /varset BackHome 1
              /varset Action RESTING
          }
      }


      /if $Action==CAMP_HOME {
          /call Debug CampHome
          /attack off
          /if n $target(id)!=0 {
              /varset KSAgain 1
              /varset Action BATTLE
          } else {
              /call SetZone
              /if n $CurrentZone!=$FightZone /varset Action READY
              /if n $AtTarget==1 {
                  /call Debug CampHome-BackHome
                  /if "$char(state)"!="SIT" /sit
                  /varset Action AQUIRE
              } else {
                  /call runtoloc $CampX $CampY
                  /call GetTarget $calc($CampDist-$distance($CampY,$CampX))
                  /call Debug Searching $calc($CampDist-$distance($CampY,$CampX))
              }
              /if n $HaveTarget==1 {
                  /echo Have Target
                  /mqlog Targeted $target(name) Level $target(level) at $target(x),$target(y),$target(z)
                  /varset Action BATTLE
                 /varset KSAgain 1
              }
          }
      }


      /if $Action==RESTING {
          /call Debug Resting
          /call MemorizeSpells
          /call resting
          /call SetZone
          /if n $CurrentZone!=$FightZone /varset Action READY
          /if n $Rested==1 {
              /echo Fully Healed
              /varset Action READY
          }
      }

      /if $Action==READY {
          /call Debug Ready
          /varset Action AQUIRE
          /call SetZone

          |Make sure Spells are Memmed
          /call MemorizeSpells

          /mqlog My health is at $char(hp,pct)%

          | How's our Health?
          /call statuscheck
          /if n $NotHealthy==1 {
              /varset AtTarget 0
              /varset Action RUNNING_HOME
          } else /if $Action==CORPSERUN {
                 /call Debug Running after Corpse
          } else /if n $CurrentZone!=$FightZone {
              /varset AtTarget 0
              /call Zone $FightZone
              /varset Action READY
          } else /if $CampX!=0 {
              /call Debug Using Camp $CampX $CampY
              /varset AtTarget 0
              /call GetTarget 20
              /varset Action CAMP_HOME
          }
      }

      /if $Action==AQUIRE {
          /call Debug Aquire
          /call HealMe
          /call SetZone
          /if n $CurrentZone!=$FightZone /varset Action READY
          /if n $CampDist>0 {
              /call GetTarget $CampDist
          } else {
              /call GetTarget
          }
          /if n $HaveTarget==1 {
              /echo Have Target
              /mqlog Targeted $target(name) Level $target(level) at $target(x),$target(y),$target(z)
              /varset Action BATTLE
              /varset KSAgain 1
          }
      }

      /if $Action==BATTLE {
          /call Debug Battle
          /call runtoloc $target(x) $target(y)
          /if n $AtTarget==1 {
              /if n $KSAgain!=0 {
                  /mqlog KS Checking $target(name) again
                  /call Debug KS Checking $target(name) again
                  /target npc notnearalert 4 nopcnear $KSRadius radius 20 range 0 $calc($char(level)-1)
                  /varset KSAgain 0
                  /varset LastMobLevel $target(level)
                  /varset LastExp $char(exp)
                  /varset KillTime $running
                  /if n $target(id)==0 {
                      /mqlog KS Alert! Backing off
                      /call Debug KS Alert! Backing off
                  }
              }
              /call Debug Battle-Spell
              /call FightSpell
              /call Debug Battle-Melee
              /call melee
          }
          /if n $TargetDead==1 {
                  /call Debug Battle-TargetDead
                  /varset Action LOOTING
          }
          /if n $target(id)==0 {
              /call Debug Battle-TargetLost
              /varset Action READY
          }
          | Retreat!
          /if n $char(hp,pct)<50 /if n $target(hp,pct)>50 {
              /mqlog $target(name) is killing me at $calc($running-$KillTime) seconds into battle, retreat!
              /varadd TotalRetreats 1
              /varset AtTarget 0
              /varset Action RUNNING_HOME
          }
      }

      /if $Action==CORPSERUN {
              /call Debug CorpseRun
              /call runtoloc $target(x) $target(y)
              /if n $AtTarget==1 {
                  /mqlog Looting Corpse
                  /call Debug CorpseRun-AtTarget
                  /varset Action LOOTING_CORPSE
              }
      }

      /if $Action==LOOTING_CORPSE {
          /call Debug Looting Corpse
          /call loot
          /if n $TargetLooted==1 {
              /call Debug Looting Corpse Complete
              /varset Action READY
          }
      }

      /if $Action==LOOTING {
          /call Debug Looting
          /call loot $LootMobs
          /if n $TargetLooted==1 {
              /call Debug Looting-LootingComplete
              /varset Action READY
          }
      }

      | Work on my skills
      /if $Action!=LOOTING /if $Action!=CORPSERUN {
          /call Debug WorkSkills
          /call WorkSkills
      }

      /if $Action!=RESTING /if $Action!=RUNNING_HOME {
          /if n $char(hp,pct)<20 {
              /call Debug Low Health Retreat
              /varset AtTarget 0
              /varset Action RUNNING_HOME
          }
      }

      :HunterOff

      | Process any events
      /doevents

    /goto :Start
/return

Code: Select all

|HunterVariables.mac
|

| Home Position
#define HomeY v1
#define HomeX v2
|Am I home?
#define BackHome v3

| Zones
#define CurrentZone v4
|
#define GFAY 1
#define BBM 2
#define EFP 3
#define NRO 4
#define NEKT 20

|My location for collision detection
#define MyXLoc v5
#define MyYLoc v6

|Direction Modifier to change direction monentarily to get around or avoid objects
#define DirMod v7
#define AvoidMod v8

| Actions
#define Action v9
|
#define READY 0
#define RUNNING_HOME 1
#define RESTING 2
#define AQUIRE 3
#define BATTLE 4
#define STATUSCHECK 5
#define LOOTING 6
#define CORPSERUN 7
#define LOOTING_CORPSE 8

| Fighting Variables
#define AttackedMe v10
#define KSRadius v11
#define MyTarget v12
#define MyHeading v13
#define TargetHeading v14
#define ZoneDest v15
#define TargetDead v16
#define KSCheck v17
#define NewAttacker v18
#define NewAttackerLen v19
#define Attacker v20
#define TargetX v21
#define TargetY v22
#define AtTarget v23
#define HaveTarget v24
#define NotHealth v25
#define Rested v26
#define TargetRadius v27
#define FightZone v28
#define BindZone v29
#define EmergencyZone v30
#define CampX v31
#define CampY v32
#define CampDist v33
#define MaxAltitude v34
#define LastLevel v35
#define LevelTime v36
#define KillTime v37
#define KSAgain v38
#define MobsKilled v39
#define LastMobLevel v40
#define TotalMobLevel v41
#define LastExp v42
#define TotalExpGain v43
#define TotalRetreats v44
#define TotalDeaths v45

| Looting Variables
#define TargetLooted v50
#define LootSlot v51
#define CheckLoot v52
#define LootTotal v53
#define LootMobs v54


| Casting timer, keeps from recasting buffs and heals to soon
#define CastTimer t1
#define AvoidTimer t2

Code: Select all

| HunterZone.mac
| 
| Zone specific Info for Hunter Script
#define HomeY v58
#define HomeX v59

| This Sub sets up the alert lists for the mobs we want to hunt 
|
sub SetAlerts 
|------------------------------------------------------------------------------------
| Setup Alerts for the most important mobs here (rare)
| 
   /alert clear 1
|   /alert add 1 npc radius 500 range $calc($char(level)-3) $calc($char(level)-1) oracle

|------------------------------------------------------------------------------------
| Setup Alerts for the next most important mobs here (uncommon)
|
   /alert clear 2
|   /alert add 2 npc radius 2000 range $calc($char(level)-3) $calc($char(level)-1) runner

|------------------------------------------------------------------------------------
| Setup Alerts for Scary mobs here
|
   /alert clear 4
| Zones sould be created in Alphebetical order for ease of finding them
/if n $CurrentZone==GFAY {
|------------------
| Greater Faydark
|------------------
   /alert add 4 npc radius 200 basilisk
|   /alert add 4 npc radius 200 oracle
|   /alert add 4 npc radius 200 bandit
|   /alert add 4 npc radius 200 coyote
   /alert add 4 npc radius 20 ashwood
   /alert add 4 npc radius 20 grynn
   /alert add 4 npc radius 20 tunfar
   /alert add 4 npc radius 20 idia
   /alert add 4 npc radius 20 webdancer
   /alert add 4 npc radius 200 willowisp
   /alert add 4 npc radius 200 shaman
|   /alert add 4 npc radius 200 arborean
} else /if n $CurrentZone==BBM {
|------------------
| Butcherblock Mountains
|------------------
   /alert add 4 npc radius 20 dunfire
   /alert add 4 npc radius 20 darklin
   /alert add 4 npc radius 20 smeltpot
   /alert add 4 npc radius 20 gundl
   /alert add 4 npc radius 20 rundl
   /alert add 4 npc radius 20 Peg
   /alert add 4 npc radius 20 Splendyr
   /alert add 4 npc radius 20 Marwind
   /alert add 4 npc radius 20 Mumfur
   /alert add 4 npc radius 20 Thranon
   /alert add 4 npc radius 200 basilisk
} else /if n $CurrentZone==NEKT {
|------------------
| Nektulos Forest
|------------------
|   /alert add 4 npc radius 200
} else /if n $CurrentZone==NRO {
|------------------
| North Ro
|------------------
   /alert add 4 npc radius 300 Dynn
   /alert add 4 npc radius 200 Cutthroat
   /alert add 4 npc radius 200 Lesser
   /alert add 4 npc radius 200 Zombie
   /alert add 4 npc radius 200 Madman
   /alert add 4 npc radius 200 Ghoul
}



|------------------
| Never Attack
|------------------
|
/alert add 4 npc radius 60 guard
/alert add 4 npc radius 60 drunkard
/alert add 4 npc radius 60 merchant
/alert add 4 npc radius 60 banker
/alert add 4 npc radius 60 soulbind
/alert add 4 npc radius 60 discord


/return


|------------------------------------------------------------------------------------
| This sub sets our home point we return to if low on health
|
sub SetHomePoint

|These sould be created in Alphebetical order for ease of finding
/if n $CurrentZone==GFAY {
|------------------
| Greater Faydark
|------------------
   /varset MaxAltitude 2000
   /varset HomeX 204.63
   /varset HomeY 137.18

   |if x is 0, used safe zone as camp
   /varset CampX 0
   /varset CampY 0
   /varset CampDist 8000
} else /if n $CurrentZone==BBM {
|------------------
| Butherblock Mountains
|------------------
    /varset MaxAltitude 60
    /if n $BindZone==GFAY {
       /varset HomeX -2935
       /varset HomeY -1112

       |if x is 0, used safe zone as camp
       /varset CampX 0
       /varset CampY 0
       /varset CampDist 2000
    }
} else /if n $CurrentZone==NEKT {
|------------------
| Nektulos Forest
|------------------
    /varset MaxAltitude 2000
    /varset HomeX -1004.53
    /varset HomeY 2305.33

    |if x is 0, used safe zone as camp
    /varset CampX 0
    /varset CampY 0
    /varset CampDist 2000

} else /if n $CurrentZone==NRO {
|------------------
| North Ro
|------------------
   /varset MaxAltitude 2500
   /varset HomeX 452
   /varset HomeY 3414

   |if x is 0, used safe zone as camp
   /varset CampX -196
   /varset CampY 503
   /varset CampDist 8000
}

/return

|------------------------------------------------------------------------------------
| This sub does the checks to make sure we avoid certain specified areas
sub CheckObstacles

| this sub just calls avoidloc for each area i want to avoid
/if $CurrentZone==GFAY {
|------------------
| Greater Faydark
|------------------
   | Bandit Camp
   |/call avoidloc 184 -856 30
} else /if $CurrentZone==NEKT {
|------------------
| Nektulos Forest
|------------------
   | Skeleton Hill
   |/call avoidloc 184 -856 30
} else /if $CurrentZone==NRO {
|------------------
| North Ro
|------------------
   | Camps
   /call avoidloc 415 253 500
}



/return

sub SetZone
    /call Debug SetZone

    | CurrentZone
    /if "$zone"=="Butcherblock Mountains" /varset CurrentZone BBM
    /if "$zone"=="Greater Faydark" /varset CurrentZone GFAY
    /if "$zone"=="East Freeport" /varset CurrentZone EFP
    /if "$zone"=="North Ro" /varset CurrentZone NRO

    /call Debug In $zone $CurrentZone

    | BindZone - This doesn't work, so if someone can tell me why, I'd love to
    |            fix it.  I have to manually set it, but I'd like to setup the
    |            FightZone based on the level and bind zone and have it automatically
    |            change camps and zones when the character levels.
|    /if "$zone(bound)"=="Butcherblock Mountains" /varset BindZone BBM
|    /if "$zone(bound)"=="Greater Faydark" /varset BindZone GFAY
|    /if "$zone(bound)"=="East Freeport" /varset BindZone EFP

    /varset BindZone EFP

    /call Debug In $zone(bound) $BindZone

/return


sub Zone
    /varset DirMod 0
    /varset AvoidMod 0
    /varset ZoneDest $p0
    /call Debug Zone
    /if n $CurrentZone==GFAY {
        /call Debug I'm in Greater Faydark
        /if n $ZoneDest==BBM {
            /call Debug I'm running to Butcher Block Mountains
            /call Debug Location 1
            :GFAY_BBM_Loc1
               /call runtoloc 2400 -1539
            /if n $AtTarget==0 /goto :GFAY_BBM_Loc1
            /call Debug Location 2
            :GFAY_BBM_Loc2
               /call runtoloc 2635 -1565
            /if n $AtTarget==0 /goto :GFAY_BBM_Loc2
            /call Debug Location 3
            :GFAY_BBM_Loc3
               /call runtoloc 2637 -1636
            /if n $AtTarget==0 /goto :GFAY_BBM_Loc3
            /call Debug Location 4
            :GFAY_BBM_Loc4
               /call runtoloc 2670 -1640
            /if n $AtTarget==0 /goto :GFAY_BBM_Loc4
            /call autorun 1
            :GFAY_BBM_Wait
                /call Debug Waiting to Zone
            /if "$zone"!="Butcherblock Mountains" /goto :GFAY_BBM_Wait
            /call autorun 1
            /delay 5
            /call Debug Location 5
            :GFAY_BBM_Loc5
               /call runtoloc -3052 -1282 No
            /if n $AtTarget==0 /goto :GFAY_BBM_Loc5
            /call Debug Location 6
            :GFAY_BBM_Loc6
               /call runtoloc -3097 -1214
            /if n $AtTarget==0 /goto :GFAY_BBM_Loc6
            /call Debug Location 7
            :GFAY_BBM_Loc7
               /call runtoloc -3064 -1138
            /if n $AtTarget==0 /goto :GFAY_BBM_Loc7
            /call Debug Location 8
            :GFAY_BBM_Loc8
               /call runtoloc -2966 -1096
            /if n $AtTarget==0 /goto :GFAY_BBM_Loc8
        } else {
            /call Debug I don't know $ZoneDest
        }
    } else /if n $CurrentZone==BBM {
        /call Debug I'm in Butcher Block Mountains
        /if n $ZoneDest==GFAY {
            /call Debug I'm running to Greater Faydark
            /call Debug Location 1
            :BBM_GFAY_Loc1
               /call runtoloc -2966 -1096
            /if n $AtTarget==0 /goto :BBM_GFAY_Loc1
            /call Debug Location 2
            :BBM_GFAY_Loc2
               /call runtoloc -3064 -1138
            /if n $AtTarget==0 /goto :BBM_GFAY_Loc2
            /call Debug Location 3
            :BBM_GFAY_Loc3
               /call runtoloc -3097 -1214
            /if n $AtTarget==0 /goto :BBM_GFAY_Loc3
            /call Debug Location 4
            :BBM_GFAY_Loc4
               /call runtoloc -3052 -1282
            /if n $AtTarget==0 /goto :BBM_GFAY_Loc4
            /call Debug Location 5
            :BBM_GFAY_Loc5
               /call runtoloc -3086 -1310
            /if n $AtTarget==0 /goto :BBM_GFAY_Loc5
            /call autorun 1
            :BBM_GFAY_Wait
                /call Debug Waiting to Zone
            /if "$zone"!="Greater Faydark" /goto :BBM_GFAY_Wait
            /call autorun 1
            /delay 5
            /call Debug Location 6
            :BBM_GFAY_Loc6
               /call runtoloc 2670 -1640
            /if n $AtTarget==0 /goto :BBM_GFAY_Loc6
            /call Debug Location 7
            :BBM_GFAY_Loc7
               /call runtoloc 2637 -1636
            /if n $AtTarget==0 /goto :BBM_GFAY_Loc7
            /call Debug Location 8
            :BBM_GFAY_Loc8
               /call runtoloc 2635 -1565
            /if n $AtTarget==0 /goto :BBM_GFAY_Loc8
            /call Debug Location 9
            :BBM_GFAY_Loc9
               /call runtoloc 2400 -1539
            /if n $AtTarget==0 /goto :BBM_GFAY_Loc9
        } else {
            /call Debug I don't know $ZoneDest
        }
    } else /if n $CurrentZone==EFP {
        /call Debug I'm in East Freeport
        /if n $ZoneDest==NRO {
            /call Debug I'm running to Norhtern Ro
            /call Debug Location 1
            /delay 5
            :EFP_NRO_Loc1
               /call runtoloc -610 -113 No
            /if n $AtTarget==0 /goto :EFP_NRO_Loc1
            /call Debug Location 2
            :EFP_NRO_Loc2
               /call runtoloc -686 -114
            /if n $AtTarget==0 /goto :EFP_NRO_Loc2
            /call Debug Location 3
            :EFP_NRO_Loc3
               /call runtoloc -670 -424
            /if n $AtTarget==0 /goto :EFP_NRO_Loc3
            /call Debug Location 4
            :EFP_NRO_Loc4
               /call runtoloc -365 -1296
            /if n $AtTarget==0 /goto :EFP_NRO_Loc4
            /call autorun 1
            :EFP_NRO_Wait
                /call Debug Waiting to Zone
            /if "$zone"!="North Ro" /goto :EFP_NRO_Wait
            /call autorun 1 No
            /delay 5
        } else {
            /call Debug I don't know $ZoneDest
        }
    } else /if n $CurrentZone==NRO {
        /call Debug I'm in Northern Freeport
        /if n $ZoneDest==EFP {
            /call Debug I'm running to Norhtern Ro
            /call Debug Location 1
            /delay 5
            :NRO_EFP_Loc1
               /call runtoloc 286 2640 No
            /if n $AtTarget==0 /goto :NRO_EFP_Loc1
            /call Debug Location 2
            :NRO_EFP_Loc2
               /call runtoloc 678 4154
            /if n $AtTarget==0 /goto :NRO_EFP_Loc2
            /call autorun 1
            :NRO_EFP_Wait
                /call Debug Waiting to Zone
            /if "$zone"!="East Freeport" /goto :NRO_EFP_Wait
            /call autorun 1 No
            /delay 5
        } else {
            /call Debug I don't know $ZoneDest
        }
    }
    /call SetZone
    /call SetAlerts
    /call SetHomePoint
/return

Code: Select all

|HunterCommon.mac
|
| Common routines used by the Hunter Script


Sub CleanUpWins
   /press esc
   /press esc
   /press esc
   /press esc
   /press alt
   /press shift
   /press ctrl
/return

Sub InitVars
    |Initializing variables to default values
    /varset Action READY
    /varset DirMod 0
    /varset BackHome 0
    /varset TargetRadius 1
    /varset LastLevel $char(level)
    /varset MobsKilled 0
    /varset TotalDeaths 0
    /varset TotalRetreats 0
    /varset TotalMobLevel 0
    /varset TotalExpGain 0
    /varset LastExp $char(exp)
/return

sub WorkSkills
         |Work on sense heading skill
         /if $char(ability,"Sense Heading")>0 /doability "Sense Heading"


         |Work on forage skill
         /if "$char(state)"=="STAND" {
             /if $char(ability,"Forage")>0 /doability "Forage"
         }

         | Am I holding something?
         /if $cursor()==TRUE {
             /call DropItem
             /delay 5
             /press i
         }

         |Work on hide skill
         /if $char(ability,"Hide")>0 /doability "Hide"

         |Work on mend skill
         /if $char(ability,"Mend")>0 /doability "Mend"



/return

sub Debug
    /if DEBUG==1 {
        /echo $p0 $p1 $p2 $p3 $p4
    }
/return

sub DropItem
|Put whatever I'm holding in my inventory, comment out things you want to keep
        /if "$cursor()"=="NULL" /return
        /if $invpanel==FALSE /press i
        /delay 5
        /if "$cursor(nodrop)"=="TRUE" /click left destroy
|        /if "$cursor(norent)"=="TRUE" /click left destroy
|        /if "$cursor(lore)"=="TRUE" /click left destroy
        /if "$cursor()"=="NULL" /return
        /if $invpanel==TRUE /click left auto
/return

sub LevelCheck
    /mqlog You were level $LastLevel
    /mqlog You are now level $char(level)
    /if n $LastLevel<$char(level) {
        /mqlog Congratulations, it took $calc($LevelTime-$running) seconds
        /varset LevelTime $running
    } else {
        /mqlog Sorry, you lost a level.
    }
    /varset LastLevel $char(level)

/return

sub StatusCheck
       /call Debug StatusCheck
       /if n $char(level)!=$LastLevel /call LevelCheck
       /if n $char(hp,pct)<50 {
           /varset NotHealthy 1
           /call Debug StatusCheck-LowHealth
       } else {
           /varset NotHealthy 0
           /call Debug StatusCheck-Healthy
           /if $target(id)==0 {
               /target $char(name)
           }
           /if $target(id)!=0 {
               /varset Action CORPSERUN
               /call Debug StatusCheck-CorpseRun
           }
       }
/return

Code: Select all

|HunterMove.mac
|

sub runtoloc
     /varset AtTarget 0
     /varset TargetX $p0
     /varset TargetY $p1

     | Make sure we are standing
     /if "$char(state)"!="STAND" {
         /sit off
     }

     | If we are at the target, return that we made it.
     /if n $distance($TargetY,$TargetX)<15 {
        /call autorun 0
        /varset AtTarget 1
     } else {
         | Are we SoWed?
         /call RunSpell

         | Turn towards target
         /face heading $calc($heading($TargetY,$TargetX)+$DirMod+$AvoidMod)
         /call Debug Heading $calc($heading($TargetY,$TargetX)+$DirMod+$AvoidMod) Target Heading $heading($TargetY,$TargetX)
         /call Debug Modifier $DirMod

         | If we are not within range then make sure we are on autorun
         /if n $distance($TargetY,$TargetX)>15 /call autorun 1

         | This event returns the direction modifier slowly back to 0, used for collision avoidance
         /if n $abs($DirMod)<5 /varset DirMod 0
         /if n $DirMod>0 /varsub DirMod 1
         /if n $DirMod<0 /varadd DirMod 1
         /if n $AvoidMod>0 /if n $AvoidTimer==0 /varset AvoidMod 0

         /if "$p2"!="No" {
             | Check location, if we are on same spot call the obstacle routine to try and get around it
             /if n $MyXLoc==$char(x) /if $MyYLoc==$char(y) /call Obstacle2 5
         } else {
             /if n $MyXLoc==$char(x) /if $MyYLoc==$char(y) /sendkey down up
         }

         /if n $char(z)>$MaxAltitude /call Obstacle2 20

         | Save our current x,y loc
         /varset MyXLoc $char(x)
         /varset MyYLoc $char(y)

         | Check for any obstacles we are supposed to avoid
         /call checkobstacles
     }
/return 1

|The following routines are used by other movement subroutines when moving in Everquest.

Sub AutoRun
   /if $p0==1 /sendkey down up
   /if $p0==0 /sendkey up up
/return

sub Obstacle2
     | We appear to be stuck so try and run the other way for a while
     /call Debug Stuck - Ouch!
     /sendkey up up
     /sendkey down down
     /delay $p0
     /if n $rand(99)>50 /if $DirMod==0 {
         /varset DirMod 80
     } else {
         /varset DirMod -80
     }
     /sendkey up down
     /sendkey down up
/return

sub Obstacle
   | We appear to be stuck so try and backup and strafe sideways, doesn't work very well...
   | I'm not using it, but you can turn it on by changing the name to Obstacle2 and renaming
   | Obstacle2 to something else.
   /call Debug Obstacle-Ouch!
   /sendkey up up
   /sendkey down down
   /delay 2
   /doevents
   /sendkey up down
   /sendkey down ctrl
   /if n $rand(99)>50 {
      /sendkey down right
   } else {
      /sendkey down left
   }
   /delay 5
   /doevents
   /sendkey up right
   /sendkey up left
   /sendkey up ctrl
   /sendkey down up
/return

sub AvoidLoc
| Pass in 3 numbers first two are the Y and X locs of the point to avoid third one is the distance you want to keep from it.
| This sub will check if you are within the distance specified and turn you away from the loc and run you until you are the correct
| distance away. Too many calls to this sub will slow your main loop down badly so keep the areas large and infrequent for best results.
| i.e. if there are a few huts together set a loc and radius that will cover the whole area rather than each individual hut.

    /if n $distance($p0,$p1)<$p2 {
        /if $AvoidTimer==0 {
           /varset AvoidMod -95
           /varset AvoidTimer 5
        } else {
           /varset AvoidMod 95
           /varset AvoidTimer 5
        }
    }
/return

Code: Select all

|HunterRest.mac
|

sub resting
   | If we didnt make it home we dont want to rest
   /if $BackHome==1 {
       /call HealMe
       /call WorkSkills
       | Make sure we are sat down.
       /if "$char(state)"=="STAND" {
          /sit on
       }
       /varset Rested 0
       /if n $char(hp,pct)>99 {
           /varset Rested 1
       }
   } else {
       /varset Action RUNNING_HOME
   }
/return

Code: Select all

|HunterSpells.mac
|
|Subroutines needed by the hunter script for casting players

Sub MemorizeSpells

    /if "$char(class)"=="Bard" {
        /if n $char(buff,"Hymn of Restoration")==0 {
            /if n $char(gem,"Hymn of Restoration")==0 /if $char(book,"Hymn of Restoration")!=0 {
                /book
                /echo Memorizing "Hymn of Restoration"
                /call ForgetSpellByNumber 1
                /delay 10
                /call MemorizeSpell "Hymn of Restoration" 1
                /delay 25
                /book
            }
        }
        /if n $char(buff,"Jonthan's Whistling Warsong")==0 {
            /if n $char(gem,"Jonthan's Whistling Warsong")==0 {
                /book
                /echo Memorizing "Jonthan's Whistling Warsong"
                /call ForgetSpellByNumber 3
                /delay 10
                /call MemorizeSpell "Jonthan's Whistling Warsong" 3
                /delay 25
                /book
            }
        }
        /if n $char(buff,"Anthem de Arms")==0 {
            /if n $char(gem,"Anthem de Arms")==0 {
                /book
                /echo Memorizing "Anthem de Arms"
                /call ForgetSpellByNumber 4
                /delay 10
                /call MemorizeSpell "Anthem de Arms" 4
                /delay 25
                /book
            }
        }
        /if n $char(buff,"Chords of Dissonance")==0 {
            /if n $char(gem,"Chords of Dissonance")==0 {
                /book
                /echo Memorizing "Chords of Dissonance"
                /call ForgetSpellByNumber 5
                /delay 10
                /call MemorizeSpell "Chords of Dissonance" 5
                /delay 25
                /book
            }
        }
        /if n $char(buff,"Selo`s Accelerando")==0 {
            /if n $char(gem,"Selo`s Accelerando")==0 {
                /book
                /echo Memorizing "Selo`s Accelerando"
                /call ForgetSpellByNumber 2
                /delay 10
                /call MemorizeSpell "Selo`s Accelerando" 2
                /delay 25
                /book
            }
        }
    }


/return


|I couldn't get this to work, mostly because the variables didn't dereference right.
|I wanted to change the spells according to the level.  If someone can figure this out,
|it would make this script better.
|Sub MemBuffSpells
|    /if HEAL_SPELL=="" {
|        /call MemorizeSpell BUFF_SPELL1 1
|    } else {
|        /call MemorizeSpell HEAL_SPELL 1
|    }
|    /delay 10
|    /call MemorizeSpell BUFF_SPELL2 2
|    /delay 10
|    /call MemorizeSpell BUFF_SPELL3 3
|    /delay 10
|    /call MemorizeSpell BUFF_SPELL4 4
|    /delay 10
|    /call MemorizeSpell BUFF_SPELL5 5
|    /delay 10
|    /call MemorizeSpell BUFF_SPELL6 6
|    /delay 10
|/return

|Sub MemFightSpells
|    /call MemorizeSpell FIGHT_SPELL1 1
|    /delay 10
|    /call MemorizeSpell FIGHT_SPELL2 2
|    /delay 10
|    /call MemorizeSpell FIGHT_SPELL3 3
|    /delay 10
|    /call MemorizeSpell FIGHT_SPELL4 4
|    /delay 10
|    /call MemorizeSpell FIGHT_SPELL5 5
|    /delay 10
|    /call MemorizeSpell FIGHT_SPELL6 6
|    /delay 10
|/return

|Sub SetSpells
| Setup Spell List
|    /echo Setting up Level $char(level) $char(class) spells
|    /if "$char(class)"=="Bard" {
|        /echo Setting Fight Spells
|        /varset FIGHT_SPELL1 "Jonathan`s Whistling Warsong"
|        /echo Setting Heal Spells
|        /if n $char(level)<34 {
|            /varset HEAL_SPELL "Hymn of Restoration"
|        } else /if n $char(level)<55 {
|            /varset HEAL_SPELL "Cantana of Soothing"
|        }
|    }
|    /echo Spells Setup
|/return

Sub HealMe
    /if "$char(class)"=="Bard" {
        /if n $char(buff,"Hymn of Restoration")==0 {
            /call Debug Bard Heal Gone
            /if n $char(gem,"Hymn of Restoration")==-2 {
                /call Debug Can't Cast checking time
                /if $CastTimer==0 {
                    /call Debug Time expired stopsong
                    /stopsong
                }
            } else /if $CastTimer==0 {
                /sit off
                /varset CastTimer 35
                /call Debug Casting song
                /cast $char(gem,"Hymn of Restoration")
            }
        }
    } else /if "$char(class)"=="Ranger" {
       /if $char(mana,pct)>5 {
            /target myself
            /if n $char(gem,HEAL_SPELL)==-2 {
                /echo Casting...
            } else {
                /sit off
                /cast $char(buff,HEAL_SPELL)
            }
       }
    }
/return


Sub RunSpell
    | Twist while running...
    /if "$char(class)"=="Bard" {
        /if n $char(buff,"Selo`s Accelerando")==0 {
            /if n $char(gem,"Selo`s Accelerando")==-2 {
                /if $CastTimer==0 {
                    /stopsong
                }
            } else /if $CastTimer==0 {
                /sit off
                   /varset CastTimer 35
                   /cast $char(gem,"Selo`s Accelerando")
            }
        }
    /call HealMe
    }
/return

Sub FightSpell
    | We'll do some twisting on fight spells
    /if "$char(class)"=="Bard" {
        /if n $char(buff,"Jonthan's Whistling Warsong")==0 {
            /call Debug Casting Fight Spell
            /if n $char(gem,"Jonthan's Whistling Warsong")==-2 {
                /if $CastTimer==0 {
                    /call Debug Stopping other song
                    /stopsong
                }
            } else /if $CastTimer==0 {
                    /sit off
                    /varset CastTimer 40
                    /call Debug Casting fight song
                    /cast $char(gem,"Jonthan's Whistling Warsong")
            }
        }
        /if n $char(buff,"Anthem de Arms")==0 {
            /call Debug Casting Fight Spell
            /if n $char(gem,"Anthem de Arms")==-2 {
                /if $CastTimer==0 {
                    /call Debug Stopping other song
                    /stopsong
                }
            } else /if $CastTimer==0 {
                    /sit off
                    /varset CastTimer 40
                    /call Debug Casting fight song
                    /cast $char(gem,"Anthem de Arms")
            }
        }
        /if n $char(buff,"Chords of Dissonance")==0 {
            /call Debug Casting Fight Spell
            /if n $char(gem,"Chords of Dissonance")==-2 {
                /if $CastTimer==0 {
                    /call Debug Stopping other song
                    /stopsong
                }
            } else /if $CastTimer==0 {
                    /sit off
                    /varset CastTimer 40
                    /call Debug Casting fight song
                    /cast $char(gem,"Chords of Dissonance")
            }
        }
        /call HealMe
    }
/return

Code: Select all

|HunterFight.mac
|


| Acquire Target subroutine
sub GetTarget
      /varset HaveTarget 0
      | Target any mobs that might be attacking me
      /if n $target(id)==0 {
          /target npc notnearalert 4 nopcnear $KSRadius radius 20 range 0 $calc($char(level))
          /if n $target(id)==0 {
              /if n $AttackedMe==1 {
                 /call Debug Targeted "$Attacker" who jumped me
                 /target "$Attacker"
                 /varset AttackedMe 0
              } else /if "$alert(1)"=="TRUE" {
                 /call Debug GetTarget Alert1
                 /target npc alert 1 notnearalert 4 nopcnear $KSRadius
              } else /if "$alert(2)"=="TRUE" {
                 /call Debug GetTarget Alert2
                 /target npc alert 2 notnearalert 4 nopcnear $KSRadius
              } else {
                 /call Debug GetTarget General
                 /call Debug Searching Radius $TargetRadius
                 /if n $calc($char(level))<5 {
                     /call Debug Using newbe target
                     /target npc notnearalert 4 nopcnear $KSRadius radius $TargetRadius range 0 $calc($char(level)+1)
                 } else {
                     /target npc notnearalert 4 nopcnear $KSRadius radius $TargetRadius range $calc($char(level)-4) $calc($char(level)-1)
                 }
                 /call Debug Searching Radius $TargetRadius
              }
          }
      }
      /varset MyTarget $target(id)
      /if n $MyTarget!=0 {
          /call Debug Targeted $target(name) range $target(distance)
          /varset TargetDead 0
          /varset HaveTarget 1
          /varset TargetRadius 1
      } else {
          /varadd TargetRadius 200
          /if "$p0"=="NULL" {
              /if n $TargetRadius>8000 /varset TargetRadius 200
          } else {
              /if n $TargetRadius>$p0 /varset TargetRadius 200
          }
      }

/return


| Melee with mob subroutine
sub melee
      /attack on

      | Make sure were staring the critter out
      /face nopredict

      /if $char(ability,"Round Kick")>0 /doability "Round Kick"
      /if $char(ability,"Bash")>0 /doability "Bash"
      /if $char(ability,"Kick")>0 /doability "Kick"
      /if $char(ability,"Mend")>0 /doability "Mend"
      /if $char(ability,"Slam")>0 /doability "Slam"
      /if $char(ability,"Taunt")>0 /doability "Taunt"

      | Check if target is dead or we have lost it
      /if n $target(id)==0 /varset TargetDead 1

      /if n $distance($TargetY,$TargetX)>8 {
          /sendkey up down
          /sendkey down up
          /delay 1
          /sendkey up up
      }
      /if n $distance($TargetY,$TargetX)<6 {
          /sendkey up up
          /sendkey down down
          /delay 1
          /sendkey up down
      }

      | If target is still alive keep at it
      /if n $TargetDead==1 {
          | Target is dead so stop attacking
          /attack off
          /varset AttackedMe 0
          /target id $MyTarget

      }

/return

Code: Select all

|HunterLoot.mac
|

| Loot mob
sub Loot 
   /call Debug Loot
   |Begin Looting
   /if n $target(id)!=0 {
       /if "$char(state)"!="BIND" {
           /call Debug Loot-NotBIND
           /loot
           /delay 10
           /varset LootSlot 0
           /varset TargetLooted 0
       }

       | Cycle through each loot slot
       /if "$p0"!="No" {
           /click left corpse $LootSlot
           /delay 5
           /if "$cursor()"=="TRUE" {
               /call Debug Loot-Found
               /call Debug $cursor(name)
               /call DropItem
               /varadd LootSlot 1
               /varset TargetLooted 0
           } else {
               /call Debug Loot-LootingComplete
               /press esc
               /delay 2
               /varset TargetLooted 1
               /call Debug VarTargetL $TargetLooted
           }
       } else {
               /call Debug NoLoot-LootingComplete
               /press esc
               /delay 2
               /varset TargetLooted 1
               /call Debug VarTargetL $TargetLooted
       }
   } else {
      /call Debug Loot-TargetLost
      /varset TargetLooted 1
      /echo $TargetLooted
   }
/return

Code: Select all

||HunterEvents.mac
|
|

#event CannotSee "You cannot see your target"
#event TooFar "Your target is too far away"
#event Slain "You have been slain"
#event YouHaveSlain "You have slain"
#event YouDied "You died"
#event ChangeZone "You have entered"
#event HitsYou "YOU for"
#chat tell


sub Event_TooFar
    /call Debug Too far from target
    /face nopredict
    /delay 2
    /call autorun 1
/return

sub Event_CannotSee
    /call Debug Cannot see target
    /face nopredict
    /sendkey down down
    /delay 4
    /sendkey up down
    /delay 3
/return

sub Event_Slain
    /call Debug You have been slain!
    /mqlog $p0
    /varadd TotalDeaths 1
    :SLAIN_WAIT
        /call Debug Waiting to Zone
        /call setzone
    /if n $CurrentZone!=$BindZone /goto :SLAIN_WAIT
    /varset Action READY
/return

sub Event_YouHaveSlain
    /call Debug $p0
    /varadd MobsKilled 1
    /varadd TotalMobLevel $LastMobLevel
    /varadd TotalExpGain $calc($char(exp)-$LastExp)
    /mqlog |===============================
    /mqlog | $p0
    /mqlog | Level of MOB   : $LastMobLevel
    /mqlog | Time to kill   : $calc($running-$KillTime) seconds
    /mqlog | Kills so far   : $MobsKilled NPC's
    /mqlog | Kills per hour : $calc($MobsKilled*3600/$running) KPH
    /mqlog | Avg MOB level  : $calc($TotalMobLevel/$MobsKilled)
    /mqlog |--------------------------------
    /mqlog | Experience gain     : $calc($char(exp)-$LastExp)
    /mqlog | Current experience  : $char(exp)
    /mqlog | Average exp gain    : $calc($TotalExpGain/$MobsKilled)
    /mqlog | Experience per hour : $calc($calc($TotalExpGain/$MobsKilled)*3600/$running)
    /mqlog |--------------------------------
    /mqlog | Total retreats : $TotalRetreats
    /mqlog | Total deaths   : $TotalDeaths
    /mqlog |===============================
    /varset TargetDead 1
    /varset LastExp $char(exp)
/return

sub Event_YouDied
    /call Debug You Died!
    /mqlog $p0
    /varadd TotalDeaths 1
    :YOU_DIED_WAIT
        /call Debug Waiting to Zone
        /call setzone
    /if n $CurrentZone!=$BindZone /goto :YOU_DIED_WAIT
    /varset Action READY
/return

sub Event_ChangeZone
    /echo Zone Changed to $right(17,$p0)
    /mqlog $p0
/return

sub Event_HitsYou
    /if n $Action==RESTING {
        /varset Action AQUIRE
    }
/return

sub Event_Chat
|$p0 - Channel of message (ooc etc., chat channels will callback with the name of the channel)
|                                                (ie. /join port ... callback will have $p0==port)
|$p1 - Name of the person who sent the message
|$p2 - Text they sent
     /mqlog >>>>> $p1 $p0 - $p2 <<<<<

/return

Code: Select all

| - routines.mac - 
| Generic routines that may be used a lot. 
| ---------------------------- 
| Original Version by: Plazmic 
| Improved by: L124RD 


Sub BuyItems 

   /sendkey down shift 

   /for l1 1 to $p0 
      /click left merchant buy 
      /varset l2 $char(cash)
      :BuyItems_Wait
         /delay 0
      /if n $l2==$char(cash) /goto :BuyItems_Wait
   /next l1 

   /sendkey up shift 

/return 


| ---------------------------- 


Sub SellItem 
   /sendkey down shift 
   :SellItem 
      /finditem $p0 
      /if $find()==FALSE /goto :DoneSellItem 
      /click left merchant sell 
      /delay $rand(3) 
   /goto :SellItem 
   :DoneSellItem 
   /sendkey up shift 
/return 


| ---------------------------- 


Sub BackPedal 
   /if $p0==$v79 /return 
   /varset v79 $p0 
   /if $p0==1 /sendkey down up 
   /if $p0==0 /sendkey up up 
/return 


| ---------------------------- 


Sub AutoRun 
   /if $p0==$v80 /return 
   /varset v80 $p0 
   /if $p0==1 /sendkey down up 
   /if $p0==0 /sendkey up up 
/return 


| ---------------------------- 


Sub GotoLoc 
   /varset v91 $rand(5) 
   :GotoLocLoop 
      /face loc $p0 
      /if "$p1"=="u" /Press u 
      /call AutoRun 1 
   /if n $distance($p0)>$v91 /goto :GotoLocLoop 
   /call AutoRun 0 
/return 


| ---------------------------- 


Sub GotoTarg 
    /varset v91 $rand(5) 
   /target $p0 
   :GotoTargLoop 
      /face 
      /if "$p1"=="u" /Press u 
      /call AutoRun 1 
   /if n $target(distance)>$v91 /goto :GotoTargLoop 
   /call AutoRun 0 
/return 

| ---------------------------- 

Sub BuyItems 
   /press down shift 
   /for p1 1 to $p0 
      /varcalc p2 $char(plat)*1000+$char(gold)*100+$char(silver)*10+$char(copper) 
      /click left merchant buy 
      :BuyItemsLoop 
         /delay 0 
      /if n $calc($char(plat)*1000+$char(gold)*100+$char(silver)*10+$char(copper))==$p2 /goto :BuyItemsLoop 
   /next p1 
   /press up shift 
/return 

| ---------------------------- 

Sub SellItem 
   /sendkey down shift 
   :SellItem 
      /finditem $p0 
      /if $find()==FALSE /goto :DoneSellItem 
      /varcalc p2 $char(plat)*1000+$char(gold)*100+$char(silver)*10+$char(copper) 
      /click left merchant sell 
      :SellItemLoop 
         /delay 0 
      /if n $calc($char(plat)*1000+$char(gold)*100+$char(silver)*10+$char(copper))==$p2 /goto :SellItemLoop      
   /goto :SellItem 
   :DoneSellItem 
   /sendkey up shift 
/return 

| ---------------------------- 

Sub FindCombiner 
   /for p1 7 downto 0 
      /if "$pack($p1,combine)"=="$p0" /return $p1 
   /next p1 
   /echo You do not appear to have a valid $p0 container. 
/return 99 

| End of routines.mac
Last edited by Fyrestorm on Tue Dec 31, 2002 12:09 am, edited 3 times in total.

User avatar
SingleServing
a hill giant
a hill giant
Posts: 195
Joined: Tue Dec 17, 2002 11:00 pm

Ok...

Post by SingleServing » Fri Dec 27, 2002 9:24 pm

This is interesting and I have some suggestions however, tell me what you used these on a bard and war of what level and equipment type? I would like to try it out before saying too much =)
[color=DarkBlue]Everything,[/color] [color=DarkBlue][b]is[/b][/color] [color=black]black[/color] [color=DarkBlue]and[/color] [color=white]white[/color][color=DarkBlue], when you zoom out it looks[/color] [color=gray]grey[/color][color=DarkBlue].[/color]

Fyrestorm
decaying skeleton
decaying skeleton
Posts: 5
Joined: Fri Nov 01, 2002 7:31 pm

Post by Fyrestorm » Fri Dec 27, 2002 10:16 pm

I started brand new characters, war and bard. I used the standard equip that bards and warriors get as newbe's up to level 10 (which took about 8 hours), then I upgraded the armor and weapons, spending about 200 plat on armor and using an old weapon. I don't really want to say what level they are today, could give me away, but they are higher than 10 and have been fighting and occasionally dying, but still have their armor and weapons. I think I've probably given too many clues. I was mostly testing out the corpse runs and didn't want to risk anything expensive until I had it worked out nearly flawlessly. I still want to make it cast an invis or camo, if avail, and pull corpse to the safe zone before looting. When I was watching, once the bard died in a place that he couldn't loot the corpse without getting agroed, this made him die over and over, so after this weekend I'm going to fix that by making him drag the corpse back. Should be an easy addition. Until then, I limited the camp distance and setup an area to avoid. Another feature I want to add is selling everything to merchants when the str goes down and banking his money. These too, should be easy to add. It does quite a bit, twisting songs, camping, looting, corpse runs, healing, zone in emergency, forage, do skills, avoid things, and more.

Enjoy!

Ariain
a ghoul
a ghoul
Posts: 88
Joined: Fri Oct 11, 2002 10:35 am

..

Post by Ariain » Sun Dec 29, 2002 3:38 am

As long as you dont give your server and char names they arent gonna waste there time tracking you down. =)

User avatar
Fippy
a snow griffon
a snow griffon
Posts: 499
Joined: Tue Jul 16, 2002 10:42 am

Post by Fippy » Sun Dec 29, 2002 10:34 am

Some nice ideas there Fyrestorm. When I first wrote hunter.mac it was pretty much my first script that wasnt just for tradeskills. The setting of a state (or action in your script) was something I thought about doing but never got around to it.

Gonna give this a try with a new toon.
Fippy

This is my girl. But Rizwank had her first :-)
[img]http://www.btinternet.com/~artanor/images/fairy_bounce09.gif[/img]

Mutter
a ghoul
a ghoul
Posts: 105
Joined: Sat Nov 16, 2002 1:09 pm

Opinion

Post by Mutter » Sun Dec 29, 2002 4:55 pm

Very nice!!

I made a small change to hunter mac that makes two HUGE differences, that you might want to try. OH! And set KS radius to at LEAST 200, otherwisewise ya piss off casters. First MAJOR change that ya need is a level check!! Second is a FEARLIST. I will put in code for ya that I use.

sub makefearlist
| Setup Alerts for Scary mobs here
/alert clear 4
/varset v1 0
| Loop to find first valid spawn
:ValidLoop
/varset v2 $spawn($v1,next)
/if n $v2==0 {
/varadd v1 1
/goto :ValidLoop
} else {
/varset v1 $v2
}

| Save off the first valid spawn found
/varset v3 $v1

:WalkSpawns
| Loop through all spawns to find a mach
/mqlog $v1

/if n $int($spawn($v1,level))>$int($endlevel) {
/if n $v1!=$char(id) {
/if "$spawn($v1,type)"=="NPC" {
/mqlog id $v1 $spawn($v1,name) is too high for us, avoiding $spawn($v1,level)
/alert add 4 npc radius 500 $spawn($v1,name[clean])
}

}
}
/varset v1 $spawn($v1,next)
/doevents
/if "$spawn($v1,name[clean])"~~"NULL" /goto :donewalkin
/if n $v1!=$v3 /goto :WalkSpawns
:donewalkin
/mqlog finished checking all spawns
/return

sub getstart
/if n $p0==0 /varset startlevel $int($calc($int($char(level))-4))
/if n $p0!=0 /varset startlevel $int($p0)
/varset endlevel $int($calc($int($char(level))-1))
/return

sub GetTarget
:Acquire
/doevents
/if AttackedMe==1 {
/mqlog Targeted "$v13" who jumped me
/target "$v13"
/varset AttackedMe 0
} else /if "$alert(1)"=="TRUE" {
/target npc alert 1 notnearalert 4 nopcnear $KSRadius
/mqlog Targeted $target(name) range $target(distance) on alert list 1
} else /if "$alert(2)"=="TRUE" {
/target npc alert 2 notnearalert 4 nopcnear $KSRadius
/mqlog Targeted $target(name) range $target(distance) on alert list 2
} else /if "$alert(3)"=="TRUE" {
/target npc alert 3 notnearalert 4 nopcnear $KSRadius
/mqlog Targeted $target(name) range $target(distance) on alert list 2
} else {
/target npc radius $kRadius range $startlevel $endlevel notnearalert 4 nopcnear $KSRadius
/doevents
/delay 5
}
/varset MyTarget $target(id)
/varset TargetDead 0
/doevents
/delay 0
/if n $target(id)==0 /goto :Acquire
/face nopredict
/return

Fyrestorm
decaying skeleton
decaying skeleton
Posts: 5
Joined: Fri Nov 01, 2002 7:31 pm

Sugestion

Post by Fyrestorm » Tue Dec 31, 2002 12:15 am

Love the changes, I'll add it to the script the next time I post updated files. I was gone for the weekend and didn't get a chance to do much, I did fix some errors in the code. There were quite a few, not sure how it was working. Most of the files were changed, but I didn't keep track of which ones I changed, I'll try to do that next time.

I need some help figuring out zone coords, so if anyone creates a path from one zone to another, I'd love to add it to my script. That seems to take the most time. I just run from one zone to another doing /loc at all the corners until I have a completed path.

- Fyrestorm

drako
orc pawn
orc pawn
Posts: 17
Joined: Mon Dec 09, 2002 12:09 am

Post by drako » Tue Dec 31, 2002 2:13 am

this is great, so far it seems to work great. im trying it with my lvl 4 bst .. so going to see how it go's well i play ps2, =0 lol got to love it, will get back to you on lvl/time it takes... but great job bro and keep up the good work

drako
orc pawn
orc pawn
Posts: 17
Joined: Mon Dec 09, 2002 12:09 am

Post by drako » Tue Dec 31, 2002 2:28 am

something i wanted to add really fast, it does not advoid buildings really well, i know i tryed flippys (correct me if im wrong) and his did pretty damn well not geting stuck.... but just something to work on i guess


need to add one more thing... when you need to heal... you should have it finish the mob if mobs hp is so so low example puma.. i had it at one hit and he hit me past half so i ran.... but you try to change that around a bit, last when siting down to heal in nro, it sits stands sit stand sit stand and repeats..

geostone
a lesser mummy
a lesser mummy
Posts: 78
Joined: Thu Oct 31, 2002 6:16 pm

Post by geostone » Fri Jan 03, 2003 10:03 pm

i seem to be missing a huntermove.mac
at least thats the error i get when i try to use this macro. any help is kindly appreciated as im looking forward to trying this out.

thanks,
geo

drako
orc pawn
orc pawn
Posts: 17
Joined: Mon Dec 09, 2002 12:09 am

Post by drako » Sat Jan 04, 2003 1:01 am

Code: Select all

|HunterMove.mac 
| 

sub runtoloc 
     /varset AtTarget 0 
     /varset TargetX $p0 
     /varset TargetY $p1 

     | Make sure we are standing 
     /if "$char(state)"!="STAND" { 
         /sit off 
     } 

     | If we are at the target, return that we made it. 
     /if n $distance($TargetY,$TargetX)<15 { 
        /call autorun 0 
        /varset AtTarget 1 
     } else { 
         | Are we SoWed? 
         /call RunSpell 

         | Turn towards target 
         /face heading $calc($heading($TargetY,$TargetX)+$DirMod+$AvoidMod) 
         /call Debug Heading $calc($heading($TargetY,$TargetX)+$DirMod+$AvoidMod) Target Heading $heading($TargetY,$TargetX) 
         /call Debug Modifier $DirMod 

         | If we are not within range then make sure we are on autorun 
         /if n $distance($TargetY,$TargetX)>15 /call autorun 1 

         | This event returns the direction modifier slowly back to 0, used for collision avoidance 
         /if n $abs($DirMod)<5 /varset DirMod 0 
         /if n $DirMod>0 /varsub DirMod 1 
         /if n $DirMod<0 /varadd DirMod 1 
         /if n $AvoidMod>0 /if n $AvoidTimer==0 /varset AvoidMod 0 

         /if "$p2"!="No" { 
             | Check location, if we are on same spot call the obstacle routine to try and get around it 
             /if n $MyXLoc==$char(x) /if $MyYLoc==$char(y) /call Obstacle2 5 
         } else { 
             /if n $MyXLoc==$char(x) /if $MyYLoc==$char(y) /sendkey down up 
         } 

         /if n $char(z)>$MaxAltitude /call Obstacle2 20 

         | Save our current x,y loc 
         /varset MyXLoc $char(x) 
         /varset MyYLoc $char(y) 

         | Check for any obstacles we are supposed to avoid 
         /call checkobstacles 
     } 
/return 1 

|The following routines are used by other movement subroutines when moving in Everquest. 

Sub AutoRun 
   /if $p0==1 /sendkey down up 
   /if $p0==0 /sendkey up up 
/return 

sub Obstacle2 
     | We appear to be stuck so try and run the other way for a while 
     /call Debug Stuck - Ouch! 
     /sendkey up up 
     /sendkey down down 
     /delay $p0 
     /if n $rand(99)>50 /if $DirMod==0 { 
         /varset DirMod 80 
     } else { 
         /varset DirMod -80 
     } 
     /sendkey up down 
     /sendkey down up 
/return 

sub Obstacle 
   | We appear to be stuck so try and backup and strafe sideways, doesn't work very well... 
   | I'm not using it, but you can turn it on by changing the name to Obstacle2 and renaming 
   | Obstacle2 to something else. 
   /call Debug Obstacle-Ouch! 
   /sendkey up up 
   /sendkey down down 
   /delay 2 
   /doevents 
   /sendkey up down 
   /sendkey down ctrl 
   /if n $rand(99)>50 { 
      /sendkey down right 
   } else { 
      /sendkey down left 
   } 
   /delay 5 
   /doevents 
   /sendkey up right 
   /sendkey up left 
   /sendkey up ctrl 
   /sendkey down up 
/return 

sub AvoidLoc 
| Pass in 3 numbers first two are the Y and X locs of the point to avoid third one is the distance you want to keep from it. 
| This sub will check if you are within the distance specified and turn you away from the loc and run you until you are the correct 
| distance away. Too many calls to this sub will slow your main loop down badly so keep the areas large and infrequent for best results. 
| i.e. if there are a few huts together set a loc and radius that will cover the whole area rather than each individual hut. 

    /if n $distance($p0,$p1)<$p2 { 
        /if $AvoidTimer==0 { 
           /varset AvoidMod -95 
           /varset AvoidTimer 5 
        } else { 
           /varset AvoidMod 95 
           /varset AvoidTimer 5 
        } 
    } 
/return 
 


Code: 
|HunterRest.mac 
| 

sub resting 
   | If we didnt make it home we dont want to rest 
   /if $BackHome==1 { 
       /call HealMe 
       /call WorkSkills 
       | Make sure we are sat down. 
       /if "$char(state)"=="STAND" { 
          /sit on 
       } 
       /varset Rested 0 
       /if n $char(hp,pct)>99 { 
           /varset Rested 1 
       } 
   } else { 
       /varset Action RUNNING_HOME 
   } 
/return 
 


exactly as it says from above, just make sure the file name is huntermove.mac

geostone
a lesser mummy
a lesser mummy
Posts: 78
Joined: Thu Oct 31, 2002 6:16 pm

Post by geostone » Sat Jan 04, 2003 7:22 am

got it to run but all it did was scroll some adds to alert list and kept saying theres no tandien around. any helpful ideas?

thanks kindly,
geo

drako
orc pawn
orc pawn
Posts: 17
Joined: Mon Dec 09, 2002 12:09 am

Post by drako » Sat Jan 04, 2003 6:40 pm

Just make sure you got all the files, and named right. make sure your in one of the 3 zones its made for and just start it, worked perfect for me other then i kept stoping it every 4 mins cause i ended up at fp zone line killing greens...

Zorg
a lesser mummy
a lesser mummy
Posts: 44
Joined: Fri Oct 18, 2002 7:01 pm

Post by Zorg » Mon Jan 06, 2003 10:48 am

Hmm, for some reason > and < don't show up in the [code'd portions, just as their control characters. Is this me, or is it something with the board?

Anyway, very nice script, just one or two suggestions. The target acquisition could use some work, I've gotten a SK to level 9 so far, and he's spent a lot of time killing greens in north ro.

Malachi
a hill giant
a hill giant
Posts: 227
Joined: Tue Nov 19, 2002 1:29 am
Contact:

well.....hmm.

Post by Malachi » Sat Jan 18, 2003 5:11 pm

wheeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee!

Just on a lark I decided to try this out using the new ui, I didn't see any places right off that required a click w/ looting turned off, although I can't say that I really looked, hehe. Anyway...it crashed me to desktop. Aww.

~malachi
~Oh danny boy, the pipes the pipes are calling.~