Diamond.mac -- Stable bard chant-kiting script

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

Moderator: MacroQuest Developers

NBarnes
orc pawn
orc pawn
Posts: 19
Joined: Wed Jan 28, 2004 10:46 pm

Post by NBarnes » Mon Apr 12, 2004 11:44 pm

bonehand:

I tried removing the /look -90 calls in the original macro so that it wouldn't face the ground, but that didn't fix it. The other difference I see between the original and your code is the nolook parameter to /face. This parameter seems to be undocumented, what does it do?

Zeit
a lesser mummy
a lesser mummy
Posts: 34
Joined: Sat Jan 24, 2004 5:54 am

Post by Zeit » Thu Apr 15, 2004 3:59 pm

Having trouble with any mecro that moves you (even the follow macro that is included with MQ) since the patch. Let me clarify all the information I have

My arrow keys used to move me forward back etc

right arrow strafes me left
left arrow strafes me right
forward turns me right
backward turns me left

now the keys to move me are in the numberpad for some reason, end result

start macro: she moves in circles while getting beat to a pulp until dead

anyone else having keyboard issues with this patch? or can tell me how to remap my keyboard ;( i see no options in EQ for where to put strafe and such this has essentially broken every macro that includes moving for me. Any help is appreciated other wise im back to tryin to figure it out ;)

Zeit
a lesser mummy
a lesser mummy
Posts: 34
Joined: Sat Jan 24, 2004 5:54 am

Post by Zeit » Thu Apr 15, 2004 5:37 pm

fixed by downloading the latest zip not sure what the prob was but im off to tryin to figure out the best settings for hoh

ifritx
decaying skeleton
decaying skeleton
Posts: 8
Joined: Fri Apr 23, 2004 9:35 am

can you guys tell me what i am doing wrong here?

Post by ifritx » Fri Apr 23, 2004 9:36 am

Code: Select all

#turbo 
#chat tell 

