Need help with this macro...

Status
Not open for further replies.

Jstang

New member
Joined
Oct 29, 2006
Messages
5
Reaction score
0
Points
0
Hey guys I found this macro that will run a character around picking up Payala fruit in shadeweavers thicket. The only problem is i get an error that says:

/varset failed, variable 'TargetDistance' not found
Payala.mac@18 (movetoitem): /varset TargetDistance
${Target.Distance}
Payala.mac@5 (main): /call movetoitem
there were no matches for: (0-100) any
Payala.mac@19 (movetoitem): /face fast no look

Then my character keeps saying "I am stuck" and moves to the side never picking up the ground spawns. Can anyone help?


Heres the macro:
Payala.mac

declare TargetDistance float global
Sub Main
:Loop
/Call TargetItem
/Call MoveToItem
/Call GetItem
/Call Rest
/goto :loop
/return

Sub TargetItem
/echo Targeting a shroom . . .
/ItemTarget *Blue Mushroom
/return

Sub MoveToItem
:keepmoving
/varset TargetDistance ${Target.Distance}
/face fast nolook
/keypress forward hold
/delay 5
/call CheckIfStuck
/if (${Ground.Distance} > 20) /goto :keepmoving
/keypress back
/return

Sub CheckIfStuck
|/echo is ${TargetDistance} = ${Target.Distance} ?
/if (${TargetDistance}==${Target.Distance}) {
/echo I am stuck
/keypress back hold
/delay 1s
/keypress back
/if (${Math.Rand[99]}>50) {
/keypress strafe_right hold
} else {
/keypress strafe_left hold
}
/delay 2s
/keypress strafe_right
/keypress strafe_left
/keypress forward hold
}
/Return


Sub GetItem
/click left item
/delay 1s
/autoinventory
/delay 1s
/autoinventory
/keypress backspace
/mapfilter ground hide
/mapfilter ground show
/keypress backspace
/Return

Sub Rest
/delay 10s
/echo Getting next phat lewt!
/Return
 
Code:
[COLOR="Red"]/[/COLOR]declare TargetDistance float global

Missing the slash at the beginning of the declare

As a side note, it wouldn't hurt to change 'global' to 'outer' and move the line down one, just below Sub Main
 
Taron said:
Code:
[COLOR="Red"]/[/COLOR]declare TargetDistance float global

Missing the slash at the beginning of the declare
Wow.... I read the whole thing and the mistake was the first character...
 
You'll also want to put that /declare line inside your "Sub Main" - not prior to it.
 
You can use this line for your delay in your getitem sub, so you dont have to wait a full second after autoinventory but it will wait longer if needed (lag and what not)




HTML:
Sub GetItem
/click left item
/delay 1s
/autoinventory
||/delay 1s
/delay 3s !${Cursor.ID}
/autoinventory
/keypress backspace
/mapfilter ground hide
/mapfilter ground show
/keypress backspace
/Return
 
Status
Not open for further replies.