ogrebash v1.3 [mq2data]

A forum for you to dump all the macros you create, allowing users to use, modify, and comment on your work.

Moderator: MacroQuest Developers

bollox
orc pawn
orc pawn
Posts: 17
Joined: Tue Oct 28, 2003 2:14 pm

ogrebash v1.3 [mq2data]

Post by bollox » Thu Apr 22, 2004 1:00 am

Ogre warrior autoattack script.

Features:
* sticks/faces mob and uses combat abilities automatically
* avoids enrage damage
* spellcaster auto-interrupt

Code: Select all

| OgreBash v1.3 [mq2data version] by Bollox (Apr 21 2004)
|-----------------------------------------------------------------------------
|
|  Ogre warrior stick to target, auto kick/slam/taunt/disarm.
|  Credits to GrimJack, Lasher et. al. for various sections of code.
|  Mad props to ml2517 for FindEvtNPC code! :)
|
|  Features:
|
|    * Focuses on target mob by either facing it or following it as it moves
|      around
|    * Interrupts enemy spellcasts
|    * Pauses attack while target is enraged
|
|  Usage: 
|
|    /macro ogrebash <focus> <aggro> <strategy>
|
|  Options:
|
|    <focus>
|    stick      Sticks to your target and follows it.  Will automatically
|               walk up to target if within @EngageRange.
|    face       Faces target.
|
|    <aggro>
|    taunt      Use Taunt ability as fast as refresh allows.
|    notaunt    Do not use Taunt ability.
|    duel       Allows macro to run while targeting a player.
|
|    <strategy>
|    fast       Use optimal combat abilities as fast as refresh allows.
|    learn      Use lowest skill combat abilities as fast as refresh allows.
|               (e.g. if kick skill < bash skill, kick instead of bash)
|               Uses disarm as fast as refresh allows.
|    interrupt  Waits for target to cast before using kick/bash/slam.
|               Uses disarm as fast as refresh allows.
|    passive    Do not use any combat abilities.
|
|  Examples:
|
|    Follow target, taunting and kicking/bashing as fast as abilities refresh
|      /macro autoattack stick taunt fast
|
|    Follow target, taunting and interrupting target's spellcasting
|      /macro autoattack stick taunt interrupt
|
|    Face target and attack only, no bash/kick/disarm
|      /macro autoattack face notaunt passive
|
|    Face player in a duel, no taunting (looks odd to non-MQ players) and use
|    all other abilities.  <duel> allows macro to run while targeting other
|    players -- the ability to attack players is otherwise disabled because
|    it's useless and cumbersome in any other situation.
|      /macro face duel fast
|
|  Version History:
|
|    1.3 (Apr 21 2004) Revised to comply with MQ2Data.
|    1.2 (Apr 8 2004) Removed class-based caster interruption because some 
|        high level mobs that are not typically casters will cast spells.
|    1.1 (Mar 4 2004) Original code
|
|  TO DO:
|    * implement attack distance adjustments based on desired aggro level
|      (i.e. farther from target = less aggro) and data from ${Target.MaxRange}
|    * implement attack from behind to avoid riposte damage
|    * address ${Me.AbilityReady[slam]} nonfunctionality
|
#turbo

#Event NoHit "You cannot hit your target from here!"
#Event OnRage "has become ENRAGED"
#Event OffRage "is no longer enraged"
#Event Casting "begins to cast a spell"
#Event InterruptCast "casting is interrupted!"

