Request: please help with auto fire macro (rangers)

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

guest

Request: please help with auto fire macro (rangers)

Post by guest » Wed Oct 29, 2003 10:08 pm

I've written a macro but I can't seem to solve what the problem it... right now the combat check doesn't work and i'm having a bit of a problem... I currently used the rogue-assist macro as a guide line adopting the backstab event to mimic the autofire. Please help me fix this ^^

Code: Select all

|Archery Macro v. 0.1a
|Archery Assist Macro.

#turbo

Sub Main
	/declare RangeMin local
	/declare RangeMax local
	/declare Combatstatus global
	/declare CastTimer timer
	/varset RangeMax 150
	/varset RangeMin 75
	/varset Combatstatus 0
	:Mainloop
	/call Combatcheck
	/if @Combatstatus=="1" /call Arrow
	/if @Combatstatus=="0" /call Healthcheck
	/doevents
	/goto :mainloop
/return

Sub Healthcheck
	/if n @CastTimer>0 /return
	/if n $char(hp,pct)<75 	{
		/if $combat!="TRUE" {
			/if $target()=="FALSE" {
				/press 8
				/varset CastTimer 2.4s
			}
		}
	}
/return

Sub Combatcheck
	/if $target()=="TRUE" {
		/if $combat=="TRUE" {
			/varset Combatstatus 1
			/attack off
			/return
		}
	}
	/if $target()=="FALSE" {
		/varset Combatstatus 0
		/if $combat=="TRUE" {
			/attack off
		}
		/return
	}

Sub Arrow
	/if $target ()=="TRUE" 
	{
		/face fast nopredict
		/press 2
		/delay .5s
	}
	
	/if $target ()=="False" 
	{
		/varset Combatstatus 0
	}
/return

Gellenole
orc pawn
orc pawn
Posts: 20
Joined: Wed Oct 29, 2003 10:28 pm

Post by Gellenole » Wed Oct 29, 2003 11:06 pm

this works for now... if you change the line
"/doability ranged attack --> /press 2"

but you'll get spam errors like "couldn't find comparison operator '$target'"

if you can fix it plz =D would help a lot =D after it works without bugs i'm going to modify it like have it assist and have it cast spells.

Code: Select all

|Archery Macro v. 0.1a
|Archery Assist Macro.

#turbo infinite

Sub Main
	/declare RangeMin global
	/declare RangeMax global
	/declare Combatstatus global
	/declare CastTimer timer
	/varset RangeMax 150
	/varset RangeMin 75
	/varset Combatstatus 1
	:Mainloop
	/call Combatcheck
	/if @Combatstatus=="1" /call Arrow
	/if @Combatstatus=="0" /call Healthcheck
	/doevents
	/goto :mainloop
/return

Sub Healthcheck
	/if n @CastTimer>0 /return
	/if n $char(hp,pct)<75{
		/if $combat!="TRUE" {
			/if $target()=="FALSE" {
				/press 8
				/varset CastTimer 2.4s
				}
			}
		}
/return

Sub Combatcheck
	/if $target()=="TRUE" {
		/if $combat=="TRUE" {
			/varset Combatstatus 1
			/attack off
			/return
		}
	}
	/if $target()=="FALSE" {
		/varset Combatstatus 0
		/if $combat=="TRUE" {
			/attack off
		}
		/return
	}
/varset Combatstatus 0 
/return

