Moderator: MacroQuest Developers







Code: Select all
| Heros Brew Macro
| HerosBrew.mac
| Author : robdawg
| Version : v1.0 2004-05-05
| Useage : /macro HerosBrew <Destroy, 0 or 1> <Reply, 0 or 1> <ReplyMessage, string> <Skip, 0 or 1> <SkillAlert, 0 or 1>
| Examples : /macro HerosBrew 1 0 "" 0 0
| Destroys all items from the combine.
| /macro HerosBrew 1 1 "DIE!" 0 0
| Destroys all items from the combine and replys to tells with "DIE!".
| /macro HerosBrew 0 1 "DIE!" 1 1
| Replys to tells with "DIE!", starts combining, and alerts when
| brewing skill is 200.
| Description : This script will run your character all over Shadow Haven buying
| components to make Heroes Brew. You can set this script to end
| once you reach 200, or this script will auto-end once you hit skill
| 248. I recommend having packs in all 8 slots. Furthermore, I
| recommend that you open all pack windows, inventory, and the
| experiement view for the tradeskill container to make sure NOTHING
| is over-lapping.
|
| When Destroy is set to 1, all items after the combine will be
| destroyed.
|
| When Reply is set to 1, an auto-response will be sent to the sender.
|
| ReplyMessage is required even if Reply is set to 0. Furthermore,
| the ReplyMessage must be enclosed in quotes. This message can be
| "" if Reply is set to 0.
|
| When Skip is set to 1, it will start do combines without buying
| the components first.
|
| When SkillAlert is set to 1, it will end the macro when your
| brewing skill reaches 200.
|
| REQUIRES : AdvPath.inc that was created by ml2517.
|
| NOTE : Be sure to be standing near Bilken Biddinight. He is
| located in the tent like building. (pos184, pos917)
|
| NOTE : Fast Item Destroy must be turned ON if you are going to
| destroy all items after the combine.
|
| NOTE : If you wish to do twice as many combines at one time, simply
| create twice as many BuyStack("") functions to buy twice as many
| components.
|
| Credits : Onezero for making the original HeroesBrew.mac
|-----------------------------------------------------------------------
#include advpath.inc
#event SkillTrivial "#*#You can no longer advance your skill from making this item#*#"
#event SkillUp "#*#You have become better at#*#"
#event SkillFailure "#*#You lacked the skills#*#"
#event SkillSuccess "#*#You have fashioned the items together to create something new#*#"
#event FullInventory "#*#There was no place to put that#*#"
#event InUse "#*#Someone else is using that. Try again later.#*#"
#chat tell
Sub Main
/declare Failure int outer 0
/declare Success int outer 0
/declare SkillUps int outer 0
/declare Destroy int outer
/declare Reply int outer
/declare ReplyMessage string outer
/declare Skip int outer
/declare SkillAlert int outer
/varset Destroy ${Param0}
/varset Reply ${Param1}
/varset ReplyMessage ${Param2}
/varset Skip ${Param3}
/varset SkillAlert ${Param4}
|------------------------------------------------
| AdvPath Initialization.
|------------------------------------------------
/call InitAPFVars 1 15 20
/call SilentFunction
|------------------------------------------------
| Macro Initialization.
|------------------------------------------------
/if (${Skip}) {
/echo Skipping straight to the Combine Portion of the Macro.
}
/if (${Destroy}) {
/echo All results from the Combine will be Destroyed.
}
/if (${Reply}) {
/echo Will Auto-Reply to Incoming Tells.
/echo Reply Message : ${ReplyMessage}
}
/if (${SkillAlert}) {
/echo Alerting and Exiting Macro when Brewing Skill reaches 200.
}
|------------------------------------------------
| Skip to Combine Check.
|------------------------------------------------
/if (${Skip}) /goto :Combine
:MainLoop
/doevents
/call GMCheck
|------------------------------------------------
| Walk to the Short Beer Merchant.
|------------------------------------------------
/call PlayFunction "to_short_beer 1 cf nopp noz"
/call WaitTilThere
|------------------------------------------------
| Buy the Short Beers(2 stacks).
|------------------------------------------------
/target Bilkel
/click right target
/delay 1s
/call BuyStack 1
/delay 1s
/call BuyStack 1
/delay 1s
/keypress esc
/keypress esc
|------------------------------------------------
| Walk to Cask, Malt, Yeast Merchant.
|------------------------------------------------
/call PlayFunction "short_beer_to_cask_malt_yeast 1 cf nopp noz"
/call WaitTilThere
|------------------------------------------------
| Buy the Casks(1 stack), Malts(3 stacks), and Yeasts(1 stack).
|------------------------------------------------
/target Lander
/click right target
/delay 1s
/call BuyStack 10
/delay 1s
/call BuyStack 4
/delay 1s
/call BuyStack 4
/delay 1s
/call BuyStack 4
/delay 1s
/call BuyStack 5
/delay 1s
/keypress esc
/keypress esc
|------------------------------------------------
| Walk to Water Flash Merchant.
|------------------------------------------------
/call PlayFunction "cask_malt_yeast_to_water 1 cf nopp noz"
/call WaitTilThere
|------------------------------------------------
| Buy the Water Flasks(2 stacks).
|------------------------------------------------
/target Sanderson
/click right target
/delay 1s
/call BuyStack 6
/delay 1s
/call BuyStack 6
/delay 1s
/keypress esc
/keypress esc
|------------------------------------------------
| Walk to Brew Barrel and Do Combines.
|------------------------------------------------
/call PlayFunction "water_to_barrel 1 cf nopp noz"
/call WaitTilThere
:Combine
/call DoCombine ${Destroy}
|------------------------------------------------
| Walk to Starting Point.
|------------------------------------------------
/call PlayFunction "barrel_to_start 1 cf nopp noz"
/call WaitTilThere
/goto :MainLoop
/endmacro
|---------------------------------------------------
| SUB: Do the Comines
|---------------------------------------------------
Sub DoCombine(int Destroy)
/declare iSlot int local
/declare Counter int local
/doevents
|------------------------------------------------
| Open Brew Barrel.
|------------------------------------------------
/itemtarget Brew Barrel
/face item
/click left item
/delay 2s
/notify COMBW_ContainerArea ExperimentButton leftmouseup
|------------------------------------------------
| Clear Out Brew Barrel.
|------------------------------------------------
/echo Cleaning Out Brew Barrel...
/for iSlot 1 to 10
/shiftkey /itemnotify enviro${iSlot} leftmouseup
/if (${Cursor.ID}) {
/destroy
}
/next iSlot
|------------------------------------------------
| Open Inventory Window.
|------------------------------------------------
/if (${Window[Inventory].Open}==FALSE) {
/windowstate inventory open
}
|------------------------------------------------
| Open All 8 Packs.
|------------------------------------------------
/for iSlot 1 to 8
/if (${Window[Pack${iSlot}].Open}==FALSE) {
/itemnotify pack${iSlot} rightmouseup
}
/next iSlot
|------------------------------------------------
| Make Heros Brew.
|------------------------------------------------
/echo Making Heroes Brew NOW...
:MakeBrew
/doevents
/call GMCheck
/if (${FindItem[Water].InvSlot}==NULL) /goto :Done
/ctrl /itemnotify ${FindItem[=Water Flask].InvSlot} leftmouseup
/delay 2
/itemnotify enviro1 leftmouseup
/delay 2
/if (${FindItem[Water].InvSlot}==NULL) /goto :Done
/ctrl /itemnotify ${FindItem[=Water Flask].InvSlot} leftmouseup
/delay 2
/itemnotify enviro2 leftmouseup
/delay 2
/if (${FindItem[Short].InvSlot}==NULL) /goto :Done
/ctrl /itemnotify ${FindItem[Short Beer].InvSlot} leftmouseup
/delay 2
/itemnotify enviro3 leftmouseup
/delay 2
/if (${FindItem[Short].InvSlot}==NULL) /goto :Done
/ctrl /itemnotify ${FindItem[Short Beer].InvSlot} leftmouseup
/delay 2
/itemnotify enviro4 leftmouseup
/delay 2
/if (${FindItem[Malt].InvSlot}==NULL) /goto :Done
/ctrl /itemnotify ${FindItem[Malt].InvSlot} leftmouseup
/delay 2
/itemnotify enviro5 leftmouseup
/delay 2
/if (${FindItem[Malt].InvSlot}==NULL) /goto :Done
/ctrl /itemnotify ${FindItem[Malt].InvSlot} leftmouseup
/delay 2
/itemnotify enviro6 leftmouseup
/delay 2
/if (${FindItem[Malt].InvSlot}==NULL) /goto :Done
/ctrl /itemnotify ${FindItem[Malt].InvSlot} leftmouseup
/delay 2
/itemnotify enviro7 leftmouseup
/delay 2
/if (${FindItem[Yeast].InvSlot}==NULL) /goto :Done
/ctrl /itemnotify ${FindItem[Yeast].InvSlot} leftmouseup
/delay 2
/itemnotify enviro8 leftmouseup
/delay 2
/if (${FindItem[Cask].InvSlot}==NULL) /goto :Done
/ctrl /itemnotify ${FindItem[Cask].InvSlot} leftmouseup
/delay 2
/itemnotify enviro9 leftmouseup
/delay 2
/combine enviro
/delay 2
|------------------------------------------------
| Waiting for Combine to Finish.
|------------------------------------------------
:WaitCombine
/if (!${Cursor.ID}) {
/goto :WaitCombine
}
|------------------------------------------------
| Clearing the Cursor.
|------------------------------------------------
:ClearCursor
/if (${Destroy}) {
/destroy
} else {
/autoinventory
}
/delay 2
/if (!${Cursor.ID}) {
/goto :MakeBrew
} else {
/goto :ClearCursor
}
|------------------------------------------------
| Done with Making Brew.
|------------------------------------------------
:Done
/echo Done with this round of Brewing, moving on...
/for Counter 1 to 9
/keypress ESC
/next Counter
/keypress ESC
/keypress ESC
/return
|--------------------------------------------------
| SUB: Buy a Stack of Passed Item
|--------------------------------------------------
Sub BuyStack(int SlotNumber)
/itemnotify Merchant${SlotNumber} leftmouseup
/delay 1s
/buyitem 20
/delay 1s
/return
|--------------------------------------------------
| SUB: Buy a Stack of Passed Item
|--------------------------------------------------
Sub GMCheck
/if (${Spawn[gm].ID}) {
/beep
/beep
/beep
/echo GM has entered the zone!
/echo FUCK HIM but ending the macro...
/keypress forward
/keypress back
/quit
/endmacro
}
/return
|--------------------------------------------------
| SUB: AdvPath Waiting Function
|--------------------------------------------------
Sub WaitTilThere
:LoopTilThere
/if (${PathingFlag}) {
/call AdvPathPoll
/delay 0
/doevents
/goto :LoopTilThere
}
/return
|--------------------------------------------------
| EVENT: Skillup Event
|--------------------------------------------------
Sub Event_SkillUp
/varcalc SkillUps ${SkillUps}+1
/echo *********************************
/echo Your Brewing Skill has Increased!
/echo Brewing : ${Me.Skill[Brewing]}
/echo *********************************
/if (${Me.Skill[Brewing]}==200 && ${SkillAlert}) {
/echo Skill Alert Level Reached! (200)
/echo Ending Macro...
/for Counter 1 to 9
/keypress ESC
/next Counter
/keypress ESC
/keypress ESC
/endmacro
}
/return
|--------------------------------------------------
| EVENT: Trivial Event
|--------------------------------------------------
Sub Event_SkillTrivial
/echo Your Brewing Skill can no longer increase from this macro!
/echo Ending Macro...
/for Counter 1 to 9
/keypress ESC
/next Counter
/keypress ESC
/keypress ESC
/endmacro
/return
|--------------------------------------------------
| EVENT: Success Event
|--------------------------------------------------
Sub Event_SkillSuccess
/varcalc Success ${Success}+1
/echo Success Count : ${Success}
/return
|--------------------------------------------------
| EVENT: Failure Event
|--------------------------------------------------
Sub Event_SkillFailure
/varcalc Failure ${Failure}+1
/echo Failure Count : ${Failure}
/return
|--------------------------------------------------
| EVENT: Brew Barrel In Use Event
|--------------------------------------------------
Sub Event_InUse
/echo Container busy. Retrying in 5 seconds...
/delay 5s
/call DoCombine(${Destroy})
/return
|--------------------------------------------------
| EVENT: Tell Received Event
|--------------------------------------------------
Sub Event_Chat(ChatType,Sender,ChatText)
/if (${Sender.Equal[Bilkel Biddinight]}) {
/return
}
/if (${Sender.Equal[Lander Furthers]}) {
/return
}
/if (${Sender.Equal[Sanderson]}) {
/return
}
/if (${Sender.Equal[Merchant]}) {
/return
}
/beep
/beep
/if (${Reply}) {
/reply ${ReplyMessage}
} else {
/echo **************************************
/echo Received a Tell From : ${Sender}
/echo Pausing Macro...
/echo Type /mqpause to Resume...
/echo **************************************
/keypress DOWN HOLD
/keypress DOWN
/mqpause
}
/return




