could someone help with this macro please?!

Help section from before the user variable changes that broke all macros

Moderator: MacroQuest Developers

User avatar
Clone39
a ghoul
a ghoul
Posts: 91
Joined: Mon Jul 07, 2003 7:26 pm
Location: Montreal, Canada

could someone help with this macro please?!

Post by Clone39 » Mon Jul 21, 2003 10:57 pm

I'm trying to use this fish.mac macro that comes with the CVS
only thing is when i use it and it catches a rusty dagger
it goes into an infinite loop saying Caught a rusty dagger and it doesnt
destroy it.. on see the cursor wiggle around the screen

Code: Select all

| - Fish.mac -
|
#turbo
#event NoBait "You can't fish without fishing bait, go buy some."
#event Cast "You cast your line."
#event Skillup "You have become better at Fishing"
#chat tell

Sub Main
   /cleanup
   /call ClearStats
   /varset v99 0
   /varset t1 5m
   /doevents flush
   :Fish
      /call CheckPole
      /varset l0 $return
      /doevents NoBait
      /if n $l0==1 /call DoLog "Aborting: Out of poles..."
      /if n $v99==1 /call DoLog "Aborting: Out of bait..."
      /if n $calc($l0+$v99)>0 /call Event_Timer
      /if n $calc($l0+$v99)>0 /return
      /if $char(ability,fishing)>0 /if $cursor()==NULL /doability Fishing
      /if $cursor()==TRUE /call KeepStats "$cursor(name)"
      /if "$cursor(name)"=="Tattered Cloth Sandal" /click left destroy
      /if "$cursor(name)"=="Rusty Dagger" /click left destroy
      /if $cursor()==TRUE /call KeepItem
      /doevents
    /goto :Fish
/return

Sub CheckPole
   /if "$equip(primary,name)"~~"Fishing Pole" /return 0
   /finditem similar "Fishing Pole"
   /if "$cursor()"=="NULL" /return 1
   /click left primary
   /if "$cursor()"!="NULL" /click left auto
/return 0

Sub KeepItem
   /if "$cursor(name)"!="Fish Scales" /call DoLog "Caught $cursor(name)..."
   /click left auto
/return

Sub KeepStats
   /if "$p0"~~"cloth sandal" {
      /varadd v0 1
   } else /if "$p0"~~"rusty dagger" {
      /varadd v1 1
   } else /if "$p0"~~"fish scales" {
      /varadd v2 1
   } else /if "$p0"~~"fresh fish" {
      /varadd v3 1
   } else {
      /varadd v4 1
   }
/return

Sub Event_NoBait
  /varset v99 1
/return

Sub Event_Cast
  /varadd v5 1
/return

Sub Event_Skillup
  /varadd v6 1
/return

Sub Event_Timer
   /call DoLog "Run time: $calc($running/60) min - Casts: $int($v5) - Skill ups: $int($v6)"
   /call DoLog "Found: $int($v0) sandals - $int($v1) daggers - $int($v2) scales - $int($v3) fresh fish - $int($v4) zone items"
   /varset t$p0 $p1
/return

Sub ClearStats
   /varset v0 0
   /varset v1 0
   /varset v2 0
   /varset v3 0
   /varset v4 0
   /varset v5 0
   /varset v6 0
/return

Sub Event_Chat
   /mqlog ** $p1: '$p2'
/return

Sub DoLog
   /mqlog $p0
   /echo $p0
/return

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Post by wassup » Tue Jul 22, 2003 5:07 am

Are you using the default UI?

Do you have your inventory window open?

User avatar
Clone39
a ghoul
a ghoul
Posts: 91
Joined: Mon Jul 07, 2003 7:26 pm
Location: Montreal, Canada

Post by Clone39 » Tue Jul 22, 2003 9:02 am

i tried at first with my own UI.. when it first happened i then switched for the default UI but it still did it again..

but looking back at it.. maybe it has something to do with /click left not working.. what do you think about that?! could it be only that?!

thanks

clone39

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

Post by Mckorr » Tue Jul 22, 2003 9:22 am

Nope, /click left works fine. I've had similar problems, and it's always with the rusty daggers. Everything else works fine.

Try this:

Code: Select all

/if "$cursor(name)"~~"Dagger" /click left destroy
That seems to work.
MQ2: Think of it as Evolution in action.

User avatar
Clone39
a ghoul
a ghoul
Posts: 91
Joined: Mon Jul 07, 2003 7:26 pm
Location: Montreal, Canada

Post by Clone39 » Tue Jul 22, 2003 7:21 pm

if i get it right.. it means i should do the same thing with

Code: Select all

/if "$cursor(name)"=="Tattered Cloth Sandal" /click left destroy
and replace the "==" with "~~" ?!

thanks McKorr

and at the same time.. where's the timer in this script?! i can't seem to figure what to change so i can delay a little bit more so i wont cast my line too soon.. seems to happen 2 out of 3 times.


Clone39

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Post by wassup » Wed Jul 23, 2003 2:43 am

Clone39 wrote:if i get it right.. it means i should do the same thing with

Code: Select all

/if "$cursor(name)"=="Tattered Cloth Sandal" /click left destroy
and replace the "==" with "~~" ?!

thanks McKorr