Sub Arrow
	:arrowloop
	 /if n $char(ability,"Ranged Attack")!=-5 {
		/if $target ()=="TRUE" 
		{
			/face fast nopredict
			/delay 5
			/doability "Range Attack"
		}
		/if $target ()=="False"
		{
			/varset Combatstatus 0
		}
		/goto :arrowloop
	/return

User avatar
blueninja
a grimling bloodguard
a grimling bloodguard
Posts: 541
Joined: Thu Aug 28, 2003 7:03 am
Location: Göteborg, Sweden

Post by blueninja » Thu Oct 30, 2003 6:18 am

Remove the space inbetween $target and the () after it. Also put all $target() used in comparisons in quotes like this: /if "$target()"=="blah blah" ..

In the code below you first use "Ranged attack" and further down you use "Range attack" (note the d in ranged). I don't know which one is the correct one but my guess is that you should use the same one in both places.

Code: Select all

Sub Arrow
   :arrowloop
    /if n $char(ability,"[b]Ranged Attack[/b]")!=-5 {
      /if $target ()=="TRUE"
      {
         /face fast nopredict
         /delay 5
         /doability "[b]Range Attack[/b]"
      }
.....
   /return
I think the check should be for -2 not -5 (at least thats what readme.html says).

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

Post by grimjack » Thu Oct 30, 2003 6:43 am

blueninja wrote:Remove the space inbetween $target and the () after it. Also put all $target() used in comparisons in quotes like this: /if "$target()"=="blah blah" ..

In the code below you first use "Ranged attack" and further down you use "Range attack" (note the d in ranged). I don't know which one is the correct one but my guess is that you should use the same one in both places.

Code: Select all

Sub Arrow
   :arrowloop
    /if n $char(ability,"[b]Ranged Attack[/b]")!=-5 {
      /if $target ()=="TRUE"
      {
         /face fast nopredict
         /delay 5
         /doability "[b]Range Attack[/b]"
      }
.....
   /return
I think the check should be for -2 not -5 (at least thats what readme.html says).
Last time I checked doability won't work with ranged attack. I believe you have to use /press and a hotkey. Also, I don't think $char(ability,"") works with ranged either. It always reports 0. Unless you can find a dev that will add this functionality, there really isn't a great way to do this. You will either use timers and /press or have it banging the hot button every second.

$combat is a possability since it shows as TRUE when the ranged button is pressed. I'm not sure if it stays true the whole time the button is unavalible though.

Thanks
When they come to me, they're in trouble, or they want some. I bust people out of prison, hunt down vampires, fight alien gods -- All the fun jobs people are too squeamish or too polite to do themselves.

Call me a mercenary. Call me an assassin. Call me a villain. I am all that and more.

My name's John Gaunt, but out on the streets of Cynosure, I am called...
GrimJack

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Thu Oct 30, 2003 9:42 am

/doability does NOT work with "Ranged Attack". I asked Plaz about this a while back and he said he never figured that one out. Hotkey it and use /press till we manage to discover where it is.
MQ2: Think of it as Evolution in action.

Plazmic
The One
The One
Posts: 800
Joined: Fri Jun 14, 2002 12:31 am
Contact:

Post by Plazmic » Thu Oct 30, 2003 12:17 pm

Not exactly, I know where it is, just that I can't get it to use ammo normally. Giving level 1 rogues/monks 'Endless Quiver" for thrown weapons isn't what I'd want in the public MQ.
- Plazmic

Gellenole
orc pawn
orc pawn
Posts: 20
Joined: Wed Oct 29, 2003 10:28 pm

Post by Gellenole » Thu Oct 30, 2003 1:09 pm

hehe thanks for the help... most of the problem I fixed. it now shoots and have no spam error =D. But now I have a problem about turning it off... i'll post the new code... I also can't get the macro to heal right after the fight. but here's the macro so far =D ^_^... hope you guys are kind of surprised on what I did in under 1 hour of work considering it's my 1st attempt at coding MQ.

Btw if you guys find out how I can turn off the firing without turning off the macro that would be great... and it can get some help with fixing the healing function in the previous version.

Code: Select all

|Archery Macro v. 1.0c
|Archery Assist Macro.
|Gellenole's Autofire Archery Macro
|
|HISTORY
|Version 1.0c
|	- Fixed the macro to end when the mob dies. (Ghetto stopping the arrow from firing... Turning off macro)
|Version 1.0b
|	- Fixed having the user to fire 1st arrow for macro to run
|	- Still need to fix how to turn it off once mob is dead
|Version 1.0a
|	- Need user intervention to Fire 1st arrow for the macro to work
|	- Need user intervention to turn off the macro even after mob is dead

#turbo infinite 

Sub Main
   /declare Fightswitch global 
   /declare CastTimer timer
   /varset Fightswitch 1 
   :Mainloop 
   /call  Fightswitch
   /if @Fightswitch=="0" /call Fightswitch 
   /doevents 
   /goto :mainloop 
/return 

| --> This subset is a switch to check for mob target
Sub Fightswitch 
   /if $target()=="TRUE" { 
      /if $combat=="FALSE" { 
         /varset Fightswitch 1
	 /call Arrow
      } 
   } 
   /if $target()=="FALSE" { 
      /varset Fightswitch 0 
      /if $combat=="FALSE" { 
	 /varset Fightswitch 0
         /attack off
	 /return 
      } 
      /return 
   } 
/varset Fightswitch 0 
/return 

| --> Loop for arrows
Sub Arrow 
   :arrowloop 
      /if $target()=="TRUE" { 
         /face fast nopredict 
         /delay 3 
         /press 2		|Change arrow button to your own
      	
	 /if $target()=="FALSE" {
            /varset Fightswitch 0
	    /goto :stopfiring
	}
      } 
      /goto :arrowloop 
:stopfiring
/endmacro
/return