Forgae with .ini

Post your completed (working) macros here. Only for macros using MQ2Data syntax!

Moderator: MacroQuest Developers

game_slave
orc pawn
orc pawn
Posts: 18
Joined: Wed Apr 21, 2004 6:50 pm

Forgae with .ini

Post by game_slave » Thu Apr 29, 2004 7:23 pm

A forage program with INI support. Automatically adds items to the .ini file. Keeps what you want and destroys what you don't. Even allows you to keep a certain amount of a particular item.

Code: Select all

|Forage.mac
|Based off code from Preocts(thanks!) and code from various other forage macros.
|In the forage.ini file use -1 to keep all of that item, 0 to destroy all of that item and any other number to keep just that many.
|New foraged items are added to the ini file automatically.


sub Main
   /cleanup
   :Forage
    /if (${Me.State.NotEqual[STAND]}) {
      /stand
      /delay 5
   }
   /delay 1s
   /if (${Me.Skill[Forage]} > 0) /doability forage
       }
       /if (${Cursor.ID}) /call ItemSort
       /goto :Forage
   :loop
/return
sub ItemSort
  /delay 5
  /declare DoubleCheck local
  /varset DoubleCheck "${Cursor.Name}"

  /if (!${Ini[forage.ini,ForageList,${Cursor.Name}].Length}) {
    /ini "Forage.ini" "ForageList" "${Cursor.Name}" "-1"
  } else {
    /if (${Ini[forage.ini,ForageList,${Cursor.Name}]}) {
      /if (${FindItemCount["=${Cursor.Name}"]}>=${Ini[forage.ini,ForageList,${Cursor.Name}]} && ${Ini[forage.ini,ForageList,${Cursor.Name}]}!=-1) /goto :Destroy
    } else {
      :Destroy
      /if (${Cursor.Name.Equal["@DoubleCheck"]}) {
      /echo Destroying ${Cursor.Name}
      /destroy
      /return
    }
  }
	}
  :LootIt
  	/echo Keeping ${Cursor.Name}
    /autoinventory
    /delay 5
    /if (${Cursor.ID}) /goto :LootIt
/return 

Garrik
orc pawn
orc pawn
Posts: 10
Joined: Thu Sep 18, 2003 4:04 pm

Post by Garrik » Fri Apr 30, 2004 7:18 am

I don't know why but for some reason it doesn't destroy anything at all, even the things in the ini file that are set for destroy.

game_slave
orc pawn
orc pawn
Posts: 18
Joined: Wed Apr 21, 2004 6:50 pm

Post by game_slave » Fri Apr 30, 2004 11:14 am

Are you putting a 0 after the equal sign in the .ini file? Are you making sure you remove the - (minus sign) that is put there automatically?

When a new item is foraged it puts a line in the .ini file like this:

Vegetables=-1

This keeps all vegetables you forage.

To make it destroy all vegetables change the line to:

Vegetables=0

To make it destroy all vegetables after you have 10 put:

Vegetables=10

Game_Slave

Garrik
orc pawn
orc pawn
Posts: 10
Joined: Thu Sep 18, 2003 4:04 pm

Post by Garrik » Fri Apr 30, 2004 11:31 am

This is my INI file:

[ForageList]
Vegetables=-1
Rabbit Meat=20
Pod of Water=20
Drachling Silk=0
Honey Berry=-1
Maneater Bud=-1
Roots=0
Nodding Blue Lily=0
Drachnid Silk=0
Fruit=0
Fishing Grubs=0
Frost Crystal=0
Berries=0

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

Post by Preocts » Fri Apr 30, 2004 12:45 pm

Code: Select all

      :Destroy 
      /if (${Cursor.Name.Equal["[color=red]@DoubleCheck[/color]"]}) { 
      /echo Destroying ${Cursor.Name} 
      /destroy 
      /return 
:wink:

game_slave
orc pawn
orc pawn
Posts: 18
Joined: Wed Apr 21, 2004 6:50 pm

Post by game_slave » Fri Apr 30, 2004 7:19 pm

Ok Preocts, what is it you are saying? I have looked at that code and it seems to be fine and it IS working on my 2 computers with different accounts. I don't even think that particular variable is needed. It just checks to see if what is on the cursor is what was there when that sub started. Should be no ill effects if I just remove it. But I still want to know what you are pointing to specifically please.

Game_Slave

newb-n-training
a lesser mummy
a lesser mummy
Posts: 39
Joined: Mon Apr 19, 2004 8:51 pm

Post by newb-n-training » Fri Apr 30, 2004 7:20 pm

Last edited by newb-n-training on Fri Apr 30, 2004 7:44 pm, edited 2 times in total.

game_slave
orc pawn
orc pawn
Posts: 18
Joined: Wed Apr 21, 2004 6:50 pm

Post by game_slave » Fri Apr 30, 2004 7:27 pm

Newb, that just loops back to this thread. :P

Ok. Here's that macro without that code. Let me know how it works.

Code: Select all

|Forage.mac
|Based off code from Preocts(thanks!) and code from various other forage macros.
|In the forage.ini file use -1 to keep all, 0 to destroy all and any other number to keep just that many.
|New foraged items are added to the ini file automatically.


sub Main
   /cleanup
   :Forage
    /if (${Me.State.NotEqual[STAND]}) {
      /stand
      /delay 5
   }
   /delay 1s
   /if (${Me.Skill[Forage]} > 0) /doability forage
       }
       /if (${Cursor.ID}) /call ItemSort
       /goto :Forage
   :loop
