ok .. need someone to look at this and help me

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

omper
a ghoul
a ghoul
Posts: 110
Joined: Sat Dec 06, 2003 10:46 pm

ok .. need someone to look at this and help me

Post by omper » Tue May 04, 2004 2:48 am

Added what was suggested.. but need more now.. will this guy just keep pulling mobs.. even if first mob is not dead.. ?

Also need to make sure that there is enough pauses in this..

And as for as the anchor is concerned.. I want the anchor to be set when the macro is started.. after that the anchor does not change.. just he goes get the mob and comes back to anchor.. faces the mob and killes it..

here is current code

Code: Select all

|  Rangerautopull.mac 

| Writen by Omper 

#chat tell 
#include spellcast.inc 
#event GotHIT "Hit You For" 

/declare AnchorX float outer 
/declare AnchorY float outer 
/declare startpoint int outer  //Is this your start of an anchor? If so not needed 

Sub Main 
   /echo Rangerautopull.mac 

/varset AnchorX ${Me.X} 
/varset AnchorY ${Me.Y} 

        /cleanup 
        /doevents 
        /call Tarnpc 
        /pause 10          // hope this is 10 seconds.. not sure 

/return 


Sub Tarnpc   //were is this called from?? 

   /target npc radius 150 
   /call Cast "ensnare     

/return 



Sub Event_GOTHIT 
    
   /attack on 
   :Loop 
      /if (${Target.Distance}>20) { 
            /keypress forward    
            } 
            /if (${Target.Distance}<10) { 
            /keypress back hold 
            /timed 1 /keypress back 
            } 
            /face nolook fast 
            /delay 0 
         /if (!${Target.ID}) { 
            /goto :End 
            } else { 
         /goto :Loop 
         } 

:End 
          /call MoveToAnchor 
/return 

Sub MoveToAnchor 
    /declare iCount int local 

    /varset fXLoc ${Me.X} 
    /varset fYLoc ${Me.Y} 
    /varset iCount 0 

    /echo Moving to Anchor at Loc: ${AnchorY}, ${AnchorX}. 

:AnchorMoveLoop  
    /delay 1 
    /doevents 
    /face nolook loc ${AnchorY},${AnchorX} 
    
    /if (${Math.Distance[${AnchorY},${AnchorX}]}>12) { 
       /keypress forward hold 
   } else { 
       /keypress forward 
        /return 
    } 

    /if (${iCount}>2) { 
        /call Detectobst 
        /face nolook loc ${AnchorY},${AnchorX} 
        /varset iCount 0 
    } 
    
    /varcalc iCount ${iCount}+1 
    /goto :AnchorMoveLoop 
/return 

Sub Detectobst 
    /delay 2 
    /if (${fXLoc}==${Me.X}) /if (${fYLoc}==${Me.Y}) /call Hitobst 
    /varset fXLoc ${Me.X} 
    /varset fYLoc ${Me.Y} 
/return 

Sub Hitobst 
    /keypress forward 
    /keypress back hold 
    
    /if (${Math.Rand[2]}) {    
        /delay 2s    
        /keypress back 
        /keypress right hold 
        /delay 8 
        /keypress right 
        
        /delay 2s 
        /keypress back 
        /keypress left hold 
        /delay 8 
        /keypress left 
    } 
    /delay 10 
    /keypress forward hold 
/return
any help would be appreciated.. tks

Omper
Last edited by omper on Tue May 04, 2004 1:35 pm, edited 1 time in total.

Goofmester1
a hill giant
a hill giant
Posts: 241
Joined: Thu Nov 06, 2003 4:26 am

Post by Goofmester1 » Tue May 04, 2004 7:03 am

Ok I will give it a shot but have a few questions about it..


The Anchor code was copied from AutoBard Code is Cunning/ml2517 scripts together located http://macroquest2.com/phpBB2/viewtopic.php?t=6877

Code: Select all

|  Rangerautopull.mac 

| Writen by Omper 

#chat tell 
#include spellcast.inc 
#event GotHIT "Hit You For" 

