forage.mac Simple Forrage Script

Macro depository for macros written before the user variable changes that broke all of them.

Moderator: MacroQuest Developers

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

forage.mac Simple Forrage Script

Post by grimjack » Thu May 22, 2003 10:59 pm

Only lightly tested. Will update when I find bugs. Worked with Kagonis on irc for this one.

Code: Select all

|forage.mac
|edit the /varset a(1,#) to reflect what you want to keep.
|If you add more update ArraySize to reflect the change.
|The next value in the array would be like this.
|/varset a(1,3) "what you want"
|And you would update ArraySize like this.
|/varset ArraySize 4
#define LoopCount v40
#define ArraySize v41

sub Main 
   /varset a(1,0) "Morning Dew"
   /varset a(1,1) "Branch of Planar Oak"
   /varset a(1,2) "Mushroom"
   /varset ArraySize 3
   /varset LoopCount 0
   /cleanup 
   :Forage 
       /delay 1s
       /if "$cursor()"!="NULL" /call ItemSort
       /if "$cursor()"=="NULL" /if n $char(ability,"Forage")>0 /doability forage 
       /if "$cursor()"!="NULL" /call ItemSort
       /mouseto 640 512 
       /goto :Forage 
   :loop 
/return 

sub ItemSort
   :itemchecker
      /if "$cursor()"!="NULL" {
         /if "$cursor(name)"~~"$a(1,$LoopCount)" {
            /click left auto
            /delay 2s
         }
      /varadd LoopCount 1
      /if "$cursor()"!="NULL" /if n $LoopCount<$ArraySize /goto :itemchecker
   }

   /if "$cursor()"!="NULL" {
      /echo Destroying $cursor(name)
      /click left destroy 
      /delay 1s
   }
   /doevents
   /varset LoopCount 0
/return
Last edited by grimjack on Sat May 31, 2003 11:48 pm, edited 1 time in total.

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

Post by Mckorr » Fri May 23, 2003 10:22 am

Hey Grim, had problems with the looting routine in your autohunter. Kept getting varset and varadd problems, wouldn't parse lines like /varadd LootSlot 1.

Think you could write a basic autoloot.mac for use as an include? Something that will handle about 3 items... okay, howling substance, shrieking substance, and swirling shadows. Working on shadowscream to get my smithing up.

Or better yet, an autoloot that would take passed parameters, up to, oh, 5 of them should be enough. You could call it with something like

#include autoloot.mac
/call LootMob shrieking howling swirling

or some such.
MQ2: Think of it as Evolution in action.

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

Autoloot routine.

Post by grimjack » Fri May 23, 2003 10:37 am

Sure thing. I'll work on it after I get a little rest. I'm curious why you get errors with /varadd. Are you doing your #define for the variable?

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

What I have so far.

Post by grimjack » Fri May 23, 2003 11:23 am

This is what I have so far. I have not tested this at all and it probably contains many syntax errors. I just wanted to run it by you to see if it's what you are looking for. You should be able to get what I am atempting from the code.

Thanks

Code: Select all

#define LootSlot v50
#define CheckLoot v51
#define LootTotal v52

Sub LootUp
   /lootn never
   /varset LootSlot 0
   /varset CheckLoot 0
   /if $p0=="" {
      /echo "Usage: /call LootUp [item to keep] [item to keep]...ect"
      /return
   }
   /if $p0!="" {
      /varset a(1,0) "$p0"
      /varset LootTotal 1
   }
   /if $p1!="" {
      /varset a(1,1) "$p1"
      /varset LootTotal 2
   }
   /if $p2!="" {
      /varset a(1,2) "$p2"
      /varset LootTotal 3
   }
   /if $p3!="" {
      /varset a(1,3) "$p3"
      /varset LootTotal 4
   }
   /if $p4!="" {
      /varset a(1,4) "$p4"
      /varset LootTotal 5
   }
   /if $p5!="" {
      /varset a(1,5) "$p5"
      /varset LootTotal 6
   }
   /if $p6!="" {
      /varset a(1,6) "$p6"
      /varset LootTotal 7
   }
   /if $p7!="" {
      /varset a(1,7) "$p7"
      /varset LootTotal 8
   }
/if $target()=="TRUE" /call LootMob
/call ResetSub
/return

sub LootMob
   /loot
   /delay 2s
   :lootloop
   /if n $LootSlot==0 /click left loot2
   /if n $LootSlot==1 /click left loot3
   /if n $LootSlot==2 /click left loot4
   /if n $LootSlot==3 /click left loot5
   /if n $LootSlot==4 /click left loot6
   /if n $LootSlot==5 /click left loot7
   /if n $LootSlot==6 /click left loot8
   /if n $LootSlot==7 /click left loot9
   /if n $LootSlot==8 /click left loot10
   /if n $LootSlot==9 /goto :doneloot
   /delay 1s
   /if "$cursor()"!="TRUE" /goto :doneloot
   :lootChecker
   /if "$cursor(name)"~~"$a(1,$CheckLoot)" {
      /delay 1s
      /click left auto
      /varadd LootSlot 1
      /goto :lootloop
   }
   /varadd CheckLoot 1
   /if "$cursor()"=="TRUE" {
      /if n $CheckLoot<$LootTotal /goto :lootchecker
   }
   /if "$cursor()"=="TRUE" {
      /delay 1s
      /click left destroy
      /delay 1s
   }
   /varadd LootSlot 1
   /varset CheckLoot 0
   /goto :lootloop 
   :doneloot
   /varset LootSlot 0
/return


sub ResetSub
   /press esc
   /press esc
   /press esc
   /press esc
   /press alt
   /press shift
   /press ctrl
   /varset CheckLoot 0
   /varset LootSlot 0
   /delay 1s
/return
Last edited by grimjack on Fri May 23, 2003 4:49 pm, edited 1 time in total.

boldor
a ghoul
a ghoul
Posts: 94
Joined: Tue Sep 10, 2002 11:46 am

Post by boldor » Fri May 23, 2003 11:32 am

I find it strange that he had errors also. I d/l and compiled CVS lastnight. Then ran the cut/paste macro which uses loot2-10. Had no problems in 2-3 hours I ran it.

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

Post by grimjack » Fri May 23, 2003 11:34 am

boldor wrote:I find it strange that he had errors also. I d/l and compiled CVS lastnight. Then ran the cut/paste macro which uses loot2-10. Had no problems in 2-3 hours I ran it.
He is using my loot code in his own script, not the whole thing. I have a fealing he just does not have a #define set up for the variables /varadd is complaining about.

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

Post by Mckorr » Fri May 23, 2003 12:03 pm

#define... okay, that's a good possibility. I was tired and didn't think about that... and I wasn't complaining :) I'm pretty bad about manipulating variables in macros. Almost as bad as I am at parsing strings in C++.

Thanks, will take a closer look at that autolooter after I finish installing this ceiling fan.
MQ2: Think of it as Evolution in action.

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

Post by Mckorr » Fri May 23, 2003 2:55 pm

Well, you're autoloot routine above is a really fast way to exit EQ :) Causes an immediate crash to desktop.
MQ2: Think of it as Evolution in action.

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

NICE

Post by grimjack » Fri May 23, 2003 4:45 pm

Hehehe

I'm up now I'll try to get this working..
Last edited by grimjack on Fri May 23, 2003 5:40 pm, edited 1 time in total.

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

Post by grimjack » Fri May 23, 2003 4:54 pm

Mckorr wrote: and I wasn't complaining :)
.
I did not mean you where complaining. I ment that MQ was spiting out errors on the /varadd. MQ was complaining.
:P
Added a } and now I'm going to see if I can run this.

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