/return
sub ItemSort
  /delay 5

  /if (!${Ini[forage.ini,ForageList,${Cursor.Name}].Length}) {
    /ini "Forage.ini" "ForageList" "${Cursor.Name}" "-1"
  } else {
    /if (${Ini[forage.ini,ForageList,${Cursor.Name}]}) {
      /if (${FindItemCount["=${Cursor.Name}"]}>=${Ini[forage.ini,ForageList,${Cursor.Name}]} && ${Ini[forage.ini,ForageList,${Cursor.Name}]}!=-1) /goto :Destroy
    } else {
      :Destroy
      /echo Destroying ${Cursor.Name}
      /destroy
      /return
  }
	}
  :LootIt
  	/echo Keeping ${Cursor.Name}
    /autoinventory
    /delay 5
    /if (${Cursor.ID}) /goto :LootIt
/return 
Game_Slave

newb-n-training
a lesser mummy
a lesser mummy
Posts: 39
Joined: Mon Apr 19, 2004 8:51 pm

Post by newb-n-training » Fri Apr 30, 2004 7:35 pm

wierd ... dunno why ... meant to point you to the "MQ2DataVars Reference: Usage, Examples, etc" topic in the announcements thread.

due to the MQ2DataVars changes
@DoubleCheck

has to be
${DoubleCheck}

Garrik
orc pawn
orc pawn
Posts: 10
Joined: Thu Sep 18, 2003 4:04 pm

Post by Garrik » Fri Apr 30, 2004 7:37 pm

Works now.

newb-n-training
a lesser mummy
a lesser mummy
Posts: 39
Joined: Mon Apr 19, 2004 8:51 pm

Post by newb-n-training » Fri Apr 30, 2004 7:45 pm

fixed link too ......... dunno what the diff was ... whatever

game_slave
orc pawn
orc pawn
Posts: 18
Joined: Wed Apr 21, 2004 6:50 pm

Post by game_slave » Fri Apr 30, 2004 7:49 pm

newb-n-training wrote:wierd ... dunno why ... meant to point you to the "MQ2DataVars Reference: Usage, Examples, etc" topic in the announcements thread.

due to the MQ2DataVars changes
@DoubleCheck

has to be
${DoubleCheck}
Ahhhhhhh, ok. Now I understand. I am still running last week's compile on my other system is why it works there and not for everyone else. Mo matter. The macro without that code is just fine anyway.


Game_Slave

amml
a lesser mummy
a lesser mummy
Posts: 68
Joined: Thu Apr 22, 2004 4:55 pm

Post by amml » Sat May 01, 2004 4:50 pm

by the way, does anybody know if at some places u get faster skillup than in others? if yes where do i have to forage so i get faster skillup? (my skill is 31 and i foraged for 6 hours with the macro and i had no single skillup...)

bartab
a grimling bloodguard
a grimling bloodguard
Posts: 715
Joined: Wed Oct 15, 2003 8:12 am

Post by bartab » Mon May 03, 2004 4:06 am

forage is a skill that is level capped meaning that you can go to 200 only if your toon is lvl 39 and higher.
in fact you can gain 5 levels in forage every 1 level. that's not the exact formula but it's something like that.
so your charachter seems to be lvl 5 or 6 ... :roll:

amml
a lesser mummy
a lesser mummy
Posts: 68
Joined: Thu Apr 22, 2004 4:55 pm

Post by amml » Mon May 03, 2004 9:29 am

hehe no he got lvl 12 by doing some bone chips handin lol :) now the problem was just that his intelligence was at 72, wisdom even lower hehe, so hes just too stupid to learn anything lol :) but good to know about the cap, thx...