/declare AnchorX float outer 
/declare AnchorY float outer
/declare startpoint int outer  //Is this your start of an anchor? If so not needed

Sub Main 
   /echo Rangerautopull.mac 

/varset AnchorX ${Me.X} 
/varset AnchorY ${Me.Y} 

        /cleanup 
        /doevents 

/return 


[color=red]Sub Tarnpc   //were is this called from??

   /target npc radius 150 
   /call Cast "ensnare 
    

/return [/color]



Sub Event_GOTHIT 
    
   /attack on 
   :Loop 
      /if (${Target.Distance}>20) { 
            /keypress forward    
            } 
            /if (${Target.Distance}<10) { 
            /keypress back hold 
            /timed 1 /keypress back 
            } 
            /face nolook fast 
            /delay 0 
         /if (!${Target.ID}) { 
            /goto :End 
            } else { 
         /goto :Loop 
         }

:End 
          /call MoveToAnchor
/return

Sub MoveToAnchor 
    /declare iCount int local 

    /varset fXLoc ${Me.X} 
    /varset fYLoc ${Me.Y} 
    /varset iCount 0 

    /echo Moving to Anchor at Loc: ${AnchorY}, ${AnchorX}. 

:AnchorMoveLoop  
    /delay 1 
    /doevents 
    /face nolook loc ${AnchorY},${AnchorX} 
    
    /if (${Math.Distance[${AnchorY},${AnchorX}]}>12) { 
       /keypress forward hold 
   } else { 
       /keypress forward 
        /return 
    } 

    /if (${iCount}>2) {
        /call Detectobst
        /face nolook loc ${AnchorY},${AnchorX} 
        /varset iCount 0 
    } 
    
    /varcalc iCount ${iCount}+1 
    /goto :AnchorMoveLoop 
/return

Sub Detectobst 
    /delay 2 
    /if (${fXLoc}==${Me.X}) /if (${fYLoc}==${Me.Y}) /call Hitobst 
    /varset fXLoc ${Me.X} 
    /varset fYLoc ${Me.Y} 
/return 

Sub Hitobst 
    /keypress forward 
    /keypress back hold 
    
    /if (${Math.Rand[2]}) {    
        /delay 2s    
        /keypress back 
        /keypress right hold 
        /delay 8 
        /keypress right 
        
        /delay 2s 
        /keypress back 
        /keypress left hold 
        /delay 8 
        /keypress left 
    } 
    /delay 10 
    /keypress forward hold 
/return 
Now the questions are: Is this a complete pre datavars working macro? Seems part of it is missing and it may not work the way you want without it. Are you calling the Sub Tarnpc somehow outside this macro, or is that something you are looking for help to fix?

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

Post by Preocts » Tue May 04, 2004 7:11 am

Can I just make some pointers here?

1) Take a look at your Sub Main. The way you have it written now it loads, includes, echos, scans if any chat events have happened in the .3 seconds since it loaded, and then ends. Thinking you want a loop.
2) Sub Event_GotHIT. Nice sub, good logic, but never will be called. you don't have anywhere in this macro a /doevents that will check for "hit you for". I'd recommend that going in your mainloop.
3)

Code: Select all

      :End 
          /keypress forward 
        /keypress back 
Why is this sitting in whitespace at the very bottom of your code? It needs to be in a sub with a /return. Also the same with your declare statement, why is it in whitespace?

Well, that's all I'm teaching about today. If you figured this much out then /varset'ing your loc to a variable and moving back to that when you are done fighting should be cake.

Code: Select all

|  Rangerautopull.mac 

| Writen by Omper 

#chat tell 
#include spellcast.inc 
#event GotHIT "Hit You For" 


Sub Main 
[color=red]/declare startpoint global [/color]
   /echo Rangerautopull.mac 
  
[color=red]  :MainLoop[/color] 
        /cleanup 
        /doevents chat 
[color=red]     /delay 1
  /goto :MainLoop[/color]
/return 


Sub Tarnpc 

   /target npc radius 150 
   /call Cast "ensnare 
    

/return 



