Page 1 of 1

Blessing of the flower God macro?

Posted: Sun Mar 02, 2014 8:39 am
by Montoro
Hello

Can anyone be so kind to make a small macro to be able to buy a lot of Blessing of the flower God from Adam "flower Spirit Envoy" in central plaza of varanas, one of the NPC from the flower event?

Thanks!!

Re: Blessing of the flower God macro?

Posted: Sun Mar 02, 2014 9:21 am
by ZZZZZ
In game macro:

Code: Select all

/run CastSpellByName("Attack")
/wait.5
/script ChoiceOption(2)
/wait.5
/script ChoiceOption(1)

Rombot function:

Code: Select all

function FG()
   repeat
   inventory:update();
		player:target_NPC("Adam");
		yrest(500);
		RoMScript("ChoiceOption(2);");
		yrest(500);
		RoMScript("ChoiceOption(1);");
   until inventory:itemTotalCount(0) == 0
end
simple and easy.
I tried making a more informative one but for some reason it doesn't stop at the specified amount....

Code: Select all

function FG()
   blankslots = inventory:itemTotalCount(0)
   FlowersToGet = (blankslots*10)
   repeat
   inventory:update();
		player:target_NPC("Adam");
		yrest(500);
		RoMScript("ChoiceOption(2);");
		yrest(500);
		RoMScript("ChoiceOption(1);");
   until inventory:itemTotalCount(203024) == FlowersToGet
   printf("\nCollected "..FlowersToGet.." Blessing of the Flower God\n")
end

Re: Blessing of the flower God macro?

Posted: Mon Mar 03, 2014 8:20 am
by noobbotter
I tried making a more informative one but for some reason it doesn't stop at the specified amount....
Maybe you need either a yrest after the last line of the repeat function RoMScript("ChoiceOption(1);"); and/or an inventory:update() after the purchase of each item is complete?

Re: Blessing of the flower God macro?

Posted: Mon Mar 03, 2014 8:47 am
by lisa
My guess is that it will stop 9 before you intend it to

itemTotalCount does it's own update, so yeah no need for the update.

a yrest after the last option would help with more accurate item count but at the end of the day once u get the first of the last stack it will fail because it will just keep saying inventory is full, itemTotalCount will also be 0 when that first item of last stack hits bag aswell because there will be no empty slots.

All I do is set up a for i = 1,X do and have the X set when you call function.

Code: Select all

function FG(X)
   for i = 1,X do
      player:target_NPC("Adam");
      yrest(500);
      RoMScript("ChoiceOption(2);");
      yrest(500);
      RoMScript("ChoiceOption(1);");
      yrest(500);
   end
end
I just edited the code posted previously.

so on commandline just do
FG(30)

Re: Blessing of the flower God macro?

Posted: Tue Mar 04, 2014 8:48 am
by ZZZZZ
Na, it actually doesnt stop at all once bags are full. It *should* get the max you can, hence the (blankslots*10). But for some reason it doesnt stop when it reaches that value :(

edit: never mind....just after I had post this I realised what is wrong with it....

Code: Select all

until inventory:itemTotalCount(203024) == FlowersToGet
should be

Code: Select all

until inventory:itemTotalCount(203024) >= FlowersToGet
darn little things like that :/

Re: Blessing of the flower God macro?

Posted: Tue Mar 04, 2014 9:17 am
by Montoro
i have to apologyze for asking this, but, could you please add to this post directly the waypoint script (xml) for the people and me to download, so that we put it into the waypoint folder and finish? I know nothing about creating an script with what you are writing, and for that reason, for me, it doesn't work at all only copy-pasting.

thanks!! :oops:

Re: Blessing of the flower God macro?

Posted: Tue Mar 04, 2014 10:03 am
by noobbotter
I took what ZZZZZ put together and put it in a waypoint file for you. This is untested.

Re: Blessing of the flower God macro?

Posted: Mon Mar 17, 2014 9:01 pm
by spyfromsiochain
noobbotter wrote:I took what ZZZZZ put together and put it in a waypoint file for you. This is untested.
the only condition regarding currency is 999 gold for ea flower.

There is a small typo on the waypoint done by noobbotter.

uploaded the fix.

credits maintained

regards

Re: Blessing of the flower God macro?

Posted: Tue Mar 18, 2014 1:19 am
by ZZZZZ
Changed the function around a bit, this way it'll only buy what it can, taking gold into consideration.

Code: Select all

	function FG()
		blankslots = inventory:itemTotalCount(0)
		MaxToBuy = (blankslots*10)
		gold = RoMScript('GetPlayerMoney("copper");')
		LimitToBuy = math.floor(gold/999)
		if MaxToBuy > LimitToBuy then
			FlowersToGet = LimitToBuy
		else
			FlowersToGet = MaxToBuy
		end
		CurrentFlowers = inventory:itemTotalCount(203024)
		FlowersToGet = (FlowersToGet + CurrentFlowers)
		repeat
			inventory:update();
			player:target_NPC(112187); -- Adam
			yrest(500);
			RoMScript("ChoiceOption(2);");
			yrest(500);
			RoMScript("ChoiceOption(1);");
		until inventory:itemTotalCount(203024) >= FlowersToGet
		printf("\nCollected "..(FlowersToGet - CurrentFlowers).." Blessing of the Flower God\n")
	end