Sub Main(Focus,Aggro,Abilities)

  /zapvars
  /doevents flush

  /declare tempvar global
  /declare EngageRange global
  /declare Interrupt global
  /declare RangeMax global
  /declare RangeMin global
  /declare TargetCastTimer timer
  /declare FastRange global
  /declare CombatType global
  /declare EnrageVar global

  /varset CombatType @Aggro
  /varset EngageRange 40
  /varset EnrageVar 0

  /varset Interrupt 0
  /varset TargetCastTimer 0s

  /varset RangeMax 12 
  /varset RangeMin 10
  /varset FastRange 14

  | Make sure syntax is correct.
  /if (${String["@Focus"].NotEqual["stick"]}) {
    /if (${String["@Focus"].NotEqual["face"]}) {
      /call Usage @Focus
    }
  }
  /if (${String["@Aggro"].NotEqual["taunt"]}) {
    /if (${String["@Aggro"].NotEqual["notaunt"]}) {
      /if (${String["@Aggro"].NotEqual["duel"]}) {
        /call Usage @Aggro
      }
    }
  }
  /if (${String["@Abilities"].NotEqual["fast"]}) {
    /if (${String["@Abilities"].NotEqual["interrupt"]}) {
      /if (${String["@Abilities"].NotEqual["passive"]}) {
        /if (${String["@Abilities"].NotEqual["learn"]}) {
          /call Usage @Abilities
        }
      }
    }
  }

  | Make sure your target is valid.
  /if (${Target.ID}<1) {
    /echo No target.
    /endmacro
  } else /if (${Target.ID}==${Me.ID}) {
      /echo You can't attack yourself!
      /endmacro
  } else /if (${String["${Target.Type}"].Equal["PC"]}) {
    /if (${String["@Aggro"].NotEqual["duel"]}) {
      /echo You cannot attack other players.
      /endmacro
    }
  }

  | Set range based on desired aggro level.  (i.e. further==less)

  | Make sure you are standing.  Using /face while sitting is bad, m'kay?
  /if (${String["${Me.State}"].Equal["SIT"]}) /stand

  /attack on
  /face fast

  :CombatLoop

    /if (${String["@Focus"].Equal["stick"]}) {
      /if (${Target.Distance}<@EngageRange) {
        /call MoveToMob
        /face fast
      }
    } else {
      /face fast
    }

    | Manage taunt level.
    /if (${String["@Aggro"].Equal["taunt"]}) {
      /call TauntIt
    }

    /call DisarmIt

    | Combat ability usage.
    /if (@EnrageVar==0) {
      /if (${String["@Abilities"].Equal["fast"]}) {
        /if (${Me.Skill[kick]}<${Me.Skill[bash]}) {
          /call SlamIt
        } else {
          /call KickIt
        }
      } else /if (${String["@Abilities"].Equal["learn"]}) {
        /if (${Me.Skill[kick]}>${Me.Skill[bash]}) {
          /call SlamIt
        } else {
          /call KickIt
        }
      }
    }

    | Attempt to interrupt target spellcasts.
    /if (${String["@Abilities"].Equal["interrupt"]}) {
      /if (@Interrupt==0) {
        /doevents Casting
      } else /if (@Interrupt==1) {
        /if (@TargetCastTimer==0) {
          /echo You have failed to interrupt ${Target.CleanName}'s spellcast.
          /varset Interrupt 0
        } else /if (@TargetCastTimer>0) {
          /call SlamIt
          /doevents InterruptCast
        }
      }
    }

    | Avoid taking damage from enrage.
    /doevents OnRage
    /doevents OffRage

    | Attack until target dies or is released.  (e.g. pressing ESC to clear)
    /if (${Target.ID}>0) /goto :CombatLoop

  /attack off
  /keypress up
/endmacro

| =====================
| S U B R O U T I N E S
| =====================

Sub DisarmIt
  /if (${Me.AbilityReady[disarm]}) {
    /if (${Target.ID}>0) {
      /face fast
      /doability "Disarm"
    }
  }
/return

Sub Fastmove
  :fastmoveloop
  /if (${Target.ID}<1) {
    /keypress up
      /if (${Me.Combat}) {
        /attack off
        /return
    }
  }
  /face fast
  /if (${Target.Distance}>@FastRange) {
    /keypress up hold
  }
  /if (${Target.Distance}<=@FastRange) {
    /keypress up
    /return
  }
  /goto :fastmoveloop
/return 

Sub FindEvtNPC(MsgText,SrchRadius,EvtText)
  /declare MobName local
  /declare MobID local
  /declare LastID local
  /declare PositionText local

  /varset PositionText ${String[@MsgText].Find[@EvtText]}
  /varset MobName ${String[@MsgText].Mid[1,@PositionText]}

  /if (${String["@MobName"].Right[1].Equal[" "]}  ) {
    /varset MobName ${String[@MobName].Left[ ${Math.Calc[ ${String[@MobName].Length}-1 ]} ]}
  }
  /if (${String["@MobName"].Right[1].Equal["'"]}  ) {
    /varset MobName ${String[@MobName].Left[ ${Math.Calc[ ${String[@MobName].Length}-1 ]} ]}
  }

  /varset MobID 0
  /varset LastID 0

  /if (${Target.ID}) {
    /if (${String["@CombatType"].Equal["duel"]}) {
      /varset MobID ${NearestSpawn["@MobName" radius @SrchRadius].ID}
	 } else {
	   /varset MobID ${NearestSpawn["@MobName" npc radius @SrchRadius].ID}
	 }
	 :GetID
	 /if (@MobID!=0) {
	   /varset LastID @MobID
		/if (${Target.ID}==@MobID) {
		  /return FOUND
		} else {
		  /varset MobID ${NearestSpawn["@MobName" npc id @LastID radius @SrchRadius next].ID}
		  /if (@LastID==@MobID) /return NOTFOUND
		  /goto :GetID
		}
	 }
  }
/return NOTFOUND

Sub KickIt
  |
  | ${Me.AbilityReady} currently bugged!
  |/if ${Me.AbilityReady[kick]}==TRUE {
    /if (${Target.ID}>0) {
      /face fast
      /doability "Kick"
      /return 1
    }
  |}
/return 0

Sub MoveToMob
  /face fast
  /if (${Target.Distance}>=@FastRange) /call Fastmove
  /if (${Target.Distance}>@RangeMax) {
    /keypress up
  }
  /if (${Target.Distance}<@RangeMin) {
    /keypress down
  }
/return

