Page 1 of 1

[EventMacro] Refreshing Vending When Item is Sold out

Posted: 02 Feb 2018, 12:23
by ReynoldShakster
Can you test if my code works?
My server is in IRO Chaos Renewal
And here is my macro
Explanation: I want to wait 300seconds before reopening the shop. I am assuming that closing and reopening ("do closeshop" and "do openshop") will reset the vend to default number of items in shop.txt.

Code: Select all

#openkore vending refill - untested
automacro vendNFillFromCart {
    SimpleHookEvent vending_item_sold
    InCart “Creamy Card” > 0
    run-once 1
    call {
        if (&shopamount(Creamy Card) == 0) {
            delay 300
            do ai off
            pause 1
            do closeshop
            pause 1
            do stand
            pause 1
            do openshop
            pause 1
            do sit
            pause 1
            do ai on
            release vendNFillFromCart 
        } else {
            release vendNFillFromCart 
        }
    }
}
#In Shop.txt

Code: Select all

Creamy Card		4,000,000                 3

Re: [EventMacro] Refreshing Vending When Item is Sold out

Posted: 03 Feb 2018, 01:01
by fadreus
I use normal macro (not eventMacro)

Code: Select all

automacro Sold {
	cart "Creamy Card" > 0
	shop "Creamy Card" == 0
	run-once 1
	delay 300
	call ReShop
}

macro ReShop {
	do closeshop
	do openshop; release ReShop
}

Re: [EventMacro] Refreshing Vending When Item is Sold out

Posted: 03 Feb 2018, 01:46
by ReynoldShakster
Thanks, looks simpler