[Macro] How can I trigger "inventory" properly?

All about the macro plugin can be found in this forum. This forum is intended for the macro plugin only.

Moderator: Moderators

Message
Author
gelo2012
Plain Yogurt
Plain Yogurt
Posts: 58
Joined: 17 Sep 2012, 13:54
Noob?: Yes
Location: Sa Puso Mo

[Macro] How can I trigger "inventory" properly?

#1 Post by gelo2012 »

I'm doing a macro config which will warp to geffen then buy Blue Gemstone IF Blue Gemstone is < 10.
Here's my automacro code:

Code: Select all

automacro lowBlue {
	inventory "Blue Gemstone" < 10
	aggressives < 1
	run-once 1
}
The problem is, it always triggers the code even if my bot has 200+ Blue Gemstones.
This happens right after the map is loaded. I think it triggers because the bot detects no blue gemstone upon map load.
But I don't know what to do to make the bot detect that it's already got Blue Gemstone > 10.
should I use this instead?:
http://forums.openkore.com/viewtopic.ph ... ory#p61331
and how can I use this code to read the amount of Blue Gemstone in my inventory upon map load?
BTW I am playing at pRO valkyrie. I'm using OpenKore r8376.

gamenikko
The Way Of Human
The Way Of Human
Posts: 192
Joined: 16 Aug 2009, 03:47
Noob?: Yes
Location: Gonryun

Re: [Macro] How can I trigger "inventory" properly?

#2 Post by gamenikko »

I really dont know if this will work, never tested it yet
but you can give it a try, sorry :P
and yeah, sometimes macro plugin does trigger false at inventory parameters.

Code: Select all

automacro check {
    timeout 180 call {
        if ( checkInvBG() != 1 ) {
			#gemstones are out, initating auto-buy
            call buyGem;
        }
    }
}

sub checkInvBG {
    foreach my $item ( @{ $char->inventory->getItems() } ) {
        if ( $item->{name} eq "Blue Gemstone" ) {
           return 1;
        }
    }
}
Just like old times.

Raider
The Kore Devil
The Kore Devil
Posts: 672
Joined: 22 Feb 2013, 03:40
Noob?: No
Location: The Netherlands

Re: [Macro] How can I trigger "inventory" properly?

#3 Post by Raider »

Found this in the FAQ:
I have an automacro that checks for the amount of an item in my inventory / cart to be less than a given value or equal to zero (e.g. inventory "red potion" <= 30) but that automacro triggers also on map change. Why is that so and what should I do?

When you're changing the map all items vanish from your inventory for a short time. That happens with the official client, too. To avoid this, add an additional check for an item that you always carry with you, like inventory "Jellopy" > 0

gelo2012
Plain Yogurt
Plain Yogurt
Posts: 58
Joined: 17 Sep 2012, 13:54
Noob?: Yes
Location: Sa Puso Mo

Re: [Macro] How can I trigger "inventory" properly?

#4 Post by gelo2012 »

gamenikko wrote:I really dont know if this will work, never tested it yet
but you can give it a try, sorry :P
and yeah, sometimes macro plugin does trigger false at inventory parameters.

Code: Select all

automacro check {
    timeout 180 call {
        if ( checkInvBG() != 1 ) {
			#gemstones are out, initating auto-buy
            call buyGem;
        }
    }
}

sub checkInvBG {
    foreach my $item ( @{ $char->inventory->getItems() } ) {
        if ( $item->{name} eq "Blue Gemstone" ) {
           return 1;
        }
    }
}
Raider wrote:Found this in the FAQ:
I have an automacro that checks for the amount of an item in my inventory / cart to be less than a given value or equal to zero (e.g. inventory "red potion" <= 30) but that automacro triggers also on map change. Why is that so and what should I do?

When you're changing the map all items vanish from your inventory for a short time. That happens with the official client, too. To avoid this, add an additional check for an item that you always carry with you, like inventory "Jellopy" > 0
Thank you guys, i'll try it all. :)

gelo2012
Plain Yogurt
Plain Yogurt
Posts: 58
Joined: 17 Sep 2012, 13:54
Noob?: Yes
Location: Sa Puso Mo

Re: [Macro] How can I trigger "inventory" properly?

#5 Post by gelo2012 »

Why does this happen:
Image
When I put this code in macro:

Code: Select all

$ygg = @inventory (Ygddrasil Berry)
	pause 2
	do deal add $ygg 3

Post Reply