Code: Select all
|advpath.inc
|Generic movement/pathing macro for inclusion in your own macros.
|Version 1.29
|Date:5/11/2004 4:00am
|
||**
[advpath]
version=1.29
**|
#include advpath2.inc
#Event LocalRecord "[MQ2] record#*#"
#Event LocalPlot "[MQ2] plot#*#"
#Event LocalDistance "[MQ2] distance#*#"
#Event LocalPlay "[MQ2] play:#*#"
#Event LocalStop "[MQ2] stop#*#"
#Event LocalGoto "[MQ2] goto#*#"
#Event LocalPause "[MQ2] pause#*#"
#Event LocalFollow "[MQ2] follow#*#"
#Event LocalSilent "[MQ2] silent#*#"
#Event LocalPattern "[MQ2] pattern:#*#"
#Event LocalAddMod "[MQ2] +#*#"
#Event LocalSubMod "[MQ2] -#*#"
#Event ZoneEvent "#*#You have entered#*#"
Sub AdvPathPoll
/if (${PathingFlag}==1 && ${CheckLocTimer}<=0) /call IncrementLoc ${LocArray[${CurrLoc}].Arg[1]} ${LocArray[${CurrLoc}].Arg[2]} ${LocArray[${CurrLoc}].Arg[3]}
/if (${RecordPathFlag}==1) /call RecordPath
/if (${FollowFlag}==1) {
/call TrackFollow
/call CheckForTarget
/if (${CheckLocTimer}<=0 && ${PauseFlag}==0 && ${NumLocs}>${CurrLoc}) /call FollowIncLoc ${LocArray[${CurrLoc}].Arg[1]} ${LocArray[${CurrLoc}].Arg[2]} ${LocArray[${CurrLoc}].Arg[3]}
}
/return
Sub ShapePlot(ObjectNumSides,ObjectSize,CharStartY,CharStartX,CharStartZ)
/declare PointNumber int local
/for PointNumber 1 to ${ObjectNumSides}
/varset XCoordinate[${PointNumber}] ${Math.Calc[${Math.Calc[${ObjectSize}*${Math.Cos[${Math.Calc[${Math.Calc[360/${ObjectNumSides}]}*${Math.Calc[${PointNumber}-1]}]}]}]}+${CharStartX}]}
/varset YCoordinate[${PointNumber}] ${Math.Calc[${Math.Calc[${ObjectSize}*${Math.Sin[${Math.Calc[${Math.Calc[360/${ObjectNumSides}]}*${Math.Calc[${PointNumber}-1]}]}]}]}+${CharStartY}]}
/varset ZCoordinate[${PointNumber}] ${CharStartZ}
/next PointNumber
/for PointNumber 1 to ${ObjectNumSides}
/varset LocArray[${PointNumber}] ${YCoordinate[${PointNumber}]} ${XCoordinate[${PointNumber}]} ${ZCoordinate[${PointNumber}]}
/next PointNumber
/varset CurrLoc 1
/varset NumLocs ${ObjectNumSides}
/return
Sub TargetMob(TgtName)
/declare a int local
/if (${NearestSpawn[1,pc "${TgtName}"].ID}>0) {
/if (${FollowFlag}==1 && ${ZoneTimer}==0) {
/for a 0 to ${Group}
/if (${Group[${a}].Name.Equal[${TgtName}]}) /return
/next a
}
/target clear
/call Delay 2
/target pc "${TgtName}"
/call Delay 4
/if (${Target.ID} && ${Target.CleanName.Equal["${TgtName}"]}) {
/varset ZoneTimer 0
/varset ZoneFlag 0
/varset FollowFlag 1
/varset FollowID ${Target.ID}
/if (${CurrLoc}==1) /varset CurrFollLoc ${Spawn[${FollowID}].Y} ${Spawn[${FollowID}].X} ${Spawn[${FollowID}].Z}
/if (${SilentFlag}==0) /echo -[ Following -( ${Target.CleanName} )- ]-
}
} else /if (${NearestSpawn[1,npc "${TgtName}"].ID}>0) {
/target clear
/call Delay 2
/target npc "${TgtName}"
/call Delay 4
/if (${Target.ID}>0 && ${Target.CleanName.Equal["${TgtName}"]}) {
/varset ZoneTimer 0
/varset ZoneFlag 0
/varset FollowFlag 1
/varset FollowID ${Target.ID}
/if (${CurrLoc}==1) /varset CurrFollLoc ${Spawn[${FollowID}].Y} ${Spawn[${FollowID}].X} ${Spawn[${FollowID}].Z}
/if (${SilentFlag}==0) /echo -[ Following -( ${Target.CleanName} )- ]-
}
} else /if (${ZoneFollow}==1) {
/if (${CurrLoc}==${NumLocs}) {
/if (${ZoneTimer}>0) {
/varset ZoneFlag 1
/delay 1s
} else {
/if (${ZoneFlag}==0) {
/call ClearLocs
/call TryToZone
} else {
/varset ZoneFlag 0
/varset FollowID 0
/call StopFunction
}
}
}
}
/return
Sub TrackFollow
/declare TempIndex int local
/if (${FollowFlag}==1) {
/if (${FollowID}>0) {
/if (${NumLocs}==1) {
/if (${Spawn[${FollowID}].Distance3D}>${FollowDistance}) {
/if (!${Me.Moving}) {
/varset LocArray[${NumLocs}] ${CurrFollLoc}
/varset NumLocs ${Math.Calc[${NumLocs}+1]}
}
/varset LocArray[${NumLocs}] ${Spawn[${FollowID}].Y} ${Spawn[${FollowID}].X} ${Spawn[${FollowID}].Z}
/call StoreHeading ${NumLocs}
/if (${LocArray[${NumLocs}].NotEqual["0 0 0"]} && ${LocArray[${NumLocs}].NotEqual["NULL NULL NULL"]}) /varset NumLocs ${Math.Calc[${NumLocs}+1]}
}
} else {
/varset TempIndex ${Math.Calc[${NumLocs}-1]}
/if (${Math.Distance[${LocArray[${TempIndex}].Arg[1]},${LocArray[${TempIndex}].Arg[2]},${LocArray[${TempIndex}].Arg[3]}:${Spawn[${FollowID}].Y},${Spawn[${FollowID}].X},${Spawn[${FollowID}].Z}]}>${If[${Spawn[${FollowID}].Speed}!=0,${Math.Calc[${Math.Calc[${Spawn[${FollowID}].Speed}/${SpeedSense}]}+${DistanceModifier}]},${Math.Calc[${Math.Calc[200/${SpeedSense}]}+${DistanceModifier}]}]}) {
/varset LocArray[${NumLocs}] ${Spawn[${FollowID}].Y} ${Spawn[${FollowID}].X} ${Spawn[${FollowID}].Z}
/if ((${LocArray[${NumLocs}].NotEqual["0 0 0"]} && ${LocArray[${NumLocs}].NotEqual["NULL NULL NULL"]})&&(${Math.Distance[${LocArray[${TempIndex}].Arg[1]},${LocArray[${TempIndex}].Arg[2]},${LocArray[${TempIndex}].Arg[3]}:${Spawn[${FollowID}].Y},${Spawn[${FollowID}].X},${Spawn[${FollowID}].Z}]}<500)) /varset NumLocs ${Math.Calc[${NumLocs}+1]}
}
}
}
}
/doevents
/return
Sub StoreHeading(Index)
/varset StoreHeading ${Heading[${LocArray[${Index}].Arg[1]},${LocArray[${Index}].Arg[2]}].DegreesCCW}
/return
Sub TryToZone
/declare InCurrZone string local
/declare TempStoreTgt int local
/varset TempStoreTgt 0
/varset InCurrZone ${Zone.Name}
/call Move 0
/if (${Target.ID}>0) /varset TempStoreTgt ${Target.ID}
/doortarget
/delay 3
/if (${Target.Name.Find["port"]} || ${Target.Name.Find["tele"]} || ${Target.Name.Find["prtl"]}) /goto :Port
/goto :NotPort
:Port
/if (${Target.Distance}<=50) {
/if (${PBFace.Equal[facef]}) {
/face fast nolook door
} else {
/face fast nolook away door
}
:ZoneMoveCloser
/if (${Target.Distance}>15) /call SimpleKeyPress FORWARD 1 0
/if (${Target.Distance}<11) /call SimpleKeyPress BACK 1 0
/if (${Target.Distance}>15) /goto :ZoneMoveCloser
/if (${Target.Distance}<11) /goto :ZoneMoveCloser
/keypress USE hold
/keypress USE
/delay 1
/keypress USE hold
/keypress USE
/varset ZoneTimer 5s
:WaitForZone
/delay 1
/if (${Zone.Name.NotEqual["${InCurrZone}"]}) /goto :Zoned
/if (${ZoneTimer}>0) /goto :WaitForZone
/if (${TempStoreTgt}>0) {
/if (${Spawn[${FollowID}].ID}>0) /target id ${TempStoreTgt}
} else {
/target clear
}
:Zoned
}
:NotPort
/if (${Zone.Name.Equal["${InCurrZone}"]}) {
/if (${PBFace.Equal[facef]}) {
/keypress FORWARD
/keypress FORWARD hold
/delay 2s
/keypress FORWARD
} else {
/keypress BACK
/keypress BACK hold
/delay 2s
/keypress BACK
}
/if (${TempStoreTgt}>0) {
/if (${Zone.Name.Equal["${InCurrZone}"]} && ${Spawn[${TempStoreTgt}].ID}>0) /target id ${TempStoreTgt}
} else {
/target clear
}
/varset ZoneTimer 20s
:WaitForZone2
/delay 1
/if (${Zone.Name.NotEqual["${InCurrZone}"]}) /goto :Zoned2
/if (${ZoneTimer}>0) /goto :WaitForZone2
/if (${SilentFlag}==0) /echo -(( Couldn't zone properly. Stopping. ))-
/varset PauseHolder NULL
/varset PauseFlag 0
/varset PathingFlag 0
/varset FollowFlag 0
/varset RecordPathFlag 0
/call ClearLocs
:Zoned2
}
/call Move 0
/return
Sub FollowFunction(FuncText)
/if (${PauseFlag}==0) {
/if (${PathingFlag}==0) {
/if (${RecordPathFlag}==0) {
/if (${FuncText.Length}==0) {
/varset FollowName NULL
} else {
/varset FollowName ${FuncText}
}
/if (${FollowName.NotEqual["NULL"]}) {
/call ClearLocs
/call Move 0
/call TargetMob "${FollowName}"
/varset PBFace facef
} else {
/if (${SilentFlag}==0) /echo -(( No follow target specified. You must provide the name of the npc/player you want to follow. ))-
}
} else {
/if (${SilentFlag}==0) /echo -(( You cannot start following while recording a pathfile! ))-
}
} else {
/if (${SilentFlag}==0) /echo -(( You cannot start following while playing back a pathfile! ))-
}
} else {
/if (${SilentFlag}==0) /echo -(( You cannot start following while paused! ))-
}
/return
Sub Event_LocalFollow(EvtText)
/if (${EvtText.Mid[7,6].Equal["follow"]}) {
/call FollowFunction "${EvtText.Right[-13]}"
}
/return
Sub PauseFunction
/if (${PauseFlag}==0) {
/if (${PathingFlag}==0) {
/if (${FollowFlag}==0) {
/if (${RecordPathFlag}==0) {
/if (${SilentFlag}==0) /echo -(( There is nothing to pause or unpause! ))-
} else {
/varset PauseFlag 1
/varset PauseHolder record
/varset RecordPathFlag 0
/if (${SilentFlag}==0) /echo -[ PAUSED recording of path file -( ${RecordPFName} )- ]-
/if (${SilentFlag}==0) /echo -[ Issue the pause command again to resume recording. ]-
}
} else {
/varset PauseFlag 1
/varset PauseHolder follow
/call Move 0
/if (${SilentFlag}==0) /echo -[ PAUSED following of -( ${FollowName} )- ]-
/if (${SilentFlag}==0) /echo -[ Issue the pause command again to resume following. ]-
}
} else {
/varset PauseFlag 1
/varset PauseHolder playback
/varset PathingFlag 0
/call Move 0
/if (${SilentFlag}==0) /echo -[ PAUSED playback of path file -( ${PBPFName} )- ]-
/if (${SilentFlag}==0) /echo -[ Issue the pause command again to resume playback. ]-
}
} else {
/if (${PauseHolder.Equal["record"]}) {
/varset PauseFlag 0
/varset RecordPathFlag 1
/if (${SilentFlag}==0) /echo -[ RESUMED recording of path file -( ${RecordPFName} )- ]-
}
/if (${PauseHolder.Equal["playback"]}) {
/varset PauseFlag 0
/varset PathingFlag 1
/if (${SilentFlag}==0) /echo -[ RESUMED playback of path file -( ${PBPFName} )- ]-
}
/if (${PauseHolder.Equal["follow"]}) {
/varset PauseFlag 0
/if (${SilentFlag}==0) /echo -[ RESUMED following of -( ${FollowName} )- ]-
}
}
/return
Sub Event_LocalPause(EvtText)
/if (${EvtText.Mid[7,5].Equal["pause"]}) {
/call PauseFunction
}
/return
Sub PlotFunction
/if (${ManualRecord}==1) {
/if (${RecordPathFlag}==1) {
/varset LocArray[${NumLocs}] ${Me.Y} ${Me.X} ${Me.Z}
/if (${SilentFlag}==0) /echo Location: Y:${LocArray[${NumLocs}].Arg[1]} X:${LocArray[${NumLocs}].Arg[2]} Z:${LocArray[${NumLocs}].Arg[3]} Plotted
/varset NumLocs ${Math.Calc[${NumLocs}+1]}
} else {
/if (${PauseFlag}==0) {
/if (${SilentFlag}==0) /echo -[ You aren't recording anything! ]-
} else {
/if (${SilentFlag}==0) /echo -[ You must unpause your recording in order to plot! ]-
}
}
} else {
/if (${SilentFlag}==0) /echo -[ You are not in Manual Record Mode! ]-
}
/return
Sub Event_LocalPlot(EvtText)
/if (${EvtText.Mid[7,4].Equal["plot"]}) {
/call PlotFunction
}
/return
Sub PlayFunction(FuncText)
/declare PlayNm string local
/declare PlayItr string local
/declare PlayDctn string local
/declare PlayPong string local
/declare PlayZn string local
/declare PlayFace string local
/declare TempCountVar int local
/if (${PauseFlag}==0) {
/if (${PathingFlag}==0) {
/if (${RecordPathFlag}==0) {
/if (${FollowFlag}==0) {
/if (${GetMoreCommands}==1) {
/varset GetMoreCommands 0
} else {
/varset PlayQueueNum 1
}
:InitParse
:ParsePlayCommands
/if (${FuncText.Find[" "]}>0) /varset PlayNm ${FuncText.Left[${FuncText.Find[" "]}]}
/if (${FuncText.Find[" "]}>0) /varset FuncText ${FuncText.Right[${Math.Calc[${FuncText.Length}-${FuncText.Find[" "]}]}]}
/if (${FuncText.Find[" "]}>0) /varset PlayItr ${FuncText.Left[${FuncText.Find[" "]}]}
/if (${FuncText.Find[" "]}>0) /varset FuncText ${FuncText.Right[${Math.Calc[${FuncText.Length}-${FuncText.Find[" "]}]}]}
/if (${FuncText.Find[" "]}>0) /varset PlayDctn ${FuncText.Left[${FuncText.Find[" "]}]}
/if (${FuncText.Find[" "]}>0) /varset FuncText ${FuncText.Right[${Math.Calc[${FuncText.Length}-${FuncText.Find[" "]}]}]}
/if (${FuncText.Find[" "]}>0) /varset PlayPong ${FuncText.Left[${FuncText.Find[" "]}]}
/if (${FuncText.Find[" "]}>0) /varset FuncText ${FuncText.Right[${Math.Calc[${FuncText.Length}-${FuncText.Find[" "]}]}]}
/if (${FuncText.Arg[2].Find["facef"]}>0 || ${FuncText.Arg[2].Find["faceb"]}>0) {
/if (${FuncText.Find[";"]}>0) {
/if (${FuncText.Find[" "]}>0) /varset PlayZn ${FuncText.Left[${Math.Calc[${FuncText.Find[" "]}-1]}]}
/if (${FuncText.Find[" "]}>0) /varset FuncText ${FuncText.Right[${Math.Calc[${FuncText.Length}-${FuncText.Find[" "]}]}]}
/varset PlayFace ${FuncText.Left[${Math.Calc[${FuncText.Find[";"]}-1]}]}
/varset FuncText ${FuncText.Right[${Math.Calc[${FuncText.Length}-${FuncText.Find[";"]}]}]}
/if (${PlayNm.Length}!=0 && ${PlayItr.Length}!=0 && ${PlayDctn.Length}!=0 && ${PlayPong.Length}!=0 && ${PlayZn.Length}!=0 && ${PlayFace.Length}!=0) {
/varset PlayCommandQueue[${PlayQueueNum}] ${PlayNm} ${PlayItr} ${PlayDctn} ${PlayPong} ${PlayZn} ${PlayFace}
/varset PlayQueueNum ${Math.Calc[${PlayQueueNum}+1]}
/goto :InitParse
} else {
/if (${SilentFlag}==0) /echo -(( Playback syntax error detected. Please try your command again. ))-
/return
}
} else {
/if (${FuncText.Find["+"]}>0) {
/if (${FuncText.Find[" "]}>0) /varset PlayZn ${FuncText.Left[${FuncText.Find[" "]}]}
/if (${FuncText.Find[" "]}>0) /varset FuncText ${FuncText.Right[${Math.Calc[${FuncText.Length}-${FuncText.Find[" "]}]}]}
/varset PlayFace ${FuncText.Left[${Math.Calc[${FuncText.Find["+"]}-1]}]}
/varset GetMoreCommands 1
} else {
/if (${FuncText.Find[" "]}>0) /varset PlayZn ${FuncText.Left[${FuncText.Find[" "]}]}
/if (${FuncText.Find[" "]}>0) /varset FuncText ${FuncText.Right[${Math.Calc[${FuncText.Length}-${FuncText.Find[" "]}]}]}
/varset PlayFace ${FuncText}
}
/if (${PlayNm.Length}!=0 && ${PlayItr.Length}!=0 && ${PlayDctn.Length}!=0 && ${PlayPong.Length}!=0 && ${PlayZn.Length}!=0 && ${PlayFace.Length}!=0) {
/varset PlayCommandQueue[${PlayQueueNum}] ${PlayNm} ${PlayItr} ${PlayDctn} ${PlayPong} ${PlayZn} ${PlayFace}
/if (${GetMoreCommands}==1) /varset PlayQueueNum ${Math.Calc[${PlayQueueNum}+1]}
/goto :DonePlayParse
} else {
/if (${SilentFlag}==0) /echo -(( Playback syntax error detected. Please try your command again. ))-
/return
}
}
} else {
/if (${FuncText.Find[";"]}>0) {
/if (${FuncText.Find[";"]}>0) /varset PlayZn ${FuncText.Left[${Math.Calc[${FuncText.Find[";"]}-1]}]}
/if (${FuncText.Find[";"]}>0) /varset FuncText ${FuncText.Right[${Math.Calc[${FuncText.Length}-${FuncText.Find[";"]}]}]}
/if (${PlayNm.Length}!=0 && ${PlayItr.Length}!=0 && ${PlayDctn.Length}!=0 && ${PlayPong.Length}!=0 && ${PlayZn.Length}!=0) {
/varset PlayCommandQueue[${PlayQueueNum}] ${PlayNm} ${PlayItr} ${PlayDctn} ${PlayPong} ${PlayZn} facef
/varset PlayQueueNum ${Math.Calc[${PlayQueueNum}+1]}
/goto :InitParse
} else {
/if (${SilentFlag}==0) /echo -(( Playback syntax error detected. Please try your command again. ))-
/return
}
} else {
/if (${FuncText.Find["+"]}>0) {
/varset PlayZn ${FuncText.Left[${Math.Calc[${FuncText.Find["+"]}-1]}]}
/varset GetMoreCommands 1
} else {
/varset PlayZn ${FuncText}
}
/if (${PlayNm.Length}!=0 && ${PlayItr.Length}!=0 && ${PlayDctn.Length}!=0 && ${PlayPong.Length}!=0 && ${PlayZn.Length}!=0) {
/varset PlayCommandQueue[${PlayQueueNum}] ${PlayNm} ${PlayItr} ${PlayDctn} ${PlayPong} ${PlayZn} facef
/if (${GetMoreCommands}==1) /varset PlayQueueNum ${Math.Calc[${PlayQueueNum}+1]}
/goto :DonePlayParse
} else {
/if (${SilentFlag}==0) /echo -(( Playback syntax error detected. Please try your command again. ))-
/return
}
}
}
:DonePlayParse
/if (${GetMoreCommands}==1) {
/if (${SilentFlag}==0) /echo -[ Path Extender Detected. ${Math.Calc[${PlayQueueNum}-1].Int} commands queued. Continue entering lines. ]-
/return
}
/if (${SilentFlag}==0) /echo -[------------------------------------------------]-
/if (${SilentFlag}==0) /echo -[ There ${If[${PlayQueueNum}==1,is,are]} ${PlayQueueNum} ${If[${PlayQueueNum}==1,path,paths]} to be run.
/if (${SilentFlag}==0) /echo -[------------------------------------------------]-
/for TempCountVar 1 to ${PlayQueueNum}
/if (${SilentFlag}==0) /echo -[ Path Command ${TempCountVar}: ${PlayCommandQueue[${TempCountVar}]}
/next TempCountVar
/if (${SilentFlag}==0) /echo -[------------------------------------------------]-
/varset PlayQueueCurr 1
/call GetCommand
/call LoadPathFile "${PBPFName}"
/if (${Macro.Return}==0) {
/if (${SilentFlag}==0) /echo -[ Started play back of path file -( ${PBPFName} )- ]-
/if (${Direction.Equal["forward"]}) {
/if (${PBDirection.Find["c"]}) {
/call GetClosestLoc
/call StoreHeading ${CurrLoc}
} else {
/varset CurrLoc 1
/call StoreHeading ${CurrLoc}
}
} else {
/if (${PBDirection.Find["c"]}) {
/call GetClosestLoc
/call StoreHeading ${CurrLoc}
} else {
/varset CurrLoc ${NumLocs}
/call StoreHeading ${CurrLoc}
}
}
/varset PathingFlag 1
}
} else {
/if (${SilentFlag}==0) /echo -(( You cannot start playback while in follow mode! ))-
}
} else {
/if (${SilentFlag}==0) /echo -(( You cannot start playback while recording! ))-
}
} else {
/if (${SilentFlag}==0) /echo -(( You are already playing back path file -( ${PBPFName} )- ))-
}
} else {
/if (${SilentFlag}==0) /echo -(( You cannot start playback while paused! ))-
}
/return
Sub Event_LocalPlay(EvtText)
/if (${EvtText.Mid[7,5].Equal["play:"]}) {
/call PlayFunction "${EvtText.Right[-11]}"
}
/return
Sub PatternFunction(FuncText)
/if (${PauseFlag}==0) {
/if (${PathingFlag}==0) {
/if (${FollowFlag}==0) {
/if (${RecordPathFlag}==0) {
/if (${FuncText.Arg[3].Length}==0) {
/if (${FuncText.Arg[1].Length}!=0 && ${FuncText.Arg[2].Length}!=0) {
/call ShapePlot ${FuncText.Arg[1]} ${FuncText.Arg[2]} ${Me.Y} ${Me.X} ${Me.Z}
/varset RecordPFName TempShape
/varset RecordPathFlag 1
/call StopFunction
/varset PlotFlag 1
/call PlayFunction "${RecordPFName} loop cf nopp noz facef"
}
} else {
/if (${FuncText.Arg[1].Length}!=0 && ${FuncText.Arg[2].Length}!=0 && ${FuncText.Arg[3].Length}!=0) {
/call ShapePlot ${FuncText.Arg[1]} ${FuncText.Arg[2]} ${Me.Y} ${Me.X} ${Me.Z}
/varset RecordPFName TempShape
/varset RecordPathFlag 1
/call StopFunction
/varset PlotFlag 1
/if (${FuncText.Arg[3].Equal[faceb]}) {
/call PlayFunction "${RecordPFName} loop cf nopp noz faceb"
} else {
/call PlayFunction "${RecordPFName} loop cf nopp noz facef"
}
}
}
} else {
/if (${SilentFlag}==0) /echo -(( You are already recording path file -( ${RecordPFName} )- ))-
}
} else {
/if (${SilentFlag}==0) /echo -(( You cannot start a pattern playback while in follow mode! ))-
}
} else {
/if (${SilentFlag}==0) /echo -(( You cannot start a pattern playback while playing back a path! ))-
}
} else {
/if (${SilentFlag}==0) /echo -(( You cannot start a pattern playback while paused! ))-
}
/return
Sub Event_LocalPattern(EvtText)
/if (${EvtText.Mid[7,8].Equal["pattern:"]}) {
/call PatternFunction "${EvtText.Right[-14]}"
}
/return
Sub RecordFunction(FuncText)
/if (${FuncText.Arg[2].Equal["manual"]}) {
/varset ManualRecord 1
} else {
/varset ManualRecord 0
}
/if (${PauseFlag}==0) {
/if (${PathingFlag}==0) {
/if (${FollowFlag}==0) {
/if (${RecordPathFlag}==0) {
/varset RecordPFName ${FuncText.Arg[1]}
/varset RecordPathFlag 1
/call ClearLocs
/if (${SilentFlag}==0) /echo -[ Started recording path file -( ${RecordPFName} )- ]-
} else {
/if (${SilentFlag}==0) /echo -(( You are already recording path file -( ${RecordPFName} )- ))-
}
} else {
/if (${SilentFlag}==0) /echo -(( You cannot start recording while in follow mode! ))-
}
} else {
/if (${SilentFlag}==0) /echo -(( You cannot start recording while playing back a path! ))-
}
} else {
/if (${SilentFlag}==0) /echo -(( You cannot start recording while paused! ))-
}
/return
Sub Event_LocalRecord(EvtText)
/if (${EvtText.Mid[7,6].Equal["record"]}) {
/call RecordFunction "${EvtText.Right[-13]}"
}
/return
Sub GotoFunction(TempYCoord,TempXCoord,TempZCoord)
/if ((${Defined[TempXCoord]}) && (${Defined[TempYCoord]})) /goto :Defined
/if (${SilentFlag}==0) /echo -(( You must at least provide the Y and X coordinates to run to. ))-
/return
:Defined
/if (${Defined[TempZCoord]}) {
} else {
/declare TempZCoord float local
/varset TempZCoord ${Me.Z}
}
/if (${PauseFlag}==0) {
/if (${PathingFlag}==0) {
/if (${FollowFlag}==0) {
/if (${RecordPathFlag}==0) {
/call ClearLocs
/varset LocArray[1] ${TempYCoord} ${TempXCoord} ${TempZCoord}
/varset LocArray[2] ${TempYCoord} ${TempXCoord} ${TempZCoord}
/varset RecordPFName GotoLoc
/varset RecordPathFlag 1
/varset CurrLoc 1
/varset NumLocs 2
/call StopFunction
/call PlayFunction "${RecordPFName} 1 f nopp noz"
/if (${SilentFlag}==0) /echo -[ Running to location:${TempYCoord},${TempXCoord},${TempZCoord} ]-
} else {
/if (${SilentFlag}==0) /echo -(( You cannot use goto while recording. ))-
}
} else {
/if (${SilentFlag}==0) /echo -(( You cannot use goto while in follow mode! ))-
}
} else {
/if (${SilentFlag}==0) /echo -(( You cannot use goto while playing back a path! ))-
}
} else {
/if (${SilentFlag}==0) /echo -(( You cannot use goto while paused! ))-
}
/return
Sub Event_LocalGoto(EvtText)
/if (${EvtText.Mid[7,4].Equal["goto"]}) {
/varset EvtText ${EvtText.Right[-11]}
/declare TempYCrd string local
/declare TempXCrd string local
/declare TempZCrd string local
/if (${EvtText.Arg[1].Length}!=0 && ${EvtText.Arg[2].Length}!=0) {
/if (${EvtText.Find[" "]}>0) {
/varset TempYCrd ${EvtText.Mid[1,${EvtText.Find[" "]}]}
/varset EvtText ${EvtText.Mid[${Math.Calc[${EvtText.Find[" "]}+1]},${Math.Calc[${EvtText.Length}-${EvtText.Find[" "]}]}]}
}
/if (${EvtText.Find[" "]}>0) {
/varset TempXCrd ${EvtText.Mid[1,${EvtText.Find[" "]}]}
/varset EvtText ${EvtText.Mid[${Math.Calc[${EvtText.Find[" "]}+1]},${Math.Calc[${EvtText.Length}-${EvtText.Find[" "]}]}]}
/if (${EvtText.Length}>0) {
/varset TempZCrd ${EvtText.Arg[1]}
} else {
/varset TempZCrd ${Me.Z}
}
} else {
/varset TempXCrd ${EvtText.Arg[1]}
/varset TempZCrd ${Me.Z}
}
/call GotoFunction "${TempYCrd}" "${TempXCrd}" "${TempZCrd}"
} else {
/if (${SilentFlag}==0) /echo -(( You must at least provide the Y and X coordinates to run to. ))-
}
}
/return
Sub DistanceFunction(FuncText)
/varset FollowDistance ${FuncText}
/if (${SilentFlag}==0) /echo -[ Follow Distance :[${Int[${FollowDistance}]}] ]-
/return
Sub Event_LocalDistance(EvtText)
/if (${EvtText.Mid[7,8].Equal["distance"]}) {
/call DistanceFunction "${EvtText.Right[-15]}"
}
/return
Sub SilentFunction
/if (${SilentFlag}==0) {
/varset SilentFlag 1
/echo -[ Silent Mode ON ]-
} else {
/varset SilentFlag 0
/echo -[ Silent Mode OFF ]-
}
/return
Sub Event_LocalSilent(EvtText)
/if (${EvtText.Right[-6].Equal["silent"]}) {
/call SilentFunction
}
/return
Sub StopFunction
/declare AdvPathIniFile string local
/declare NumOfRecs int local
/declare ClearVar string local
/declare RecCounter int local
/declare RecClrCounter int local
/if (${PathingFlag}==0) {
/if (${RecordPathFlag}==0) {
/if (${FollowFlag}==0) {
/if (${PauseFlag}==0) {
/if (${SilentFlag}==0) /echo -(( There is nothing to be stopped! ))-
} else {
/if (${SilentFlag}==0) /echo -[ Pause stopped and cleared! ]-
}
} else {
/varset FollowFlag 0
/call ClearLocs
/call Move 0
/if (${SilentFlag}==0) /echo -[ Stopped following -( ${FollowName} )- ]-
}
} else {
/if (${NumLocs}>1) {
/varset RecordPathFlag 0
/if (${SilentFlag}==0) /echo -[ Stopped recording path file -( ${RecordPFName} )- ]-
/if (${SilentFlag}==0) /echo -[ Saving path file -( ${RecordPFName} )- Stand By... ]-
/varset AdvPathIniFile PathFile_${RecordPFName}.ini
/varset RecClrCounter 0
:ClearRF
/varset ClearVar ${Ini[${AdvPathIniFile},PFLocs,${Int[${RecClrCounter}]},NOTFOUND]}
/if (${ClearVar.NotEqual["NOTFOUND"]}) {
/ini "${AdvPathIniFile}" "PFLocs" "${Int[${RecClrCounter}]}" "Empty"
/varset RecClrCounter ${Math.Calc[${RecClrCounter}+1]}
/goto :ClearRF
}
/goto :DoneClearRF
:DoneClearRF
/varset RecCounter 0
:CheckClearRF
/if (${RecCounter}==${RecClrCounter}) /goto :DoneCheckClearRF
/varset ClearVar ${Ini[${AdvPathIniFile},PFLocs,${Int[${RecCounter}]},NOTFOUND]}
/if (${ClearVar.Equal["Empty"]}) {
/varset RecCounter ${Math.Calc[${RecCounter}+1]}
/goto :CheckClearRF
}
/goto :CheckClearRF
:DoneCheckClearRF
/for NumOfRecs 0 to ${Math.Calc[${NumLocs}-2].Int}
/ini "${AdvPathIniFile}" "PFLocs" "${Int[${NumOfRecs}]}" "${LocArray[${Math.Calc[${NumOfRecs}+1]}]}"
/next NumOfRecs
/varset RecCounter 0
:CheckRF
/if (${RecCounter}==${Math.Calc[${NumLocs}-1]}) /goto :DoneCheckRF
/varset ClearVar ${Ini[${AdvPathIniFile},PFLocs,${Int[${RecCounter}]},NOTFOUND]}
/if (${ClearVar.Equal["NOTFOUND"]}) /goto :CheckRF
/if (${ClearVar.Equal["Empty"]}) /goto :CheckRF
/varset RecCounter ${Math.Calc[${RecCounter}+1]}
/goto :CheckRF
:DoneCheckRF
/if (${SilentFlag}==0) /echo -[ Save Completed. There were ${Math.Calc[${NumLocs}-1].Int} records total. ]-
} else {
/varset RecordPathFlag 0
/if (${SilentFlag}==0) /echo -(( There were no locations to record! ))-
}
}
} else {
/if (${SilentFlag}==0) /echo -[ Playback stopped! ]-
/call Move 0
}
/varset PauseHolder NULL
/varset PauseFlag 0
/varset PathingFlag 0
/varset RecordPathFlag 0
/varset PlotFlag 1
/call ClearLocs
/return
Sub Event_LocalStop(EvtText)
/if (${EvtText.Right[-6].Equal["stop"]}) {
/call StopFunction
}
/return
Sub Event_ZoneEvent
/varset FollowID 0
/if (${FollowFlag}==1) {
/varset ZoneTimer 30s
/call ClearLocs
/call Move 0
/delay 3s
/call ClearLocs
/call TargetMob "${FollowName}"
}
/if (${PathingFlag}==1) {
/call ClearLocs
/call Move 0
/delay 3s
/call ClearLocs
}
/call Move 0
/return
Sub SubModFunction
/if (${DistanceModifier}>0) /varset DistanceModifier ${Math.Calc[${DistanceModifier}-1]}
/if (${SilentFlag}==0) /echo -[ Distance Modifier:[${Int[${DistanceModifier}]}] ]-
/return
Sub Event_LocalSubMod(EvtText)
/if (${EvtText.Right[-6].Equal["-"]}) {
/call SubModFunction
}
/return
Sub AddModFunction
/varset DistanceModifier ${Math.Calc[${DistanceModifier}+1]}
/if (${SilentFlag}==0) /echo -[ Distance Modifier:[${Int[${DistanceModifier}]}] ]-
/return
Sub Event_LocalAddMod(EvtText)
/if (${EvtText.Right[-6].Equal["+"]}) {
/call AddModFunction
}
/return
Sub InitAPFVars(FaceF,SpeedS,FollowDst)
/declare CurrLoc int outer
/declare NumLocs int outer
/declare LocArray[5000] string outer
/declare PathingFlag int outer
/declare FollowID int outer
/declare SpeedSense int outer
/declare UseFaceFast int outer
/declare MyLastXLoc float outer
/declare MyLastYLoc float outer
/declare MyLastZLoc float outer
/declare ObstacleCount int outer
/declare CurrZone string outer
/declare LastLoc string outer
/declare TotalObstCount int outer
/declare FollowName string outer
/declare RecordPathFlag int outer
/declare PauseFlag int outer
/declare PauseHolder string outer
/declare PlayCommandQueue[100] string outer
/declare PlayQueueNum int outer
/declare PlayQueueCurr int outer
/declare RecordPFName string outer
/declare PBPFName string outer
/declare PBIterations string outer
/declare PBFace string outer
/declare Iterations int outer
/declare PBDirection string outer
/declare Direction string outer
/declare GetMoreCommands int outer
/declare PBPingPong string outer
/declare PingPongCount int outer
/declare PBZone string outer
/declare FollowFlag int outer
/declare ZoneFollow int outer
/declare SilentFlag int outer
/declare DelayTimer timer outer
/declare ZoneTimer timer outer
/declare ZoneFlag int outer
/declare XCoordinate[100] float outer
/declare YCoordinate[100] float outer
/declare ZCoordinate[100] float outer
/declare DistanceModifier int outer
/declare FollowDistance int outer
/declare CheckLocTimer timer outer
/declare PositionTimer timer outer
/declare StoreHeading int outer
/declare CurrFollLoc string outer
/declare DoorMoveTimer timer outer
/declare ManualRecord int outer
/declare PlotFlag int outer
/varset PlotFlag 0
/varset DoorMoveTimer 0
/varset PositionTimer 0
/varset CheckLocTimer 0
/varset DistanceModifier 0
/varset ZoneFlag 0
/if (${Defined[FaceF]}) {
/varset UseFaceFast ${FaceF}
} else {
/varset UseFaceFast 1
}
/if (${Defined[SpeedS]}) {
/varset SpeedSense ${SpeedS}
} else {
/varset SpeedSense 15
}
/if (${Defined[FollowDst]}) {
/varset FollowDistance ${FollowDst}
} else {
/varset FollowDistance 20
}
/varset SilentFlag 0
/varset ZoneFollow 1
/varset FollowFlag 0
/varset PauseHolder NULL
/varset PauseFlag 0
/varset GetMoreCommands 0
/varset PlayQueueCurr 1
/varset PlayQueueNum 1
/varset PBPFName NULL
/varset RecordPFName NULL
/varset RecordPathFlag 0
/varset CurrLoc 1
/varset NumLocs 1
/varset PathingFlag 0
/varset MyLastYLoc ${Me.Y}
/varset MyLastXLoc ${Me.X}
/varset MyLastZLoc ${Me.Z}
/varset ObstacleCount 0
/varset TotalObstCount 0
/echo Advpath.inc by ml2517 -- Initialized.
/return

Code: Select all
|advpath2.inc
|Generic movement/pathing macro for inclusion in your own macros. (2nd part)
|Version 1.27
|Date:5/8/2004 3:00pm
|
||**
[advpath]
version=1.27
**|
Sub SimpleKeyPress(Function,Duration,DelayType)
/if (!${Defined[DelayType]}) {
/declare DelayType int local
/varset DelayType 1
}
/if (${Function.Equal[FORWARD]} && ${PBFace.Equal[faceb]}) {
/varset Function BACK
} else /if (${Function.Equal[BACK]} && ${PBFace.Equal[faceb]}) {
/varset Function FORWARD
}
/keypress ${Function}
/keypress ${Function} hold
/if (${DelayType}==1) {
/call Delay ${Duration}
} else {
/delay ${Duration}
}
/keypress ${Function}
/return
Sub CheckObstacle
/if (${PlotFlag}==0 && ${Math.Distance[${MyLastYLoc},${MyLastXLoc},${MyLastZLoc}]}<1) /call CheckDoor
/if (${PlotFlag}==0 && ${Math.Distance[${MyLastYLoc},${MyLastXLoc},${MyLastZLoc}]}<1) /call HitObstacle
/varset MyLastYLoc ${Me.Y}
/varset MyLastXLoc ${Me.X}
/varset MyLastZLoc ${Me.Z}
/varset ObstacleCount 0
/return
Sub CheckDoor
/declare CharDirection int local
/declare TempVarDoor int local
/declare TempStoreTgt int local
/varset TempStoreTgt 0
/if (${Target.ID}>0) /varset TempStoreTgt ${Target.ID}
/doortarget
/if (${Target.Name.Find["door"]} && ${Target.Distance}<=12) {
/call Move 0
/if (${Me.Heading.DegreesCCW}>=315) {
/look 0
/if (${PBFace.Equal[facef]}) {
/face fast nolook heading 0
/varset CharDirection 0
} else {
/face fast nolook heading 180
/varset CharDirection 180
}
/goto :GotHeading
}
/if (${Me.Heading.DegreesCCW}<45) {
/look 0
/if (${PBFace.Equal[facef]}) {
/face fast nolook heading 0
/varset CharDirection 0
} else {
/face fast nolook heading 180
/varset CharDirection 180
}
/goto :GotHeading
}
/if (${Me.Heading.DegreesCCW}>=45 && ${Me.Heading.DegreesCCW}<135) {
/look 0
/if (${PBFace.Equal[facef]}) {
/face fast nolook heading 90
/varset CharDirection 90
} else {
/face fast nolook heading 270
/varset CharDirection 270
}
/goto :GotHeading
}
/if (${Me.Heading.DegreesCCW}>=135 && ${Me.Heading.DegreesCCW}<225) {
/look 0
/if (${PBFace.Equal[facef]}) {
/face fast nolook heading 180
/varset CharDirection 180
} else {
/face fast nolook heading 0
/varset CharDirection 0
}
/goto :GotHeading
}
/if (${Me.Heading.DegreesCCW}>=225 && ${Me.Heading.DegreesCCW}<315) {
/look 0
/if (${PBFace.Equal[facef]}) {
/face fast nolook heading 270
/varset CharDirection 270
} else {
/face fast nolook heading 90
/varset CharDirection 90
}
/goto :GotHeading
}
:GotHeading
/varset TempVarDoor 0
:DoorMoveCloser
/varset TempVarDoor ${Math.Calc[${TempVarDoor}+1]}
/if (${TempVarDoor}>50) /goto :DoorDoneMoveCloser
/if (${PBFace.Equal[facef]}) {
/if (${Target.Distance}>10) /call SimpleKeyPress FORWARD 1
/if (${Target.Distance}<8) /call SimpleKeyPress BACK 1
} else {
/if (${Target.Distance}>10) /call SimpleKeyPress BACK 1
/if (${Target.Distance}<8) /call SimpleKeyPress FORWARD 1
}
/if (${Target.Distance}>10) /goto :DoorMoveCloser
/if (${Target.Distance}<8) /goto :DoorMoveCloser
:DoorDoneMoveCloser
/call Delay 0
/keypress USE HOLD
/keypress USE
/call Delay 1s
/varset DoorMoveTimer 1s
/varset TempVarDoor 0
:DoorMoveAway
/if (${DoorMoveTimer}>0) {
/varset TempVarDoor ${Math.Calc[${TempVarDoor}+1]}
/if (${TempVarDoor}>50) /goto :DoorDoneMoveAway
/if (${PBFace.Equal[facef]}) {
/if (${Target.Distance}>21) /call SimpleKeyPress FORWARD 1
/if (${Target.Distance}<16) /call SimpleKeyPress BACK 1
} else {
/if (${Target.Distance}>21) /call SimpleKeyPress BACK 1
/if (${Target.Distance}<16) /call SimpleKeyPress FORWARD 1
}
/if (${Target.Distance}>21) /goto :DoorMoveAway
/if (${Target.Distance}<16) /goto :DoorMoveAway
:DoorDoneMoveAway
}
/call Delay 0
/if ((${Target.Heading.DegreesCCW}>355)&&(${Target.Heading.DegreesCCW}<5)) {
/if (${CharDirection}==0) {
/varset TempVarDoor 0
/look 0
/face fast nolook heading 337
:DoorNorth1
/varset TempVarDoor ${Math.Calc[${TempVarDoor}+1]}
/if (${PBFace.Equal[facef]}) {
/call SimpleKeyPress FORWARD 1
} else {
/call SimpleKeyPress BACK 1
}
/if (${TempVarDoor}<1) /goto :DoorNorth1
/face fast nolook door
} else {
/varset TempVarDoor 0
/look 0
/face fast nolook heading 203
:DoorNorth2
/varset TempVarDoor ${Math.Calc[${TempVarDoor}+1]}
/if (${PBFace.Equal[facef]}) {
/call SimpleKeyPress FORWARD 1
} else {
/call SimpleKeyPress BACK 1
}
/if (${TempVarDoor}<1) /goto :DoorNorth2
/face fast nolook door
}
}
/if ((${Target.Heading.DegreesCCW}>85)&&(${Target.Heading.DegreesCCW}<95)) {
/if (${CharDirection}==90) {
/varset TempVarDoor 0
/look 0
/face fast nolook heading 67
:DoorWest1
/varset TempVarDoor ${Math.Calc[${TempVarDoor}+1]}
/if (${PBFace.Equal[facef]}) {
/call SimpleKeyPress FORWARD 1
} else {
/call SimpleKeyPress BACK 1
}
/if (${TempVarDoor}<1) /goto :DoorWest1
/face fast nolook door
} else {
/varset TempVarDoor 0
/look 0
/face fast nolook heading 293
:DoorWest2
/varset TempVarDoor ${Math.Calc[${TempVarDoor}+1]}
/if (${PBFace.Equal[facef]}) {
/call SimpleKeyPress FORWARD 1
} else {
/call SimpleKeyPress BACK 1
}
/if (${TempVarDoor}<1) /goto :DoorWest2
/face fast nolook door
}
}
/if ((${Target.Heading.DegreesCCW}>175)&&(${Target.Heading.DegreesCCW}<185)) {
/if (${CharDirection}==180) {
/varset TempVarDoor 0
/look 0
/face fast nolook heading 157
:DoorSouth1
/varset TempVarDoor ${Math.Calc[${TempVarDoor}+1]}
/if (${PBFace.Equal[facef]}) {
/call SimpleKeyPress FORWARD 1
} else {
/call SimpleKeyPress BACK 1
}
/if (${TempVarDoor}<1) /goto :DoorSouth1
/face fast nolook door
} else {
/varset TempVarDoor 0
/look 0
/face fast nolook heading 23
:DoorSouth2
/varset TempVarDoor ${Math.Calc[${TempVarDoor}+1]}
/if (${PBFace.Equal[facef]}) {
/call SimpleKeyPress FORWARD 1
} else {
/call SimpleKeyPress BACK 1
}
/if (${TempVarDoor}<1) /goto :DoorSouth2
/face fast nolook door
}
}
/if ((${Target.Heading.DegreesCCW}>265)&&(${Target.Heading.DegreesCCW}<275)) {
/if (${CharDirection}==270) {
/varset TempVarDoor 0
/look 0
/face fast nolook heading 247
:DoorEast1
/varset TempVarDoor ${Math.Calc[${TempVarDoor}+1]}
/if (${PBFace.Equal[facef]}) {
/call SimpleKeyPress FORWARD 1
} else {
/call SimpleKeyPress BACK 1
}
/if (${TempVarDoor}<1) /goto :DoorEast1
/face fast nolook door
} else {
/varset TempVarDoor 0
/look 0
/face fast nolook heading 113
:DoorEast2
/varset TempVarDoor ${Math.Calc[${TempVarDoor}+1]}
/if (${PBFace.Equal[facef]}) {
/call SimpleKeyPress FORWARD 1
} else {
/call SimpleKeyPress BACK 1
}
/if (${TempVarDoor}<1) /goto :DoorEast2
/face fast nolook door
}
}
/if (${PBFace.Equal[facef]}) {
/call Move 1
} else {
/keypress FORWARD hold
/delay 8
/keypress FORWARD
/call Move 1
}
}
/if (${TempStoreTgt}>0) {
/if (${Spawn[${TempStoreTgt}].ID}) /target id ${TempStoreTgt}
} else {
/target clear
}
/return
Sub CheckForTarget
/if ((${FollowFlag}==1)&&(${ObstacleCount}<7)&&(!${Target.CleanName.Equal["${FollowName}"]})) {
/call TargetMob "${FollowName}"
}
/return
Sub CheckMoving
/if (${PauseFlag}==0 && ${Me.Speed}==0) {
/call Move 1
}
/return
Sub ClearLocs
/varset CurrLoc 1
/varset NumLocs 1
/varset ObstacleCount 0
/varset TotalObstCount 0
/return
Sub Delay(DelayTime)
|
| Time Critical /call's that do simple calculations go in the for loop.
| Do not put things in here that might interfere with other functions.
|
/varset DelayTimer ${DelayTime}
:DlyLoop
/delay 1
/if (${FollowFlag}==1) /call TrackFollow
/if (${DelayTimer}>0) /goto :DlyLoop
/return
Sub FindLookAngle(TY,TX,TZ)
/declare Angle float local
/declare LevOrWet int local
/declare TempFacing float local
/varset LevOrWet 0
/declare FY float local
/declare FX float local
/declare FZ float local
/varset FZ ${Me.Z}
/if (${Me.FeetWet}) {
/varset TZ ${Math.Calc[${TZ}+3]}
/varset LevOrWet ${Math.Calc[${LevOrWet}+1]}
}
/if (${Me.Levitating}) {
/varset TZ ${Math.Calc[${TZ}+5]}
/varset LevOrWet ${Math.Calc[${LevOrWet}+1]}
}
/varset FY ${Me.Y}
/varset FX ${Me.X}
/varset Angle ${Math.Abs[${Math.Asin[${If[${Math.Abs[${Math.Abs[${FZ}-${TZ}]}/${Math.Distance[${TY},${TX},${TZ}:${FY},${FX},${FZ}]}]}<=1,${Math.Calc[${Math.Abs[${FZ}-${TZ}]}/${Math.Distance[${TY},${TX},${TZ}:${FY},${FX},${FZ}]}]},1]}]}]}
/if (${FZ}>${TZ}) {
/varset Angle ${Math.Calc[${Angle}*-1]}
} else /if (${TZ}==${FZ}) {
/varset Angle 0
}
/if (${LevOrWet}==0) /varset Angle ${Math.Calc[${Math.Calc[${Angle}\20]}*20]}
/if (${FollowFlag}==1 && ${CurrLoc}<3 && ${Me.Speed}==0) {
/if (${PBFace.Equal[facef]}) {
/face nolook loc ${TY},${TX}
} else {
/face nolook away loc ${TY},${TX}
}
:WaitForTurnStart
/varset TempFacing ${Me.Heading.DegreesCCW}
/call Delay 1
/if (${Me.Heading.DegreesCCW}!=${TempFacing}) /goto :WaitForTurnStart
}
/if (${UseFaceFast}==0) {
/if (${Math.Abs[${Me.Heading.DegreesCCW}-${Heading[${TY},${TX}].DegreesCCW}]}>${If[${Me.Speed}>0,${Math.Calc[2700/${Me.Speed}]},10]}) {
/call Move 0
/if (${PBFace.Equal[facef]}) {
/face nolook loc ${TY},${TX}
} else {
/face nolook away loc ${TY},${TX}
}
:WaitForTurnLook
/varset TempFacing ${Me.Heading.DegreesCCW}
/call Delay 1
/if (${Me.Heading.DegreesCCW}!=${TempFacing}) /goto :WaitForTurnLook
/call Delay 1
} else {
/if (${PBFace.Equal[facef]}) {
/face nolook loc ${TY},${TX}
} else {
/face nolook away loc ${TY},${TX}
}
}
} else {
/if (${PBFace.Equal[facef]}) {
/face fast nolook loc ${TY},${TX}
} else {
/face fast nolook away loc ${TY},${TX}
}
}
/look ${Angle}
/return
Sub FollowIncLoc(TY,TX,TZ)
/if (${TY.Equal[NULL]} && ${TX.Equal[NULL]} && ${TZ.Equal[NULL]}) {
/call Move 0
/return
}
/declare TempFacing float local
/varset CheckLocTimer 1
/varset ObstacleCount ${Math.Calc[${ObstacleCount}+1]}
/varset TotalObstCount ${Math.Calc[${TotalObstCount}+1]}
/varset PositionTimer 1s
/if (${Spawn[${FollowID}].ID} && ${Spawn[${FollowID}].Distance3D}<=${Math.Calc[${FollowDistance}+${Math.Calc[${Me.Speed}/30]}]}) {
/call Move 0
/if (${Spawn[${FollowID}].ID} && ${Spawn[${FollowID}].Speed}==0) {
/face nolook id ${FollowID}
:WaitForTurnFoll
/varset TempFacing ${Me.Heading.DegreesCCW}
/call Delay 1
/if (${Me.Heading.DegreesCCW}!=${TempFacing}) /goto :WaitForTurnFoll
:FollowDistClose
/if (${PositionTimer}>0 && ${Spawn[${FollowID}].ID}) {
/if (${Spawn[${FollowID}].Distance3D}>${Math.Calc[${FollowDistance}+8]}) /call SimpleKeyPress FORWARD 1
/if (${Spawn[${FollowID}].Distance3D}<${Math.Calc[${FollowDistance}-8]}) /call SimpleKeyPress BACK 1
/if (${Spawn[${FollowID}].Distance3D}>${Math.Calc[${FollowDistance}+8]}) /goto :FollowDistClose
/if (${Spawn[${FollowID}].Distance3D}<${Math.Calc[${FollowDistance}-8]}) /goto :FollowDistClose
}
}
/call ClearLocs
/if (${CurrLoc}==1) /varset CurrFollLoc ${Spawn[${FollowID}].Y} ${Spawn[${FollowID}].X} ${Spawn[${FollowID}].Z}
/return
}
/if ((${Heading[${TY},${TX}].DegreesCCW}<${Math.Calc[${StoreHeading}-90]})||(${Heading[${TY},${TX}].DegreesCCW}>${Math.Calc[${StoreHeading}+90]})||(${Math.Distance[${TY},${TX},${TZ}]}<${If[${Me.Speed}!=0,${Math.Calc[${Math.Calc[${Me.Speed}/${SpeedSense}]}+${DistanceModifier}]},${Math.Calc[${Math.Calc[200/${SpeedSense}]}+${DistanceModifier}]}]})) {
/varset LastLoc ${LocArray[${CurrLoc}]}
/varset CurrLoc ${Math.Calc[${CurrLoc}+1]}
/if (${CurrLoc}<${NumLocs}) /call StoreHeading ${CurrLoc}
/varset ObstacleCount 0
/varset TotalObstCount 0
}
/if (${CurrLoc}==${NumLocs}) {
/call Move 0
/if (${Spawn[${FollowID}].ID}) {
/face nolook id ${FollowID}
:WaitForTurnFoll2
/varset TempFacing ${Me.Heading.DegreesCCW}
/call Delay 1
/if (${Me.Heading.DegreesCCW}!=${TempFacing}) /goto :WaitForTurnFoll2
:FollowDistClose2
/if (${PositionTimer}>0 && ${Spawn[${FollowID}].ID} && ${Spawn[${FollowID}].Speed}==0) {
/if (${Spawn[${FollowID}].Distance3D}<${Math.Calc[${FollowDistance}+8]}) {
/if (${Spawn[${FollowID}].Distance3D}>${Math.Calc[${FollowDistance}+8]}) /call SimpleKeyPress FORWARD 1
/if (${Spawn[${FollowID}].Distance3D}<${Math.Calc[${FollowDistance}-8]}) /call SimpleKeyPress BACK 1
/if (${Spawn[${FollowID}].Distance3D}>${Math.Calc[${FollowDistance}+8]}) /goto :FollowDistClose2
/if (${Spawn[${FollowID}].Distance3D}<${Math.Calc[${FollowDistance}-8]}) /goto :FollowDistClose2
}
}
}
/call ClearLocs
/if (${CurrLoc}==1) /varset CurrFollLoc ${Spawn[${FollowID}].Y} ${Spawn[${FollowID}].X} ${Spawn[${FollowID}].Z}
/return
}
/if (${ObstacleCount}>6) /call CheckObstacle
/if (${CurrLoc}<${NumLocs}) {
/if (${TotalObstCount}>50) {
/varset LastLoc ${LocArray[${CurrLoc}]}
/varset CurrLoc ${Math.Calc[${CurrLoc}+1]}
/varset ObstacleCount 0
/varset TotalObstCount 0
}
} else {
/echo -(( Cannot get to location because of obstacles! Aborting. ))-
/call StopFunction
/return
}
/if (${NumLocs}>${CurrLoc}) {
/call FindLookAngle ${LocArray[${CurrLoc}].Arg[1]} ${LocArray[${CurrLoc}].Arg[2]} ${LocArray[${CurrLoc}].Arg[3]}
/call CheckMoving
}
/return
Sub GetClosestLoc
/declare FindClosest int local
/declare TempClosest float local
/declare Closest int local
/varset TempClosest 9999
/varset Closest 1
/for FindClosest 1 to ${NumLocs}
/if (${Math.Distance[${LocArray[${FindClosest}].Arg[1]},${LocArray[${FindClosest}].Arg[2]},${LocArray[${FindClosest}].Arg[3]}]}<${TempClosest}) {
/varset TempClosest ${Math.Distance[${LocArray[${FindClosest}].Arg[1]},${LocArray[${FindClosest}].Arg[2]},${LocArray[${FindClosest}].Arg[3]}]}
/varset Closest ${FindClosest}
}
/next FindClosest
/varset CurrLoc ${Closest}
/return
Sub GetCommand
/varset PathingFlag 0
/varset PBPFName ${PlayCommandQueue[${PlayQueueCurr}].Arg[1]}
/varset PBIterations ${PlayCommandQueue[${PlayQueueCurr}].Arg[2]}
/varset PBDirection ${PlayCommandQueue[${PlayQueueCurr}].Arg[3]}
/varset PBPingPong ${PlayCommandQueue[${PlayQueueCurr}].Arg[4]}
/varset PBZone ${PlayCommandQueue[${PlayQueueCurr}].Arg[5]}
/varset PBFace ${PlayCommandQueue[${PlayQueueCurr}].Arg[6]}
/if (${PBDirection.Find["r"]}) {
/varset Direction reverse
} else {
/varset Direction forward
}
/if (${PBPingPong.Find["nopp"]}) {
/varset PingPongCount 0
} else {
/varset PingPongCount 1
}
/if (${PBIterations.Find["loop"]}) {
/varset Iterations 1
} else {
/varset Iterations ${PBIterations}
}
/return
| Partially plagerized from McKorr's autofight.inc
Sub HitObstacle
/call Move 0
/if (${PBFace.Equal[facef]}) {
/keypress BACK
/keypress BACK hold
/call Delay ${Math.Calc[${Math.Rand[3]}+3].Int}
/keypress BACK
} else {
/keypress FORWARD
/keypress FORWARD hold
/call Delay ${Math.Calc[${Math.Rand[3]}+3].Int}
/keypress FORWARD
}
/if (${Math.Rand[99]}>49) {
/keypress RIGHT
/keypress RIGHT hold
} else {
/keypress LEFT
/keypress LEFT hold
}
/call Delay ${Math.Calc[${Math.Rand[3]}+3].Int}
/keypress RIGHT
/keypress LEFT
/call Move 1
/call Delay 3
/keypress JUMP
/call Delay 1
/if (${PBFace.Equal[facef]}) {
/face fast nolook loc ${LocArray[${CurrLoc}].Arg[1]},${LocArray[${CurrLoc}].Arg[2]}
} else {
/face fast nolook away loc ${LocArray[${CurrLoc}].Arg[1]},${LocArray[${CurrLoc}].Arg[2]}
}
/return
Sub IncrementLoc(TY,TX,TZ)
/varset CheckLocTimer 1
/varset ObstacleCount ${Math.Calc[${ObstacleCount}+1]}
/varset TotalObstCount ${Math.Calc[${TotalObstCount}+1]}
/if (${PBFace.Equal[facef]}) {
/if ((${Heading[${TY},${TX}].DegreesCCW}<${Math.Calc[${StoreHeading}-90]})||(${Heading[${TY},${TX}].DegreesCCW}>${Math.Calc[${StoreHeading}+90]})||(${Math.Distance[${TY},${TX},${TZ}]}<${If[${Me.Speed}!=0,${Math.Calc[${Math.Calc[${Me.Speed}/${SpeedSense}]}+${DistanceModifier}]},${Math.Calc[${Math.Calc[200/${SpeedSense}]}+${DistanceModifier}]}]})) {
/varset LastLoc ${LocArray[${CurrLoc}]}
/if (${Direction.Equal["forward"]}) {
/varset CurrLoc ${Math.Calc[${CurrLoc}+1]}
/call StoreHeading ${CurrLoc}
} else {
/varset CurrLoc ${Math.Calc[${CurrLoc}-1]}
/call StoreHeading ${CurrLoc}
}
/varset ObstacleCount 0
/varset TotalObstCount 0
}
} else {
/if ((${Heading[${TY},${TX}].DegreesCCW}<${Math.Calc[${StoreHeading}-90]})||(${Heading[${TY},${TX}].DegreesCCW}>${Math.Calc[${StoreHeading}+90]})||(${Math.Distance[${TY},${TX},${TZ}]}<${If[${Me.Speed}!=0,${Math.Calc[${Math.Calc[${Me.Speed}/${SpeedSense}]}+${DistanceModifier}+10]},${Math.Calc[${Math.Calc[200/${SpeedSense}]}+${DistanceModifier}+10]}]})) {
/varset LastLoc ${LocArray[${CurrLoc}]}
/if (${Direction.Equal["forward"]}) {
/varset CurrLoc ${Math.Calc[${CurrLoc}+1]}
/call StoreHeading ${CurrLoc}
} else {
/varset CurrLoc ${Math.Calc[${CurrLoc}-1]}
/call StoreHeading ${CurrLoc}
}
/varset ObstacleCount 0
/varset TotalObstCount 0
}
}
/if (${Direction.Equal["forward"]}) {
/if (${CurrLoc}>${NumLocs}) {
/if (${PingPongCount}==0) {
/if (${PBIterations.NotEqual["loop"]}) {
/varset Iterations ${Math.Calc[${Iterations}-1]}
} else {
/varset CurrLoc 1
/call StoreHeading ${CurrLoc}
}
/if (${Iterations}==0) {
/if (${PBZone.Equal["z"]}) /call TryToZone
/if (${PlayQueueCurr}==${PlayQueueNum}) {
/call Move 0
/varset PlayQueueCurr 1
/varset PlayQueueNum 1
/varset PathingFlag 0
/call ClearLocs
/if (${SilentFlag}==0) /echo -[ Done with playback! ]-
} else {
/varset PlayQueueCurr ${Math.Calc[${PlayQueueCurr}+1]}
/call Move 0
/call GetCommand
/call LoadPathFile "${PBPFName}"
/if (${Macro.Return}==0) {
/if (${SilentFlag}==0) /echo -[ Started play back of path file -( ${PBPFName} )- ]-
/if (${Direction.Equal["forward"]}) {
/if (${PBDirection.Find["c"]}) {
/call GetClosestLoc
/call StoreHeading ${CurrLoc}
} else {
/varset CurrLoc 1
/call StoreHeading ${CurrLoc}
}
} else {
/if (${PBDirection.Find["c"]}) {
/call GetClosestLoc
/call StoreHeading ${CurrLoc}
} else {
/varset CurrLoc ${NumLocs}
/call StoreHeading ${CurrLoc}
}
}
/varset PathingFlag 1
}
}
} else {
/if (${PBPingPong.Equal["pp"]}) {
/varset PingPongCount 1
/varset Direction reverse
/varset CurrLoc ${NumLocs}
/call StoreHeading ${CurrLoc}
}
}
} else {
/varset PingPongCount ${Math.Calc[${PingPongCount}-1]}
/varset Direction reverse
/varset CurrLoc ${NumLocs}
/call StoreHeading ${CurrLoc}
}
}
/if (${ObstacleCount}>6) /call CheckObstacle
/if (${TotalObstCount}>50) {
/varset LastLoc ${LocArray[${CurrLoc}]}
/if (${CurrLoc}<${NumLocs}) {
/varset CurrLoc ${Math.Calc[${CurrLoc}+1]}
/call StoreHeading ${CurrLoc}
/varset ObstacleCount 0
/varset TotalObstCount 0
} else {
/echo -(( Cannot get to location because of obstacles! Aborting. ))-
/call StopFunction
/return
}
}
/if (${PathingFlag}==1) {
/call FindLookAngle ${LocArray[${CurrLoc}].Arg[1]} ${LocArray[${CurrLoc}].Arg[2]} ${LocArray[${CurrLoc}].Arg[3]}
/call CheckMoving
}
} else {
/if (${CurrLoc}<1) {
/if (${PingPongCount}==0) {
/if (${PBIterations.NotEqual["loop"]}) {
/varset Iterations ${Math.Calc[${Iterations}-1]}
} else {
/varset CurrLoc ${NumLocs}
/call StoreHeading ${CurrLoc}
}
/if (${Iterations}==0) {
/if (${PBZone.Equal["z"]}) /call TryToZone
/if (${PlayQueueCurr}==${PlayQueueNum}) {
/call Move 0
/varset PlayQueueCurr 1
/varset PlayQueueNum 1
/varset PathingFlag 0
/call ClearLocs
/if (${SilentFlag}==0) /echo -[ Done with playback! ]-
} else {
/varset PlayQueueCurr ${Math.Calc[${PlayQueueCurr}+1]}
/call Move 0
/call GetCommand
/call LoadPathFile "${PBPFName}"
/if (${Macro.Return}==0) {
/if (${SilentFlag}==0) /echo -[ Started play back of path file -( ${PBPFName} )- ]-
/if (${Direction.Equal["forward"]}) {
/if (${PBDirection.Find["c"]}) {
/call GetClosestLoc
/call StoreHeading ${CurrLoc}
} else {
/varset CurrLoc 1
/call StoreHeading ${CurrLoc}
}
} else {
/if (${PBDirection.Find["c"]}) {
/call GetClosestLoc
/call StoreHeading ${CurrLoc}
} else {
/varset CurrLoc ${NumLocs}
/call StoreHeading ${CurrLoc}
}
}
/varset PathingFlag 1
}
}
} else {
/if (${PBPingPong.Equal["pp"]}) {
/varset PingPongCount 1
/varset Direction forward
/varset CurrLoc 1
/call StoreHeading ${CurrLoc}
}
}
} else {
/varset PingPongCount ${Math.Calc[${PingPongCount}-1]}
/varset Direction forward
/varset CurrLoc 1
/call StoreHeading ${CurrLoc}
}
}
/if (${ObstacleCount}>6) /call CheckObstacle
/if (${TotalObstCount}>50) {
/if (${CurrLoc}>1) {
/varset LastLoc ${LocArray[${CurrLoc}]}
/varset CurrLoc ${Math.Calc[${CurrLoc}-1]}
/call StoreHeading ${CurrLoc}
/varset ObstacleCount 0
/varset TotalObstCount 0
} else {
/echo -(( Cannot get to location because of obstacles! Aborting. ))-
/call StopFunction
/return
}
}
/if (${PathingFlag}==1) {
/call FindLookAngle ${LocArray[${CurrLoc}].Arg[1]} ${LocArray[${CurrLoc}].Arg[2]} ${LocArray[${CurrLoc}].Arg[3]}
/call CheckMoving
}
}
/doevents
/return
Sub LoadPathFile(PFIniName)
/declare AdvPathIniFile string local
/varset AdvPathIniFile PathFile_${PFIniName}.ini
/call ClearLocs
:LoadPlayFile
/varset LocArray[${NumLocs}] ${Ini[${AdvPathIniFile},PFLocs,${Int[${Math.Calc[${NumLocs}-1]}]},NOTFOUND]}
/if (${LocArray[${NumLocs}].Equal["NOTFOUND"]}) {
/varset NumLocs ${Math.Calc[${NumLocs}-1]}
/goto :DoneLoadPlayFile
}
/if (${LocArray[${NumLocs}].Equal["Empty"]}) {
/varset NumLocs ${Math.Calc[${NumLocs}-1]}
/goto :DoneLoadPlayFile
}
/varset NumLocs ${Math.Calc[${NumLocs}+1]}
/goto :LoadPlayFile
:DoneLoadPlayFile
/if (${NumLocs}<1) {
/if (${SilentFlag}==0) /echo -(( No pathing information found in -( ${PFIniName} )- ))-
/varset PathingFlag 0
/call ClearLocs
/return 1
}
/return 0
Sub Move(MoveCommand)
/if (${PauseFlag}==0) {
/if (${MoveCommand}==1) {
/if (${PBFace.Equal[facef]}) {
/keypress FORWARD
/keypress FORWARD hold
} else {
/keypress BACK
/keypress BACK hold
}
} else {
/keypress FORWARD
/keypress RIGHT
/keypress LEFT
/keypress BACK
}
} else {
/if (${MoveCommand}==0) {
/keypress FORWARD
/keypress RIGHT
/keypress LEFT
/keypress BACK
}
}
/return
Sub RecordPath
/declare TempIndex int local
/if (${ManualRecord}==0) {
/if (${RecordPathFlag}==1) {
/if (${NumLocs}==1) {
/varset LocArray[${NumLocs}] ${Me.Y} ${Me.X} ${Me.Z}
/varset NumLocs ${Math.Calc[${NumLocs}+1]}
} else {
/varset TempIndex ${Math.Calc[${NumLocs}-1]}
/if (${Math.Distance[${LocArray[${TempIndex}].Arg[1]},${LocArray[${TempIndex}].Arg[2]},${LocArray[${TempIndex}].Arg[3]}]}>12) {
/varset LocArray[${NumLocs}] ${Me.Y} ${Me.X} ${Me.Z}
/if (${SilentFlag}==0) /echo Location: Y:${LocArray[${NumLocs}].Arg[1]} X:${LocArray[${NumLocs}].Arg[2]} Z:${LocArray[${NumLocs}].Arg[3]} Plotted
/varset NumLocs ${Math.Calc[${NumLocs}+1]}
}
}
}
}
/doevents
/return

Code: Select all
| Heros Brew Macro
| HerosBrew.mac
| Author : robdawg
| Corrected : aChallenged1 (fixed html signs and corrected the button notify, that is all.
| Version : v1.0 2004-05-05
| Useage : /macro HerosBrew <Destroy, 0 or 1> <Reply, 0 or 1> <ReplyMessage, string> <Skip, 0 or 1> <SkillAlert, 0 or 1>
| Examples : /macro HerosBrew 1 0 "" 0 0
| Destroys all items from the combine.
| /macro HerosBrew 1 1 "DIE!" 0 0
| Destroys all items from the combine and replys to tells with "DIE!".
| /macro HerosBrew 0 1 "DIE!" 1 1
| Replys to tells with "DIE!", starts combining, and alerts when
| brewing skill is 200.
| Description : This script will run your character all over Shadow Haven buying
| components to make Heroes Brew. You can set this script to end
| once you reach 200, or this script will auto-end once you hit skill
| 248. I recommend having packs in all 8 slots. Furthermore, I
| recommend that you open all pack windows, inventory, and the
| experiement view for the tradeskill container to make sure NOTHING
| is over-lapping.
|
| When Destroy is set to 1, all items after the combine will be
| destroyed.
|
| When Reply is set to 1, an auto-response will be sent to the sender.
|
| ReplyMessage is required even if Reply is set to 0. Furthermore,
| the ReplyMessage must be enclosed in quotes. This message can be
| "" if Reply is set to 0.
|
| When Skip is set to 1, it will start do combines without buying
| the components first.
|
| When SkillAlert is set to 1, it will end the macro when your
| brewing skill reaches 200.
|
| REQUIRES : AdvPath.inc that was created by ml2517.
|
| NOTE : Be sure to be standing near Bilken Biddinight. He is
| located in the tent like building. (pos184, pos917)
|
| NOTE : Fast Item Destroy must be turned ON if you are going to
| destroy all items after the combine.
|
| NOTE : If you wish to do twice as many combines at one time, simply
| create twice as many BuyStack("") functions to buy twice as many
| components.
|
| Credits : Onezero for making the original HeroesBrew.mac
|-----------------------------------------------------------------------
#include advpath.inc
#event SkillTrivial "#*#You can no longer advance your skill from making this item#*#"
#event SkillUp "#*#You have become better at#*#"
#event SkillFailure "#*#You lacked the skills#*#"
#event SkillSuccess "#*#You have fashioned the items together to create something new#*#"
#event FullInventory "#*#There was no place to put that#*#"
#event InUse "#*#Someone else is using that. Try again later.#*#"
#chat tell
Sub Main
/declare Failure int outer 0
/declare Success int outer 0
/declare SkillUps int outer 0
/declare Destroy int outer
/declare Reply int outer
/declare ReplyMessage string outer
/declare Skip int outer
/declare SkillAlert int outer
/varset Destroy ${Param0}
/varset Reply ${Param1}
/varset ReplyMessage ${Param2}
/varset Skip ${Param3}
/varset SkillAlert ${Param4}
|------------------------------------------------
| AdvPath Initialization.
|------------------------------------------------
/call InitAPFVars 1 15 20
/call SilentFunction
|------------------------------------------------
| Macro Initialization.
|------------------------------------------------
/if (${Skip}) {
/echo Skipping straight to the Combine Portion of the Macro.
}
/if (${Destroy}) {
/echo All results from the Combine will be Destroyed.
}
/if (${Reply}) {
/echo Will Auto-Reply to Incoming Tells.
/echo Reply Message : ${ReplyMessage}
}
/if (${SkillAlert}) {
/echo Alerting and Exiting Macro when Brewing Skill reaches 200.
}
|------------------------------------------------
| Skip to Combine Check.
|------------------------------------------------
/if (${Skip}) /goto :Combine
:MainLoop
/doevents
/call GMCheck
|------------------------------------------------
| Walk to the Short Beer Merchant.
|------------------------------------------------
/call PlayFunction "to_short_beer 1 cf nopp noz"
/call WaitTilThere
|------------------------------------------------
| Buy the Short Beers(2 stacks).
|------------------------------------------------
/target Bilkel
/click right target
/delay 1s
/call BuyStack 1
/delay 1s
/call BuyStack 1
/delay 1s
/keypress esc
/keypress esc
|------------------------------------------------
| Walk to Cask, Malt, Yeast Merchant.
|------------------------------------------------
/call PlayFunction "short_beer_to_cask_malt_yeast 1 cf nopp noz"
/call WaitTilThere
|------------------------------------------------
| Buy the Casks(1 stack), Malts(3 stacks), and Yeasts(1 stack).
|------------------------------------------------
/target Lander
/click right target
/delay 1s
/call BuyStack 10
/delay 1s
/call BuyStack 4
/delay 1s
/call BuyStack 4
/delay 1s
/call BuyStack 4
/delay 1s
/call BuyStack 5
/delay 1s
/keypress esc
/keypress esc
|------------------------------------------------
| Walk to Water Flash Merchant.
|------------------------------------------------
/call PlayFunction "cask_malt_yeast_to_water 1 cf nopp noz"
/call WaitTilThere
|------------------------------------------------
| Buy the Water Flasks(2 stacks).
|------------------------------------------------
/target Sanderson
/click right target
/delay 1s
/call BuyStack 6
/delay 1s
/call BuyStack 6
/delay 1s
/keypress esc
/keypress esc
|------------------------------------------------
| Walk to Brew Barrel and Do Combines.
|------------------------------------------------
/call PlayFunction "water_to_barrel 1 cf nopp noz"
/call WaitTilThere
:Combine
/call DoCombine ${Destroy}
|------------------------------------------------
| Walk to Starting Point.
|------------------------------------------------
/call PlayFunction "barrel_to_start 1 cf nopp noz"
/call WaitTilThere
/goto :MainLoop
/endmacro
|---------------------------------------------------
| SUB: Do the Comines
|---------------------------------------------------
Sub DoCombine(int Destroy)
/declare iSlot int local
/declare Counter int local
/doevents
|------------------------------------------------
| Open Brew Barrel.
|------------------------------------------------
/itemtarget Brew Barrel
/face item
/click left item
/delay 2s
/notify COMBW_ContainerArea ExperimentButton leftmouseup
|------------------------------------------------
| Clear Out Brew Barrel.
|------------------------------------------------
/echo Cleaning Out Brew Barrel...
/for iSlot 1 to 10
/shiftkey /itemnotify enviro${iSlot} leftmouseup
/if (${Cursor.ID}) {
/destroy
}
/next iSlot
|------------------------------------------------
| Open Inventory Window.
|------------------------------------------------
/if (${Window[Inventory].Open}==FALSE) {
/windowstate inventory open
}
|------------------------------------------------
| Open All 8 Packs.
|------------------------------------------------
/for iSlot 1 to 8
/if (${Window[Pack${iSlot}].Open}==FALSE) {
/itemnotify pack${iSlot} rightmouseup
}
/next iSlot
|------------------------------------------------
| Make Heros Brew.
|------------------------------------------------
/echo Making Heroes Brew NOW...
:MakeBrew
/doevents
/call GMCheck
/if (${FindItem[Water].InvSlot}==NULL) /goto :Done
/ctrl /itemnotify ${FindItem[=Water Flask].InvSlot} leftmouseup
/delay 2
/itemnotify enviro1 leftmouseup
/delay 2
/if (${FindItem[Water].InvSlot}==NULL) /goto :Done
/ctrl /itemnotify ${FindItem[=Water Flask].InvSlot} leftmouseup
/delay 2
/itemnotify enviro2 leftmouseup
/delay 2
/if (${FindItem[Short].InvSlot}==NULL) /goto :Done
/ctrl /itemnotify ${FindItem[Short Beer].InvSlot} leftmouseup
/delay 2
/itemnotify enviro3 leftmouseup
/delay 2
/if (${FindItem[Short].InvSlot}==NULL) /goto :Done
/ctrl /itemnotify ${FindItem[Short Beer].InvSlot} leftmouseup
/delay 2
/itemnotify enviro4 leftmouseup
/delay 2
/if (${FindItem[Malt].InvSlot}==NULL) /goto :Done
/ctrl /itemnotify ${FindItem[Malt].InvSlot} leftmouseup
/delay 2
/itemnotify enviro5 leftmouseup
/delay 2
/if (${FindItem[Malt].InvSlot}==NULL) /goto :Done
/ctrl /itemnotify ${FindItem[Malt].InvSlot} leftmouseup
/delay 2
/itemnotify enviro6 leftmouseup
/delay 2
/if (${FindItem[Malt].InvSlot}==NULL) /goto :Done
/ctrl /itemnotify ${FindItem[Malt].InvSlot} leftmouseup
/delay 2
/itemnotify enviro7 leftmouseup
/delay 2
/if (${FindItem[Yeast].InvSlot}==NULL) /goto :Done
/ctrl /itemnotify ${FindItem[Yeast].InvSlot} leftmouseup
/delay 2
/itemnotify enviro8 leftmouseup
/delay 2
/if (${FindItem[Cask].InvSlot}==NULL) /goto :Done
/ctrl /itemnotify ${FindItem[Cask].InvSlot} leftmouseup
/delay 2
/itemnotify enviro9 leftmouseup
/delay 2
/combine enviro
/delay 2
|------------------------------------------------
| Waiting for Combine to Finish.
|------------------------------------------------
:WaitCombine
/if (!${Cursor.ID}) {
/goto :WaitCombine
}
|------------------------------------------------
| Clearing the Cursor.
|------------------------------------------------
:ClearCursor
/if (${Destroy}) {
/destroy
} else {
/autoinventory
}
/delay 2
/if (!${Cursor.ID}) {
/goto :MakeBrew
} else {
/goto :ClearCursor
}
|------------------------------------------------
| Done with Making Brew.
|------------------------------------------------
:Done
/echo Done with this round of Brewing, moving on...
/for Counter 1 to 9
/keypress ESC
/next Counter
/keypress ESC
/keypress ESC
/return
|--------------------------------------------------
| SUB: Buy a Stack of Passed Item
|--------------------------------------------------
Sub BuyStack(int SlotNumber)
/itemnotify Merchant${SlotNumber} leftmouseup
/delay 1s
/buyitem 20
/delay 1s
/return
|--------------------------------------------------
| SUB: Buy a Stack of Passed Item
|--------------------------------------------------
Sub GMCheck
/if (${Spawn[gm].ID}) {
/beep
/beep
/beep
/echo GM has entered the zone!
/echo FUCK HIM but ending the macro...
/keypress forward
/keypress back
/quit
/endmacro
}
/return
|--------------------------------------------------
| SUB: AdvPath Waiting Function
|--------------------------------------------------
Sub WaitTilThere
:LoopTilThere
/if (${PathingFlag}) {
/call AdvPathPoll
/delay 0
/doevents
/goto :LoopTilThere
}
/return
|--------------------------------------------------
| EVENT: Skillup Event
|--------------------------------------------------
Sub Event_SkillUp
/varcalc SkillUps ${SkillUps}+1
/echo *********************************
/echo Your Brewing Skill has Increased!
/echo Brewing : ${Me.Skill[Brewing]}
/echo *********************************
/if (${Me.Skill[Brewing]}==200 && ${SkillAlert}) {
/echo Skill Alert Level Reached! (200)
/echo Ending Macro...
/for Counter 1 to 9
/keypress ESC
/next Counter
/keypress ESC
/keypress ESC
/endmacro
}
/return
|--------------------------------------------------
| EVENT: Trivial Event
|--------------------------------------------------
Sub Event_SkillTrivial
/echo Your Brewing Skill can no longer increase from this macro!
/echo Ending Macro...
/for Counter 1 to 9
/keypress ESC
/next Counter
/keypress ESC
/keypress ESC
/endmacro
/return
|--------------------------------------------------
| EVENT: Success Event
|--------------------------------------------------
Sub Event_SkillSuccess
/varcalc Success ${Success}+1
/echo Success Count : ${Success}
/return
|--------------------------------------------------
| EVENT: Failure Event
|--------------------------------------------------
Sub Event_SkillFailure
/varcalc Failure ${Failure}+1
/echo Failure Count : ${Failure}
/return
|--------------------------------------------------
| EVENT: Brew Barrel In Use Event
|--------------------------------------------------
Sub Event_InUse
/echo Container busy. Retrying in 5 seconds...
/delay 5s
/call DoCombine(${Destroy})
/return
|--------------------------------------------------
| EVENT: Tell Received Event
|--------------------------------------------------
Sub Event_Chat(ChatType,Sender,ChatText)
/if (${Sender.Equal[Bilkel Biddinight]}) {
/return
}
/if (${Sender.Equal[Lander Furthers]}) {
/return
}
/if (${Sender.Equal[Sanderson]}) {
/return
}
/if (${Sender.Equal[Merchant]}) {
/return
}
/beep
/beep
/if (${Reply}) {
/reply ${ReplyMessage}
} else {
/echo **************************************
/echo Received a Tell From : ${Sender}
/echo Pausing Macro...
/echo Type /mqpause to Resume...
/echo **************************************
/keypress DOWN HOLD
/keypress DOWN
/mqpause
}
/return