Sub Main 
   /zapvars 

   | These variables are related to movement and AI control. 
   /declare RubberX global 
   /declare RubberY global 
   /varset RubberX @Param1 
   /varset RubberY @Param0 

   | These variables are related to song-twisting. 
   /declare SongTimer timer 
   /declare Songs array 
   /declare CurSong global 
   /declare PrevSong global 
   /declare nSongs global 
   /declare EachSong local 



   | This block of code checks for proper arguments and echos error or initialization messages. 
   /if (${defined[Param6]}==false) { 
      /echo Usage: /mac Diamond <Y> <X> <North> <South> <East> <West> <Song list> 
      /echo <Y>         -- Y-coordinate of the center point. 
      /echo <X>         -- X-coordinate of the center point. 
      /echo <North>     -- Maximum distance north of the center point to travel. 
      /echo <South>     -- Maximum distance south of the center point to travel. 
      /echo <East>      -- Maximum distance east of the center point to travel. 
      /echo <West>      -- Maximum distance west of the center point to travel. 
      /echo <Song list> -- List of songs to be sung, include Selo's if needed. 
      /endm 
   } 



   | This block of code sorts out the list of songs to be twisted while running. 
   /varset nSongs (${strlen[@Param6]}) 
   /for EachSong 1 to @nSongs 
      /varset Songs(@EachSong) (${mid(${calc(@EachSong-1)},1,@Param6)}) 
      /echo Song @EachSong: (${char(gem,@Songs(@EachSong))}) 
   /next EachSong 
   /varset CurSong 1 
   /call Event_Timer 
   /echo Running a diamond path with center at @RubberY, @RubberX and chant-kiting mobs. 



   | The main loop, this iterates unless some AI warning is reached. 
   /sendkey down up 
   :ChantLoop 

   | Face the correct corner of the diamond, given character's current position. 
   /if (n ${char(x)<@RubberX} && n ${char(y)>@RubberY)} /face fast loc @RubberY,${calc(@RubberX-@Param4)} 
   /look -90 
   /if (n ${char(x)<@RubberX} && n ${char(y)<@RubberY)} /face fast loc ${calc(@RubberY-@Param3),@RubberX} 
   /look -90 
   /if (n ${char(x)>@RubberX} && n ${char(y)<@RubberY)} /face fast loc @RubberY,${calc(@RubberX+@Param5)} 
   /look -90 
   /if (n ${char(x)>@RubberX} && n ${char(y)>@RubberY)} /face fast loc $calc(@RubberY+@Param2),@RubberX} 
   /look -90 

   | Sing songs. 
   /doevents 
   /if (${char[casting]==FALSE}) { 
      /varset CurSong @PrevSong 
      /call Event_Timer 
   } 

   | Get a new target if the current one is no good. 
   /if (n ${target[id]}==0) /call GetTarget 
   /if (n ${target[name]}~~"corpse" /call GetTarget 
   /if (n ${target[type]}=="PC" /call GetTarget 

   /goto :ChantLoop 

/return 

Sub Event_Timer(TimerName) 
      /delay 2 
      /stopsong 
      /cast @Songs(@CurSong) 
      /varset PrevSong @CurSong 
      /varset SongTimer 30 
      /varadd CurSong 1 
      /if n @CurSong>@nSongs /varset CurSong 1 
/return 

Sub GetTarget 
   /if (n ${searchspawn[npc.radius:200]>0} /target npc radius 200 
   /if (n ${target[level]}>66) /press esc 
   /if (n ${target[range]}>200) /press esc 
/return
&#91;code&#93;&#91;/code&#93;

nald
orc pawn
orc pawn
Posts: 15
Joined: Sat Dec 20, 2003 9:30 am

Post by nald » Sat Apr 24, 2004 3:54 am

I think part of the problem is stated here by Lax.
http://macroquest2.com/phpBB2/viewtopic ... ht=defined

So I think
/if (${defined[Param6]}==false) {

Should be like this since it is case sensitive
/if (${Defined[Param6]}==false) {

But when I change it I just get a different messsage.

CCommandHook::Detour(/mac diamond 500.22 1528.36 50 50 50 50 68)

Macro - Loading macro: D:\games\MQ2-Latest\Release\Macros\diamond.mac

Macro - Starting macro with '/call Main 500.22 1528.36 50 50 50 50 68'

WriteChatColor(Cleared the following: Timers Vars Arrays)

WriteChatColor(Failed to parse /if condition '(TRUE==false)', non-numeric encountered)

WriteChatColor(Ending macro: {)

WriteChatColor(diamond.mac@24 (Main): /if (${Defined[Param6]}==false) {)

WriteChatColor(Cleared the following: Timers Arrays)

WriteChatColor(The current macro has ended.)

icehouse33
orc pawn
orc pawn
Posts: 12
Joined: Mon Dec 15, 2003 8:34 am

try this

Post by icehouse33 » Sat Apr 24, 2004 4:01 am

Code: Select all

/if (!${Defined[Parm6}) {

nald
orc pawn
orc pawn
Posts: 15
Joined: Sat Dec 20, 2003 9:30 am

Post by nald » Sat Apr 24, 2004 4:44 am

OK now the messages is:
WriteChatColor(Unmatched bracket found in index: 'Parm6')

But I can not find the missing bracket.

Full error message below:

CCommandHook::Detour(/mac diamond 500.22 1528.36 50 50 50 50 68)

Macro - Loading macro: D:\games\MQ2-Latest\Release\Macros\diamond.mac

Macro - Starting macro with '/call Main 500.22 1528.36 50 50 50 50 68'

WriteChatColor(Cleared the following: Timers Vars Arrays)

WriteChatColor(Unmatched bracket found in index: 'Parm6')

WriteChatColor([MQ2] Usage: /mac Diamond <Y> <X> <North> <South> <East> <West> <Song list>)

WriteChatColor([MQ2] <Y> -- Y-coordinate of the center point.)

WriteChatColor([MQ2] <X> -- X-coordinate of the center point.)

WriteChatColor([MQ2] <North> -- Maximum distance north of the center point to travel.)

WriteChatColor([MQ2] <South> -- Maximum distance south of the center point to travel.)

WriteChatColor([MQ2] <East> -- Maximum distance east of the center point to travel.)

WriteChatColor([MQ2] <West> -- Maximum distance west of the center point to travel.)

WriteChatColor([MQ2] <Song list> -- List of songs to be sung, include Selo's if needed.)

WriteChatColor(Cleared the following: Timers Arrays)

WriteChatColor(The current macro has ended.)

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

Re: try this

Post by ml2517 » Sat Apr 24, 2004 7:06 am

icehouse33 wrote:

Code: Select all

/if (!${Defined[Parm6}) {
Should be:

Code: Select all

/if (!${Defined[Param6]}) {
Last edited by ml2517 on Sat Apr 24, 2004 7:17 am, edited 1 time in total.

Preocts
a snow griffon
a snow griffon
Posts: 312
Joined: Thu Jan 29, 2004 1:02 pm

Post by Preocts » Sat Apr 24, 2004 7:15 am

I think you meant

Code: Select all

/if (!${Defined[Param6]}) {
:wink:

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

Post by ml2517 » Sat Apr 24, 2004 7:17 am

LOL yep.

theoneandonly
orc pawn
orc pawn
Posts: 26
Joined: Sun Apr 11, 2004 6:39 pm

Post by theoneandonly » Sat Apr 24, 2004 9:46 am

All credit to a bard I know, he coded this himself. Works perfectly fine for us. Tested 20+ hours so far. no problems

Code: Select all

#turbo 
#chat tell

#event Zoned "You have entered"
#event StatusReport "status report"
#event GainExp "You gain"

Sub Main 
   /zapvars 

   | These variables are related to movement and AI control. 
   /declare RubberX global 
   /declare RubberY global 
   /declare StopMe global 
   /declare StopTimer timer 
   /declare ProximityTimer timer 
   /varset RubberX @Param1 
   /varset RubberY @Param0 
   /varset StopMe 0 
   /varset ProximityTimer 1m 

   | These variables are related to song-twisting. 
   /declare SongTimer timer 
   /declare Songs array 
   /declare CurSong global 
   /declare PrevSong global 
   /declare nSongs global 
   /declare EachSong local 

   | Experience & Time Variables
   /declare CurrentExp global
   /declare CurrentAAXP global
   /declare CurrentTime global
   /varset CurrentExp ${Me.PctExp}
   /varset CurrentAAXP ${Me.PctAAExp}
   /varset CurrentTime ${Math.Calc[${Macro.RunTime}/60]}

   | This block of code checks for proper arguments and echos error or initialization messages. 
   /if (!${Defined[Param7]}) { 
      /echo Usage: /mac Chant <Y> <X> <North> <South> <East> <West> <Song list> <TooClose> 
      /echo <Y>         -- Y-coordinate of the center point. 
      /echo <X>         -- X-coordinate of the center point. 
      /echo <North>     -- Maximum distance north of the center point to travel. 
      /echo <South>     -- Maximum distance south of the center point to travel. 
      /echo <East>      -- Maximum distance east of the center point to travel. 
      /echo <West>      -- Maximum distance west of the center point to travel. 
      /echo <Song list> -- List of songs to be sung, include Selo's if needed. 
      /echo <TooClose   -- Distance at which non-friendly players halt kiting. 
      /endmacro
   } 



   | This block of code sorts out the list of songs to be twisted while running. 
   /varset nSongs ${String[@Param6].Length}
   /for EachSong 1 to @nSongs 
      /varset Songs(@EachSong) ${String[@Param6].Mid[${Math.Calc[@EachSong]},1]}
      /echo Song @EachSong: ${Me.Gem[@Songs(@EachSong)]}
   /next EachSong 
   /varset CurSong 1 
   /call Event_Timer 
   /echo Running a diamond path with center at @RubberY, @RubberX and chant-kiting mobs. 



   | The main loop, this iterates unless some AI warning is reached. 
   /keypress autorun
   :ChantLoop 
   | Face the correct corner of the diamond, given character's current position. 
   /if (${Me.X}<@RubberX && ${Me.Y}>@RubberY) /face fast loc @RubberY,${Math.Calc[@RubberX-@Param4]}
   /look -90 
   /if (${Me.X}<@RubberX && ${Me.Y}<@RubberY) /face fast loc ${Math.Calc[@RubberY-@Param3]},@RubberX 
   /look -90 
   /if (${Me.X}>@RubberX && ${Me.Y}<@RubberY) /face fast loc @RubberY,${Math.Calc[@RubberX+@Param5]}
   /look -90 
   /if (${Me.X}>@RubberX && ${Me.Y}>@RubberY) /face fast loc ${Math.Calc[@RubberY+@Param2]},@RubberX 
   /look -90 

   | Do stuff if not in a holding phase. 
   /if (@StopMe==0) { 
      /doevents 
      /if (!${Me.Casting.ID}) { 
         /varset CurSong @PrevSong 
         /call Event_Timer 
      } 
      | If a GM zones in, shut down for 30 minutes. 
      /if (${Spawn[gm].ID}) { 
         /echo GM detected in zone, going into standby at $time(h):$time(m):$time(s). 
         /g GM detected in zone, going into standby at $time(h):$time(m):$time(s). 
         /stopsong 
         /varset StopMe 1 
         /varSet StopTimer 200 
      } 

      /if (@ProximityTimer<100) { 
         | If an ungrouped PC comes within specified range, shut down until they leave. 
         /if (${Spawn[pc noalert 1 radius @Param7].ID}) { 
            /echo ${Spawn[pc noalert 1 radius @Param7].CleanName} is inside @Param7 ft., going into standby at ${Time.Time12}. 
            /g ${Spawn[pc noalert 1 radius @Param7].CleanName} is inside @Param7 ft., going into standby at ${Time.Time12}. 
            /stopsong 
            /varset StopMe 2 
            /varset StopTimer 200 
         } 
         /varadd ProximityTimer 1m 
      } 

      | Get a new target if the current one is no good. 
      /if (!${Target.ID}) /call GetTarget 
      /if (${Target.Name.Find[corpse]}) /call GetTarget 
      /if (${Target.Type.Equal[PC]}) /call GetTarget 
   } 

   | Quit the ChantLoop and go into a holding phase if criteria are met. 
   /if (@StopTimer<10 && @StopMe>0) /goto :StopStuff 
   /goto :ChantLoop 



   | This block of code is operations to perform before going into the standby loop. 
   :StopStuff 
   | Face the far corner, stop moving and Fade Memories. 
   /stopsong 
   /face fast heading 135 
   /delay 10 
   /keypress back
   /alt activate 212    

   | If a GM is in zone, set a timer for 30 minutes. 
   /if (@StopMe==1) { 
      /varset StopTimer 18000 
   } 
   | If someone came within specified range, set a timer for 5 minutes. 
   /if (@StopMe==2) { 
      /varset StopTimer 1m 
   } 



   | This loop (StopLoop) waits for 30 minutes after a GM zones in to restart 
   | or until no ungrouped PCs are within specified range. 
   :StopLoop 
   /if (@StopMe==1) { 
      /if (@StopTimer==0) { 
         /echo It's been 30 minutes since a GM was sighted, resuming chant-kiting at ${Time.Time12}. 
         /g It's been 30 minutes since a GM was sighted, resuming chant-kiting at ${Time.Time12}. 
         /varset StopMe 0 
         /keypress autorun
         /goto :ChantLoop 
      } 
   } 
   /if (@StopMe==2) { 
      /if (@StopTimer>0 && ${Me.CurrentMana}>1000) { 
         /if (!${Spawn[pc noalert 1 radius @Param7].ID}) { 
            /echo No PCs within @Param7 ft., resuming chant-kiting at ${Time.Time12}. 
            /g No PCs within @Param7 ft., resuming chant-kiting at ${Time.Time12}. 
            /varset StopMe 0 
            /keypress autorun 
            /goto :ChantLoop 
         } else { 
            /varset StopTimer 1m 
         } 
      } 
   } 
   /goto :StopLoop 
/return 

Sub Event_Chat(ChatType,Sender,ChatText) 
   /declare MyMob local 
   /varset MyMob $target(id) 
   /if (${String[@ChatText].Lower.Equal[group me]}) { 
      /target range 1 22000 @Sender 
      /if (${Group}<6) { 
         /tell @Sender I'm kiting at ${Me.Y}, ${Me.X} -- come join me. 
         /invite
         /alert add 1 pc @Sender 
      } else { 
         /tell @Sender My group is full right now, try back later! 
         /alert add 1 pc @Sender 
      } 
   }
   /if (${String[@ChatText].Lower.Equal[status report]}) {
      /tell @Sender TARGET: ${Target.CleanName} (${Target.PctHPs}%) SELF: ${Me.Name} (${Me.PctHPs}%) EXP: ${Me.Level} (${Me.PctExp}%) AAXP: ${Me.AAPoints} (${Me.PctAAExp}%)
   }
    
   /target npc range 1 200 id @MyMob 
/return 

Sub Event_Timer(TimerName) 
      /delay 2 
      /stopsong 
      /cast @Songs(@CurSong)
      /varset PrevSong @CurSong 
      /varset SongTimer 30 
      /varadd CurSong 1 
      /if (@CurSong>@nSongs) /varset CurSong 1 
/return 

Sub GetTarget 
   /if (${Spawn[npc radius 200].ID}) /target npc radius 200 
   /if (${Target.Level}<7) /keypress esc
   /if (${Target.Distance}>200) /keypress esc 
/return 

Sub Event_Zoned
   /sit
   /camp desktop
   /endmacro
/return

Sub Event_StatusReport
	/declare LoopCounter local
	/declare GroupMembers local
	/varset GroupMembers ""

	/for LoopCounter 0 to ${Math.Calc[${Group}-1]}
	/varcat GroupMembers ${Group[@LoopCounter].Name}
	/varcat GroupMembers " "
	/next LoopCounter

      /echo TARGET: ${Target.CleanName} (${Target.PctHPs}%)
	/echo SELF: ${Me.Name} (${Me.PctHPs}%)
	/echo EXP: ${Me.Level} (${Me.PctExp}%)
	/echo AAXP: ${Me.AAPoints} (${Me.PctAAExp}%)
	/echo GROUP: @GroupMembers
	/echo RUNTIME: ${Math.Calc[${Macro.RunTime}/60]}
/return

Sub Event_GainExp
	/varset CurrentExp ${Math.Calc[${Me.PctExp}-@CurrentExp]}
	/varset CurrentAAXP ${Math.Calc[${Me.PctAAExp}-@CurrentAAXP]}
	/varset CurrentTime ${Math.Calc[${Math.Calc[${Macro.RunTime}/60]}-@CurrentTime]}

	/echo EXP: ${Me.PctExp}% (@CurrentExp%) AAXP: ${Me.PctAAExp}% (@CurrentAAXP%) TIME: ${Math.Calc[${Macro.RunTime}/60]} (@CurrentTime)

	/varset CurrentExp ${Me.PctExp}
	/varset CurrentAAXP ${Me.PctAAExp}
	/varset CurrentTime ${Math.Calc[${Macro.RunTime}/60]}
/return

Bardpowa
decaying skeleton
decaying skeleton
Posts: 3
Joined: Thu Apr 22, 2004 2:22 pm

Works so far

Post by Bardpowa » Sat Apr 24, 2004 12:00 pm

tested it out just a few moments ago... seems to work fairly nicely.. Will post if i get any problems etc.. but Definatly nice work =)

Bardmad
a lesser mummy
a lesser mummy
Posts: 36
Joined: Mon Apr 05, 2004 4:55 am

Newbie

Post by Bardmad » Sun Apr 25, 2004 11:15 am

i tried to read the initial, but just couldnt understand, especially on <x> and <y>, can someone write a example? Laugh out all u want, i admit i'm programming idiot. :)

nald
orc pawn
orc pawn
Posts: 15
Joined: Sat Dec 20, 2003 9:30 am

Post by nald » Sun Apr 25, 2004 12:14 pm

This is working for me

(/mac diamond 500.22 1528.36 50 50 50 50 68 10

The instructions where.

/echo Usage: /mac Chant <Y> <X> <North> <South> <East> <West> <Song list> <TooClose>

So I went to the spot I wanted as the center did a /loc then took the 1st and 2nd numbers as Y and X the made a square of 50 50 50 50

The songs twisted are 68 no spaces the number of songs twisted can be longer say 812341234 if 8 where your selos song and 1234 where your dots. This is what I used once and it worked well.

Then if another player gets with in 10 feet the macro stops. Not sure if you can set this to zero but I would think you could and that would basical disably it.

The problem I have is when it starts he looks at his feet and I have to us F9 and go to a camera view to see whats going on :)

Bardmad
a lesser mummy
a lesser mummy
Posts: 36
Joined: Mon Apr 05, 2004 4:55 am

Post by Bardmad » Sun Apr 25, 2004 6:46 pm

thanx alot nald...