Sub SlamIt
  |
  | ${Me.Ability[slam]} is currently bugged!
  |
  |/if ${Me.AbilityReady[bash]}==TRUE {
    /if (${Target.ID}>0) {
      /face fast
      /doability "Slam"
      /return 1
    }
  |}
/return 0

Sub TauntIt
  /if (${Me.AbilityReady[taunt]}) {
    /if (${Target.ID}>0) {
      /face fast
      /doability "Taunt"
      /return 1
    }
  }
/return 0

Sub Usage(Argument)
  /echo @Argument is not a valid option.
  /echo Usage:
  /echo  /macro autoattack <stick|face> <taunt|notaunt> <fast|interrupt|passive>
  /endmacro
/return

| ===========
| E V E N T S
| ===========

Sub Event_Casting(CastingText)
  /if (${Target.ID}) {
    /call FindEvtNPC "@CastingText" 200 "begins to cast a spell"
    /if (${String["${Macro.Return}"].Equal["FOUND"]}) {
      /varset TargetCastTimer 3s
      /varset Interrupt 1
    }
  }
/return

Sub Event_InterruptCast(InterruptCastText)
  /if (${Target.ID}) {
    /call FindEvtNPC "@InterruptCastText" 200 "'s casting is interrupted"
    /if (${String["${Macro.Return}"].Equal["FOUND"]}) {
      /echo You have interrupted ${Target.CleanName}'s spellcast!
      /varset Interrupt 0
      /varset TargetCastTimer 0s
    }
  }
/return

Sub Event_NoHit
  |/echo GET BACK INTO POSITION!
/return

Sub Event_OffRage(OffRageText)
/if (${Target.ID}) {
  /call FindEvtNPC "@OffRageText" 200 "is no longer enraged"
  /if (${String["${Macro.Return}"].Equal["FOUND"]}) {
    /varset EnrageVar 0
    /echo ${Target.CleanName} is no longer enraged, ATTACKING.
    /attack on
  }
}
/return

Sub Event_OnRage(OnRageText)
/if (${Target.ID}) {
  /call FindEvtNPC "@OnRageText" 200 "has become ENRAGED"
  /if (${String["${Macro.Return}"].Equal["FOUND"]}) {
    /varset EnrageVar 1
    /echo ${Target.CleanName} is ENRAGED!  Suspending attack. 
    /attack off
  }
}
/return
Last edited by bollox on Thu Apr 22, 2004 2:10 am, edited 2 times in total.

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Thu Apr 22, 2004 1:30 am

Suuuure I see how ya are, don't give me my props for the FindEvtNPC parts hehe.

bollox
orc pawn
orc pawn
Posts: 17
Joined: Tue Oct 28, 2003 2:14 pm

Post by bollox » Thu Apr 22, 2004 2:12 am

Rectified! <grin>

Wolffe
orc pawn
orc pawn
Posts: 11
Joined: Tue Apr 06, 2004 2:50 pm

Post by Wolffe » Thu Apr 22, 2004 3:08 am

Any way to keep this macro running so i dont have to type the command line everytime i fight?

bollox
orc pawn
orc pawn
Posts: 17
Joined: Tue Oct 28, 2003 2:14 pm

Post by bollox » Thu Apr 22, 2004 3:14 am

Make socials for them. Here's mine in <charname>_<server>.ini:

Code: Select all

[Socials]
Page1Button1Name=AASTF
Page1Button1Line1=/macro ogrebash stick taunt fast
Page1Button1Color=13
Page1Button2Name=AAFTF
Page1Button2Line1=/macro ogrebash face taunt fast
Page1Button2Color=13
Page1Button3Name=AASNF
Page1Button3Line1=/macro ogrebash stick notaunt fast
Page1Button3Color=13
Page1Button4Name=AAFNF
Page1Button4Line1=/macro ogrebash face notaunt fast
Page1Button4Color=13
Page1Button5Name=SATNK
Page1Button5Line1=/macro assist set offtank
Page1Button5Color=1
Page1Button6Name=SAPAC
Page1Button6Line1=/macro assist set pacpull
Page1Button6Color=1
Page1Button7Name=AASTI
Page1Button7Line1=/macro ogrebash stick taunt interrupt
Page1Button7Color=13
Page1Button8Name=AAFTI
Page1Button8Line1=/macro ogrebash face taunt interrupt
Page1Button8Color=13
Page1Button9Name=AASNI
Page1Button9Line1=/macro ogrebash stick notaunt interrupt
Page1Button9Color=13
Page1Button10Name=AAFNI
Page1Button10Line1=/macro ogrebash face notaunt interrupt
Page1Button10Color=13
Page1Button11Name=AASS
Page1Button11Line1=/macro assist aquire offtank raid
Page1Button11Color=17
Page1Button12Name=AGGRO
Page1Button12Line1=/g HELP ME BASH %T
Page1Button12Color=17
..then simply drag the ones you need into your hotkey bank.

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Thu Apr 22, 2004 7:22 am

LOL