Scatter toons about a point

A forum for macro code snippets to be used in writing other macros. Post routines or .inc files here only, completed macros go to the Macro Depot. MQ2Data format only!

Moderator: MacroQuest Developers

methodx
a lesser mummy
a lesser mummy
Posts: 37
Joined: Mon Jan 16, 2006 10:57 am

Scatter toons about a point

Post by methodx » Sun Jul 23, 2006 12:02 pm

Here is a little snippet I wrote that will scatter your toons around a point. Could easily be modified to set a particular spot as camp and then after a mob has died to return to a random spot around that point. This will also face your toons in a similiar but not equal direction... convincing eh!?!

/echo Activate to start the scattering.
I would reccomend changing the /gsay to whatever communiction method you use, e.g. irc/eqbc

Code: Select all

#event SetSpot "#*#scatter y#1# x#2# facing#3#end#*#"
#event face "Arrived at MoveTo location"
#event activate "#*#activate#*#"

Sub main
/declare faceang int outer
/declare MAXrange int outer 80
/declare randrange int outer
/declare randangle int outer
/declare gotoX int outer
/declare gotoY int outer

:mainloop
		/doevents
/goto :mainloop
/return

Sub event_SetSpot(Line,locy,locx,ang)
		/varset faceang ${ang}
		/varset randrange ${Math.Rand[${MAXrange}]}
		/varset randangle ${Math.Rand[360]}
		/varset gotoX ${Math.Calc[${locx}+${Math.Calc[${randrange}*${Math.Cos[${randangle}]}]}]}
		/varset gotoY ${Math.Calc[${locy}+${Math.Calc[${randrange}*${Math.Sin[${randangle}]}]}]}
		/moveto loc ${gotoY} ${gotoX}
/return

Sub event_face
		/face Heading ${Math.Calc[360-${faceang}-${Math.Rand[30]}]}
/return

Sub event_activate
		/gsay scatter y${Me.Y} x${Me.X} facing${Me.Heading.Degrees}end
/return

User avatar
fearless
Not a Psychic
Posts: 2684
Joined: Wed Mar 10, 2004 3:52 pm

Post by fearless » Sun Jul 23, 2006 10:59 pm

Very slick, nice work.
Reading . . . it's not just for me.