and at the same time.. where's the timer in this script?! i can't seem to figure what to change so i can delay a little bit more so i wont cast my line too soon.. seems to happen 2 out of 3 times.



Clone39
There isn't a timer in the sense you are thinking. This line checks when the ability refreshes and is ready for use IF the mouse pointer is clear:

Code: Select all

      /if $char(ability,fishing)>0 /if $cursor()==NULL /doability Fishing 

Valerian
a grimling bloodguard
a grimling bloodguard
Posts: 709
Joined: Sun Jul 28, 2002 3:29 am

Post by Valerian » Wed Jul 23, 2003 8:25 am

Wassup wrote:

Code: Select all

/if $char(ability,fishing)>0 /if $cursor()==NULL /doability Fishing 

Code: Select all

/if n $char(ability,fishing)>0 /if $cursor()==NULL {
   /delay 2s
   /doability Fishing 
}
may need to tweak that 2s delay around a bit, I'm not sure how long it needs to be...

User avatar
Clone39
a ghoul
a ghoul
Posts: 91
Joined: Mon Jul 07, 2003 7:26 pm
Location: Montreal, Canada

thank you!!

Post by Clone39 » Wed Jul 23, 2003 9:24 am

thank you very much Wassup and Valerian

your help is very much appreciated!!



Clone39

di28889
a hill giant
a hill giant
Posts: 296
Joined: Sat Jul 12, 2003 11:36 pm

Post by di28889 » Sat Jul 26, 2003 12:45 am

the only thing i see is the macro has a problem doing the destroy

/if "$cursor(name)"=="Tattered Cloth Sandal" /click left destroy
/if "$cursor(name)"=="Rusty Dagger" /click left destroy


i tried to put in a delay but it just auto equip the item

/if "$cursor(name)"=="Tattered Cloth Sandal" /delay 20 /click left destroy
/if "$cursor(name)"=="Rusty Dagger" /delay 20 /click left destroy


the macro does work after adding the delay, How can i get the macro to destroy the junk? :?

di28889
a hill giant
a hill giant
Posts: 296
Joined: Sat Jul 12, 2003 11:36 pm

Post by di28889 » Sat Jul 26, 2003 2:02 am

This seems to work good for me :D
I added a sub to put in a delay and to report what i destroyed!

Hope this helps someone.

Code: Select all

| - Fish.mac -
|
#turbo
#event NoBait "You can't fish without fishing bait, go buy some."
#event Cast "You cast your line."
#event Skillup "You have become better at Fishing"
#chat tell

Sub Main 
   /cleanup
   /call ClearStats
   /varset v99 0
   /varset t1 5m
   /doevents flush
   :Fish
      /call CheckPole
      /varset l0 $return
      /doevents NoBait
      /if n $l0==1 /call DoLog "Aborting: Out of poles..."
      /if n $v99==1 /call DoLog "Aborting: Out of bait..."
      /if n $calc($l0+$v99)>0 /call Event_Timer
      /if n $calc($l0+$v99)>0 /return
      /if $char(ability,fishing)>0 /if $cursor()==NULL /doability Fishing
      /if $cursor()==TRUE /call KeepStats "$cursor(name)"
      /if "$cursor(name)"~~"Sandal" /call sandal
      /if "$cursor(name)"~~"Dagger" /call dagger
      /if $cursor()==TRUE /call KeepItem
      /doevents
    /goto :Fish
/return

Sub CheckPole
   /if "$equip(primary,name)"~~"Fishing Pole" /return 0
   /finditem similar "Fishing Pole"
   /if "$cursor()"=="NULL" /return 1
   /click left primary
   /if "$cursor()"!="NULL" /click left auto
/return 0

Sub sandal 
        /echo "You destroyed a $cursor(name)..."
	/click left destroy
	/delay 2	
/return

Sub dagger
        /echo "You destroyed a $cursor(name)..."
	/click left destroy
	/delay 2
/return

Sub KeepItem
   /call DoLog "Caught $cursor(name)..."
   /click left auto
/return

Sub KeepStats
          /if "$p0"~~"sandal" {
      /varadd v0 1
   } else /if "$p0"~~"dagger" {
      /varadd v1 1
   } else /if "$p0"~~"scales" {
      /varadd v2 1
   } else /if "$p0"~~"fresh fish" {
      /varadd v3 1
   } else {
      /varadd v4 1
   }

/return

Sub Event_NoBait
  /varset v99 1
/return

Sub Event_Cast
  /varadd v5 1
/return

Sub Event_Skillup
  /varadd v6 1
/return

Sub Event_Timer
   /call DoLog "Run time: $calc($running/60) min - Casts: $int($v5) - Skill ups: $int($v6)"
   /call DoLog "Found: $int($v0) sandals - $int($v1) daggers - $int($v2) scales - $int($v3) fresh fish - $int($v4) zone items"
   /varset t$p0 $p1
/return

Sub ClearStats
   /varset v0 0
   /varset v1 0
   /varset v2 0
   /varset v3 0
   /varset v4 0
   /varset v5 0
   /varset v6 0
/return

Sub Event_Chat
   /mqlog ** $p1: '$p2'
/return

Sub DoLog
   /mqlog $p0
   /echo $p0
/return