Working Include

Post by grimjack » Fri May 23, 2003 5:24 pm

This one works for me. It will take up to 8 single word variables. After I get some feedback I'll move it to it's own thread.

Code: Select all

|lootcode.mac
#define LootSlot v95
#define CheckLoot v96 
#define LootTotal v97

Sub LootUp 
   /lootn never 
   /varset LootSlot 0 
   /varset CheckLoot 0 
   /if $p0=="" { 
      /echo "Usage: /call LootUp [item to keep] [item to keep]...ect" 
      /return 
   } 
   /if $p0!="" { 
      /varset a(1,0) "$p0" 
      /varset LootTotal 1 
   } 
   /if $p1!="" { 
      /varset a(1,1) "$p1" 
      /varset LootTotal 2 
   } 
   /if $p2!="" { 
      /varset a(1,2) "$p2" 
      /varset LootTotal 3 
   } 
   /if $p3!="" { 
      /varset a(1,3) "$p3" 
      /varset LootTotal 4 
   } 
   /if $p4!="" { 
      /varset a(1,4) "$p4" 
      /varset LootTotal 5 
   } 
   /if $p5!="" { 
      /varset a(1,5) "$p5" 
      /varset LootTotal 6 
   } 
   /if $p6!="" { 
      /varset a(1,6) "$p6" 
      /varset LootTotal 7 
   } 
   /if $p7!="" { 
      /varset a(1,7) "$p7" 
      /varset LootTotal 8 
   }

