Page 1 of 2

Forgae with .ini

Posted: Thu Apr 29, 2004 7:23 pm
by game_slave
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 

Posted: Fri Apr 30, 2004 7:18 am
by Garrik
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.

Posted: Fri Apr 30, 2004 11:14 am
by game_slave
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

Posted: Fri Apr 30, 2004 11:31 am
by Garrik
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

Posted: Fri Apr 30, 2004 12:45 pm
by Preocts

Code: Select all

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

Posted: Fri Apr 30, 2004 7:19 pm
by game_slave
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

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

Posted: Fri Apr 30, 2004 7:27 pm
by game_slave
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

Posted: Fri Apr 30, 2004 7:35 pm
by newb-n-training
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}

Posted: Fri Apr 30, 2004 7:37 pm
by Garrik
Works now.

Posted: Fri Apr 30, 2004 7:45 pm
by newb-n-training
fixed link too ......... dunno what the diff was ... whatever

Posted: Fri Apr 30, 2004 7:49 pm
by game_slave
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

Posted: Sat May 01, 2004 4:50 pm
by amml
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...)

Posted: Mon May 03, 2004 4:06 am
by bartab
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:

Posted: Mon May 03, 2004 9:29 am
by amml
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...