[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
[quote="Ccomp5950"]Fearless showed me the light, you too shall learn.[/quote]

methodx
a lesser mummy
a lesser mummy
Posts: 37
Joined: Mon Jan 16, 2006 10:57 am

Follow scattered

Post by methodx » Mon Jul 24, 2006 8:00 am

Here is another snippet I have written that incorporates the scatter around a point code. The idea being that the toons will look as though they are being controlled by humans at first glance; as they will follow you loosely, matching your heading and not drifting off too far, and then coming to rest at a point near you.

I havent fully decided if this is a good thing or not... because if people determine that your characters are being played by one person - well then its fairly obvious that your macro'ing because there is no way that a person with only 2 hands could control 6+ characters to such a degree. However, when people see 5 toons all standing on top of each other following another toon, they probably think MQ'er anyway.

If you're standing beside a zone line, dont start the script off because your toons could go through the zone line... if the script is running though it seems to follow through zones though with no problems. Running backwards just messes with your toons because they will try to face the same direction as you so try to avoid it, and strafing doesnt really help either. Not tested indoors.

To activate type >>> /bc follow [charname]. <<<
Or use groupsay, irc, whatever. Don't forget the fullstop.

Code: Select all

#event follow "#*#follow #1#.#*#"
#event face "Arrived at MoveTo location"

sub main
/declare folperson string outer
/declare faceang int outer
/declare MAXrange int outer 30
/declare randrange int outer
/declare randangle int outer
/declare gotoX int outer
/declare gotoY int outer
/declare lastX int outer
/declare lastY int outer
/declare melastX int outer
/declare melastY int outer
/declare loctimer timer outer
/declare gotspot bool outer false
/declare movefinished bool outer false
/declare havefaced bool outer TRUE
:mainloop
/doevents
/goto :mainloop
/return

Sub Event_follow(Line,person)
/varset folperson ${person} PC
/call SetSpot
/moveto off
/moveto loc ${gotoY} ${gotoX}
:waitformove1
/doevents
/if (${movefinished}) {
		/goto :followloop
		/varset movefinished FALSE
}
/goto :waitformove1
:followloop
/doevents
/if (${Spawn[${folperson}].Distance}>40 && ${Spawn[${folperson}].Distance}<80 && !${gotspot}) {
		/keypress forward hold
		/if (${Spawn[${folperson}].Heading.Degrees}>${Math.Calc[${Me.Heading.Degrees}+10]} || ${Spawn[${folperson}].Heading.Degrees}<${Math.Calc[${Me.Heading.Degrees}-10]} && ${Spawn[${folperson}].Distance}<100) {
				/face Heading ${Math.Calc[${Spawn[${folperson}].Heading.DegreesCCW}+${Math.Rand[15]}]}
		}
}
/if (${Spawn[${folperson}].Distance}>80 && !${gotspot}) {
		/face Heading ${Spawn[${folperson}].HeadingTo.DegreesCCW}
		/if (${gotspot}) /varset gotspot false
		/keypress forward hold
}
/if (${Spawn[${folperson}].Distance}<20 && !${gotspot}) /keypress forward
/if (${loctimer}<1) {
		/varset lastX ${Spawn[${folperson}].X.Int}
		/varset lastY ${Spawn[${folperson}].Y.Int}
		/varset melastX ${Me.X.Int}
		/varset melastY ${Me.Y.Int}
		/varset loctimer 15
		/delay 8
}
/if (${Spawn[${folperson}].X.Int}==${lastX} && ${Spawn[${folperson}].Y.Int}==${lastY} && !${gotspot}) /call SetSpot
/if (${Spawn[${folperson}].X.Int}!=${lastX} && ${Spawn[${folperson}].Y.Int}!=${lastY} && ${gotspot}) /varset gotspot FALSE
/if (${Math.Distance[${gotoY},${gotoX}]}>15 && ${gotspot}) {
		/keypress forward hold	
		/face Heading ${Me.HeadingToLoc[${gotoY},${gotoX}].DegreesCCW}
}
/if (${Math.Distance[${gotoY},${gotoX}]}<35 && ${gotspot}) {
		/keypress forward
		/if (${Me.X.Int}==${melastX} && ${Me.Y.Int}==${melastY} && !${havefaced} ) {
				/face Heading ${faceang}
				/delay ${Math.Rand[20]}
		}
}
/goto :followloop
/return

Sub SetSpot
		/varset faceang ${Math.Calc[${Spawn[${folperson}].Heading.DegreesCCW}+${Math.Rand[30]}]}
		/varset randrange ${Math.Rand[${MAXrange}]}
		/varset randangle ${Math.Rand[360]}
		/varset gotoX ${Math.Calc[${Spawn[${folperson}].X}+${Math.Calc[${randrange}*${Math.Cos[${randangle}]}]}]}
		/varset gotoY ${Math.Calc[${Spawn[${folperson}].Y}+${Math.Calc[${randrange}*${Math.Sin[${randangle}]}]}]}
		/varset gotspot TRUE
		/varset havefaced FALSE
/return

Sub event_face
		/face Heading ${Math.Calc[${faceang}-${Math.Rand[30]}]}
		/delay 1s
		/varset movefinished TRUE
/return

toomanynames
a grimling bloodguard
a grimling bloodguard
Posts: 1844
Joined: Mon Apr 11, 2005 11:10 am

Post by toomanynames » Thu Jul 27, 2006 2:53 am

This and your food/drink snips are great, I plan to add these to modbot, anxious to get back in town so I can play with them, they seem like a great addition to about any macro!!

Nice work indeed!
[quote="DKAA"]You cant. Only the server knows.[/quote]

xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Scatter toons about a point

Post by xyilla » Tue Jul 22, 2025 1:12 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Scatter toons about a point

Post by xyilla » Tue Jul 22, 2025 1:13 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Scatter toons about a point

Post by xyilla » Tue Jul 22, 2025 1:14 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Scatter toons about a point

Post by xyilla » Tue Jul 22, 2025 1:16 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Scatter toons about a point

Post by xyilla » Tue Jul 22, 2025 1:17 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Scatter toons about a point

Post by xyilla » Tue Jul 22, 2025 1:18 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Scatter toons about a point

Post by xyilla » Tue Jul 22, 2025 1:55 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Scatter toons about a point

Post by xyilla » Tue Jul 22, 2025 1:56 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Scatter toons about a point

Post by xyilla » Tue Jul 22, 2025 2:33 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Scatter toons about a point

Post by xyilla » Tue Jul 22, 2025 2:34 am


xyilla
naggy
naggy
Posts: 29514
Joined: Sun Feb 23, 2025 5:36 am

Re: Scatter toons about a point

Post by xyilla » Tue Jul 22, 2025 2:36 am