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 $target(name)~~"corpse" /call GetTarget
/if $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
Code: Select all
#turbo
#chat tell
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
| This block of code checks for proper arguments and echos error or initialization messages.
/if $defined(Param7)==false {
/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.
/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
| Do stuff if not in a holding phase.
/if n @StopMe==0 {
/doevents
/if $char(casting)==FALSE {
/varset CurSong @PrevSong
/call Event_Timer
}
| If a GM zones in, shut down for 30 minutes.
/if $gm==TRUE {
/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 n @ProximityTimer<100 {
| If an ungrouped PC comes within specified range, shut down until they leave.
/if n $searchspawn(pc,noalert:1,radius:@Param7)>0 {
/echo $spawn($searchspawn(pc,noalert:1,radius:@Param7),name,clean) is inside @Param7 ft., going into standby at $time(h):$time(m):$time(s).
/g $spawn($searchspawn(pc,noalert:1,radius:@Param7),name,clean) is inside @Param7 ft., going into standby at $time(h):$time(m):$time(s).
/stopsong
/varset StopMe 2
/varset StopTimer 200
}
/varadd ProximityTimer 1m
}
| Get a new target if the current one is no good.
/if n $target(id)==0 /call GetTarget
/if $target(name)~~"corpse" /call GetTarget
/if $target(type)=="PC" /call GetTarget
}
| Quit the ChantLoop and go into a holding phase if criteria are met.
/if (n @StopTimer<10 && n @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
/sendkey up up
/alt activate 212
| If a GM is in zone, set a timer for 30 minutes.
/if n @StopMe==1 {
/varset StopTimer 18000
}
| If someone came within specified range, set a timer for 5 minutes.
/if n @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 n @StopMe==1 {
/if n @StopTimer==0 {
/echo It's been 30 minutes since a GM was sighted, resuming chant-kiting at $time(h):$time(m):$time(s).
/g It's been 30 minutes since a GM was sighted, resuming chant-kiting at $time(h):$time(m):$time(s).
/varset StopMe 0
/sendkey down up
/goto :ChantLoop
}
}
/if n @StopMe==2 {
/if (n @StopTimer==0 && n $char(mana,cur)>1000) {
/if n $searchspawn(pc,noalert:1,radius:@Param7)==0 {
/echo No PCs within @Param7 ft., resuming chant-kiting at $time(h):$time(m):$time(s).
/g No PCs within @Param7 ft., resuming chant-kiting at $time(h):$time(m):$time(s).
/varset StopMe 0
/sendkey down up
/goto :ChantLoop
} else {
/varset StopTimer 1m
}
}
}
/goto :StopLoop
/return
Sub Event_Chat(ChatType,Sender,ChatText)
/declare MyMob local
/varset MyMob $target(id)
/if "$lcase("@ChatText")"~~"password" {
/target range 1 22000 @Sender
/if n $group(count)<6 {
/tell @Sender I'm kiting at $char(y), $char(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
}
}
/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 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



