Here's the code. Most of it can be ignored, I'll color what's important.
Code: Select all
|monkpet.mac by notadruid |
| |
|Lets another player control|
|you (the monk) as a pet. |
| |
|Loosely based on Grimjack's|
|hunter.mac |
#turbo 90
[color=red]#Event kill "@master told you, 'kill"
#Event attack "@master told you, 'attack"[/color]
#Event enraged " has become ENRAGED."
|#Event norage "notworkingatm"
[color=red]#Event follow "@master told you, 'follow'"
#Event feign "@master told you, 'feign'"[/color]
#Event leader "told you, 'who leader'" |**[color=red]interesting results from this[/color]**|
#Event toofar "Your target is too far away, get closer!"
#Event tooclose "You cannot see your target."
[color=red]#Event tell "@master tells you, '"
#Event help "@master told you, 'help'"[/color]
Sub Main
/declare MyXLOC global
/declare MyYLOC global
/declare ObstCount global
/declare RangeMax global
/declare RangeMin global
/declare FastRange global
[color=red] /declare master global[/color]
/cleanup
/press esc
/press alt
/press shift
/press ctrl
/varset MyXLOC $char(x)
/varset MyYLOC $char(y)
/varset ObstCount 0
/varset RangeMax 10
/varset RangeMin 5
/varset FastRange 12
[color=red] /varset master "@Param0"[/color]
:mainloop
/doevents
/goto :mainloop
/return
Sub Event_attack
/call Event_kill
/return
Sub Event_kill
/stand
/assist @master
/delay 5
/t @master Attacking $target(name), Master
/call move
/call Combat
/return
Sub Event_follow
/press esc
/press esc
/stand
/attack off
/target @master
/t @master Following you, Master
:followLoop
/doevents
/call move
/if "$target()"=="TRUE" /goto :followLoop
/return
Sub Event_enraged
/attack off
/do "Feign Death"
/press esc
/t @master The mob has Enraged, Master
/return
Sub Event_feign
/attack off
/do "Feign Death"
/press esc
/t @master Feigned Death, Master
/return
Sub Combat
/attack on
:fight
/face fast
/if n $char(ability,"Flying Kick")!=-2 {
/do "Flying Kick"
/cast item "Celestial Fists"
}
/if n $char(hp,pct)<=70 {
/if $char(ability,"Mend")!=-2 {
/do "Mend"
/t @master Mended
}
}
/call move
/doevents
/if "$target()"=="False" {
/sendkey up up
/return
}
/goto :fight
/return
Sub move
/face fast
/if n $target(distance)>=@FastRange /call fastmove
/if n $target(distance)>@RangeMax {
/press up
}
/if n $target(distance)<@RangeMin {
/press down
}
/return
Sub fastmove
/varset MyXLOC $char(x)
/varset MyYLOC $char(y)
/varset ObstCount 0
:fastmoveloop
/doevents
/if $target()=="FALSE" {
/sendkey up up
/if $combat=="TRUE" {
/attack off
/return
}
}
/face fast
/if n $target(distance)>@FastRange {
/sendkey down up
}
/if n $target(distance)<=@FastRange {
/sendkey up up
/return
}
/varadd ObstCount 1
/if n @ObstCount>=3 {
/call checkobst
}
/goto :fastmoveloop
/return
Sub checkobst
/if n @MyXLOC==$char(x) /if n @MyYLOC==$char(y) /call HitObst 5
/varset MyXLOC $char(x)
/varset MyYLOC $char(y)
/varset ObstCount 0
/return
Sub HitObst
/sendkey up up
/sendkey down down
/if n $rand(99)>50 {
/delay 3s
/sendkey up down
/sendkey down Right
/delay @Param0
/sendkey up Right
/sendkey down up
/delay 3s
/sendkey up up
} else {
/delay 3s
/sendkey up down
/sendkey down left
/delay @Param0
/sendkey up left
/sendkey down up
/delay 3s
/sendkey up up
}
/sendkey up down
/sendkey up Right
/sendkey up Left
/sendkey down up
/return
Sub Event_toofar
/press up
/if n $target(distance)<@RangeMax {
|RangeMax is too large.
|Adjust RangeMax to current distance
|Adjust RangeMin and FastRange
|to eliminate impossible constraints
/varset RangeMax $target(distance)
/varset RangeMin $calc(@RangeMax-5)
/varset FastRange $calc(@RangeMax+5)
}
/return
Sub Event_tooclose
/press down
/if n $target(distance)>@RangeMin {
|RangeMin is too small.
|Adjust RangeMin to current distance
|Adjust RangeMax and FastRange
|to eliminate impossible constraints
/varset RangeMin $target(distance)
/varset RangeMax $calc(@RangeMin+5)
/varset FastRange $calc(@RangeMax+5)
}
/return
[color=red]Sub Event_leader
/reply My leader is @master
/say My leader is @master
/return[/color]
Sub Event_tell
/t @master Use ;tell not /tell, you friggin tacohead! Perhaps you should ask for help. (;t me help)
/returnIt says could not find player and then it gives the master's name with a dot in front of it, ex: .Cooldude
Then it says 'My leader is (master name)' with no dot or anything, wtf?
to reiterate, When I took out all the paramming and just had the events as Cooldude told you, 'attack' wtc they worked just fine. I just need to be able to do the same thing with a param set to a global var.