Sub Event_GOTHIT 
   /attack on 
   :Loop 
      /if (${Target.Distance}>20) { 
            /keypress forward    
            } 
            /if (${Target.Distance}<10) { 
            /keypress back hold 
            /timed 1 /keypress back 
            } 
            /face nolook fast 
            /delay 0 
         /if (!${Target.ID}) { 
            /goto :End 
            } else { 
         /goto :Loop 
         } 
[color=red]      :End 
        /keypress forward 
        /keypress back [/color]
/return 


omper
a ghoul
a ghoul
Posts: 110
Joined: Sat Dec 06, 2003 10:46 pm

Post by omper » Tue May 04, 2004 1:25 pm

Ok.. Not sure where to call that event from .. so i will give it a try

also i need it to not pull another mob till after its finished fighting..





Code: Select all

|  Rangerautopull.mac 

| Writen by Omper 

#chat tell 
#include spellcast.inc 
#event GotHIT "Hit You For" 

/declare AnchorX float outer 
/declare AnchorY float outer 
/declare startpoint int outer  //Is this your start of an anchor? If so not needed 

Sub Main 
   /echo Rangerautopull.mac 

/varset AnchorX ${Me.X} 
/varset AnchorY ${Me.Y} 

        /cleanup 
        /doevents 
        [color=red]/call Tarnpc[/color]
        /pause 10          [color=yellow] // hope this is 10 seconds.. not sure[/color]

/return 


[color=red]Sub Tarnpc   //were is this called from?? 

   /target npc radius 150 
   /call Cast "ensnare [/color]    

/return 



Sub Event_GOTHIT 
    
   /attack on 
   :Loop 
      /if (${Target.Distance}>20) { 
            /keypress forward    
            } 
            /if (${Target.Distance}<10) { 
            /keypress back hold 
            /timed 1 /keypress back 
            } 
            /face nolook fast 
            /delay 0 
         /if (!${Target.ID}) { 
            /goto :End 
            } else { 
         /goto :Loop 
         } 

:End 
          /call MoveToAnchor 
/return 

Sub MoveToAnchor 
    /declare iCount int local 

    /varset fXLoc ${Me.X} 
    /varset fYLoc ${Me.Y} 
    /varset iCount 0 

    /echo Moving to Anchor at Loc: ${AnchorY}, ${AnchorX}. 

:AnchorMoveLoop  
    /delay 1 
    /doevents 
    /face nolook loc ${AnchorY},${AnchorX} 
    
    /if (${Math.Distance[${AnchorY},${AnchorX}]}>12) { 
       /keypress forward hold 
   } else { 
       /keypress forward 
        /return 
    } 

    /if (${iCount}>2) { 
        /call Detectobst 
        /face nolook loc ${AnchorY},${AnchorX} 
        /varset iCount 0 
    } 
    
    /varcalc iCount ${iCount}+1 
    /goto :AnchorMoveLoop 
/return 

Sub Detectobst 
    /delay 2 
    /if (${fXLoc}==${Me.X}) /if (${fYLoc}==${Me.Y}) /call Hitobst 
    /varset fXLoc ${Me.X} 
    /varset fYLoc ${Me.Y} 
/return 

Sub Hitobst 
    /keypress forward 
    /keypress back hold 
    
    /if (${Math.Rand[2]}) {    
        /delay 2s    
        /keypress back 
        /keypress right hold 
        /delay 8 
        /keypress right 
        
        /delay 2s 
        /keypress back 
        /keypress left hold 
        /delay 8 
        /keypress left 
    } 
    /delay 10 
    /keypress forward hold 
/return

Goofmester1
a hill giant
a hill giant
Posts: 241
Joined: Thu Nov 06, 2003 4:26 am

Post by Goofmester1 » Tue May 04, 2004 8:43 pm

Ok so Sub Tarnpc is you pull routine.. then you don't want it in Sub Main or it will pull everytime it goes through there. Make a new event for something like #Event Tarnpc "You gain" try to make it so when you gain experiance it goes for the next mob.

Then in the sub Sub Tarnpc turn it into an Event instead.
Sub Event_Tarnpc
/target npc radius 150
/call cast "Ensnare"
/return