/if $target()=="TRUE" /call LootMob 
/call ResetSub 
/return 

sub LootMob
   /loot 
   /delay 2s 
   :lootloop 
   /if n $LootSlot==0 /click left loot2 
   /if n $LootSlot==1 /click left loot3 
   /if n $LootSlot==2 /click left loot4 
   /if n $LootSlot==3 /click left loot5 
   /if n $LootSlot==4 /click left loot6 
   /if n $LootSlot==5 /click left loot7 
   /if n $LootSlot==6 /click left loot8 
   /if n $LootSlot==7 /click left loot9 
   /if n $LootSlot==8 /click left loot10 
   /if n $LootSlot==9 /goto :doneloot 
   /delay 1s 
   /if "$cursor()"!="TRUE" /goto :doneloot 
   :lootChecker
| Uncoment next line for array debug output 
| /echo matching against "$a(1,$CheckLoot)"
   /if "$cursor(name)"~~"$a(1,$CheckLoot)" { 
      /delay 1s 
      /click left auto 
      /varadd LootSlot 1 
      /goto :lootloop 
   } 
   /varadd CheckLoot 1 
   /if "$cursor()"=="TRUE" { 
      /if n $CheckLoot<$LootTotal /goto :lootchecker 
   } 
   /if "$cursor()"=="TRUE" { 
      /delay 1s 
      /click left destroy 
      /delay 1s 
   } 
   /varadd LootSlot 1 
   /varset CheckLoot 0 
   /goto :lootloop 
   :doneloot 
   /varset LootSlot 0 
/return 


sub ResetSub 
   /press esc 
   /press esc 
   /press esc 
   /press esc 
   /press alt 
   /press shift 
   /press ctrl 
   /varset CheckLoot 0 
   /varset LootSlot 0 
   /delay 1s 
/return 

Here is what I tested it with. I manualy killed the mob and targeted the corpse befor running.

Code: Select all

|testlootcode.mac
#include lootcode.mac
Sub Main

  /call LootUp "silk" "Pelt"

/return

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

Post by Mckorr » Fri May 23, 2003 6:20 pm

will work it in and give it a shot, thanks.
MQ2: Think of it as Evolution in action.

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

Post by Mckorr » Fri May 23, 2003 6:38 pm

Okay, I'll test it again now that I've fixed the loot slots to start at 0 instead of 2.... :P
MQ2: Think of it as Evolution in action.

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

Post by grimjack » Fri May 23, 2003 6:44 pm

Mckorr wrote:Okay, I'll test it again now that I've fixed the loot slots to start at 0 instead of 2.... :P
I start at 2 for my ui due to the titlebar. I forgot to change it for the post. Thanks

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

Post by Mckorr » Fri May 23, 2003 6:46 pm

Didn't work. Called it this way:

Code: Select all

:start
/delay 5
/if n $char(hp,pct)<51 /call Rest
/if "$alert(1)"=="TRUE" {
    /target alert 1 nopcnear 60
    /call Melee
    /call LootUp "howling" "shrieking" "pelt"
}
/goto :start
And it destroyed a howling substance.

Edit: Okay, I'm an idiot. It's a WAILING substance. Sheesh, stupid mistake.
MQ2: Think of it as Evolution in action.