Page 1 of 1

Problem with buying items.

Posted: Tue Sep 27, 2011 6:08 pm
by gloover
Hey guys,

I want to buy transmuter charges with this code

Code: Select all

   if (inventory:getItemCount(203038)) > 30 then 
		player:target_NPC("Lehman");
		sendMacro("ChoiceOption(1);");yrest(500);
		sendMacro("ChoiceOption(1);");yrest(500);
    
		while 30 > inventory:getItemCount(203038) do
			RoMScript("StoreBuyItem(1,1)");yrest(200);
			inventory:update();
		end;
		
		sendMacro("CloseWindows();"); yrest(50);
	end;
203038=Phirius Token Coin

something seems to running wrong, the bot opens the dialog window and then close those. My while-loop seems not to working - can someone me help, please!

Re: Problem with buying items.

Posted: Tue Sep 27, 2011 9:32 pm
by rock5
You say it opens the dialog but does it open the store? Those yrests might just be too short. Try using bigger values to give time for the dialog to change pages.

Re: Problem with buying items.

Posted: Wed Sep 28, 2011 2:34 am
by gloover
Hi rock,

yes, the store is open and even if i increase the yrest, it seems to ignore/skip this while-loop. I have defenitely more than 30 coins.

This code

Code: Select all

	if (inventory:getItemCount(203038)) > 30 then 
		player:target_NPC("Lehman");
		sendMacro("ChoiceOption(1);");yrest(300);
		sendMacro("ChoiceOption(1);");yrest(300);

			RoMScript("StoreBuyItem(1,1)");yrest(50);
			RoMScript("StoreBuyItem(1,1)");yrest(50);
			RoMScript("StoreBuyItem(1,1)");yrest(50);
		
		sendMacro("CloseWindows();"); yrest(50);
	end;
works fine, the bot get 3 charges, but using a loop seems to make a problem :-(

Re: Problem with buying items.

Posted: Wed Sep 28, 2011 3:51 am
by rock5
I just went to have a look at LehMan's options. Option 1 is not the store for me. I would have to use

Code: Select all

      sendMacro("ChoiceOption(4);");yrest(300);
      sendMacro("ChoiceOption(1);");yrest(300);
You might want to double check the options.


Wait a second! You can exchange for attributes now? Since when has this been available? What are "Spirit Points"?

Re: Problem with buying items.

Posted: Wed Sep 28, 2011 4:56 am
by gloover
rock5 wrote: Wait a second! You can exchange for attributes now? Since when has this been available? What are "Spirit Points"?
Whaddayathink? Spirit points? I can nowhere detect this options! Lehman is the transmutor-NPC in the class-hall in Varanas.
Selecting Lehmen I have as first option "Exchange phirius coins for transmutor charges" as second "where I can buy random fusuin stones" and third "resume..." So using the first option opens the dialog "Phirius coin shop" and "resume...".
I nowhere see the 4th. option!

Code: Select all

 player:target_NPC("Lehman");
      sendMacro("ChoiceOption(1);");yrest(300);
      sendMacro("ChoiceOption(1);");yrest(300);
opens the phirius coin shop.

As allready said, this one

Code: Select all

 if (inventory:getItemCount(203038)) > 30 then
      player:target_NPC("Lehman");
      sendMacro("ChoiceOption(1);");yrest(300);
      sendMacro("ChoiceOption(1);");yrest(300);

         RoMScript("StoreBuyItem(1,1)");yrest(50);
         RoMScript("StoreBuyItem(1,1)");yrest(50);
         RoMScript("StoreBuyItem(1,1)");yrest(50);
      
      sendMacro("CloseWindows();"); yrest(50);
   end;
works fine, but how to realize this using a loop, till all phirius-coins (>30) are used?

Re: Problem with buying items.

Posted: Wed Sep 28, 2011 5:41 am
by gloover
Groovy!
this one works now

Code: Select all

	if (inventory:getItemCount(203038)) > 30 then 		
		player:target_NPC("Lehman");
		sendMacro("ChoiceOption(1);");yrest(300);
		sendMacro("ChoiceOption(1);");yrest(300);
				
		while (inventory:itemTotalCount(203038) > 30) do
			inventory:storeBuyItem(1,1);yrest(100);
		end
		
		sendMacro("CloseWindows();"); yrest(100);
	
	end;	
Another question: how to read out how many charges are in the magic box loaded?

Re: Problem with buying items.

Posted: Wed Sep 28, 2011 5:45 am
by rock5
You beat me to it. Good for you.:)

But you should change "> 30" to ">=30" otherwise it wont buy if you have exactly 30 coins.

GetMagicBoxEnergy() will give you the number of charges. Of course from the bot you would need to use RoMScript to get it.