Openkore.com

OpenKore Forums
It is currently 12 Dec 2018, 08:53

All times are UTC - 5 hours [ DST ]





Post new topic Reply to topic  [ 12 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Stuck autosell/autobuy
PostPosted: 22 Dec 2017, 02:05 
Offline
Noob
Noob

Joined: 19 Dec 2017, 13:57
Posts: 9
my bot keeps getting stuck at auto buying probably because of the max weight autosell,autostore.
is there a way to autosell first then only auto buy or autosell everytime i go back to town


Top
 Profile  
 
 Post subject: Re: Stuck autosell/autobuy
PostPosted: 22 Dec 2017, 03:29 
Offline
OpenKore Monk
OpenKore Monk
User avatar

Joined: 17 Nov 2017, 23:32
Posts: 485
Location: Genting Highland, Malaysia
Macro

http://wiki.openkore.com/index.php/Macro_plugin
http://openkore.com/index.php/EventMacro

_________________

I'll not give answer. I'll just showing you the way to find it
Wiki & Google are your best allies. If you're lazy to read I won't bother answering
Image


Top
 Profile  
 
 Post subject: Re: Stuck autosell/autobuy
PostPosted: 22 Dec 2017, 07:39 
Offline
Human
Human

Joined: 28 Nov 2010, 00:57
Posts: 32
This is the same case we were talking in the github fadreus! (fvegini)


How would you do an eventMacro to "always sell before buy"?


In the old macros.txt i used to have one "console /calculating route to auto buy/ call {do autosell}"

But I don't know how to make one without the console


Top
 Profile  
 
 Post subject: Re: Stuck autosell/autobuy
PostPosted: 22 Dec 2017, 07:58 
Offline
OpenKore Monk
OpenKore Monk
User avatar

Joined: 17 Nov 2017, 23:32
Posts: 485
Location: Genting Highland, Malaysia
Why you wanna use eventMacro when you can use normal macro? :shock:
If you really masochist type ( :lol: :lol: :lol: ) going da trouble with eventMacro, you can use something like this

Code:
automacro OhShetRedPotGone {
   InMap pay_in01
   exclusive 1
   run-once 1
   call CrapBetterBuyPot
}

macro CrapBetterBuyPot {
   if (&invamount (Red Potion) <= 0) goto ShetBotDumbCantCalculateWeight
   stop

   :ShetBotDumbCantCalculateWeight
   do autosell; release GotMaPotNowMaNigga
   stop
}

automacro GotMaPotNowMaNigga {
   inMap payon
   run-once 1
   exclusive 1
   call YeyMaNiggaPotIsHere
}

macro YeyMaNiggaPotIsHere {
   if (&invamount (Red Potion) <= 0) goto ShetAintBuyNoPot
   if (&invamount (Red Potion) >= 300) goto ThisPotAintGoingNoWhereNow

   :ShetAintBuyNoPot
   call CrapBetterBuyPot

   :ThisPotAintGoingNoWhereNow
   release OhShetRedPotGone
   log I Got Ma Nigga Pot Now!
}

_________________

I'll not give answer. I'll just showing you the way to find it
Wiki & Google are your best allies. If you're lazy to read I won't bother answering
Image


Top
 Profile  
 
 Post subject: Re: Stuck autosell/autobuy
PostPosted: 22 Dec 2017, 08:26 
Offline
Human
Human

Joined: 28 Nov 2010, 00:57
Posts: 32
fadreus wrote:
Why you wanna use eventMacro when you can use normal macro? :shock:
If you really masochist type ( :lol: :lol: :lol: ) going da trouble with eventMacro, you can use something like this

Code:
automacro OhShetRedPotGone {
   InMap pay_in01
   exclusive 1
   run-once 1
   call CrapBetterBuyPot
}

macro CrapBetterBuyPot {
   if (&invamount (Red Potion) <= 0) goto ShetBotDumbCantCalculateWeight
   stop

   :ShetBotDumbCantCalculateWeight
   do autosell; release GotMaPotNowMaNigga
   stop
}

automacro GotMaPotNowMaNigga {
   inMap payon
   run-once 1
   exclusive 1
   call YeyMaNiggaPotIsHere
}

macro YeyMaNiggaPotIsHere {
   if (&invamount (Red Potion) <= 0) goto ShetAintBuyNoPot
   if (&invamount (Red Potion) >= 300) goto ThisPotAintGoingNoWhereNow

   :ShetAintBuyNoPot
   call CrapBetterBuyPot

   :ThisPotAintGoingNoWhereNow
   release OhShetRedPotGone
   log I Got Ma Nigga Pot Now!
}



The use macro.txt "console" function makes the kore a bit slower! (at least is what everyone says)

Your idea would work if the only item the kore will buy is red potion!
But in the scenario where it buys red potion and fly wing... if the fly wing is over but openkore still have some red potion in inventory it will never proc.


When i got home I will test this... but it should work


src\Network\Receive\ServerType0.pm

Lines 1350

Code:
   } elsif ($args->{fail} == 1) {
      error T("Buy failed (insufficient zeny).\n");
   } elsif ($args->{fail} == 2) {
      error T("Buy failed (insufficient weight capacity).\n");


Change to:

Code:
   } elsif ($args->{fail} == 1) {
      error T("Buy failed (insufficient zeny).\n");
      use Plugins;
      Plugins::callHook("Buy_failed");
   } elsif ($args->{fail} == 2) {
      error T("Buy failed (insufficient weight capacity).\n");
      use Plugins;
      Plugins::callHook("Buy_failed");



And in eventMacros.txt

Code:
automacro autoSellWhenBuyCrash {
   SimpleHookEvent Buy_failed
   run-once 1
   call {
      do autosell
      pause 2
      release autoSellWhenBuyCrash
   }
}


Top
 Profile  
 
 Post subject: Re: Stuck autosell/autobuy
PostPosted: 22 Dec 2017, 08:49 
Offline
OpenKore Monk
OpenKore Monk
User avatar

Joined: 17 Nov 2017, 23:32
Posts: 485
Location: Genting Highland, Malaysia
Yaham wrote:
The use macro.txt "console" function makes the kore a bit slower! (at least is what everyone says)


Slower? How many milliseconds? :? I see no different.

Yaham wrote:
Your idea would work if the only item the kore will buy is red potion!


Nope. When running command autosell, autobuy and autostorage will follow up.
When doing autobuy, everything set to buy will be restocked to maxAmount.

Quote:
it will never proc

The only trigger I've made is when inMap pay_in01.
And other is inMap payon.

It will proc.
;)

If you read the previous post, I've deleted it 'coz I was high on sugar xD Hahahaha..

_________________

I'll not give answer. I'll just showing you the way to find it
Wiki & Google are your best allies. If you're lazy to read I won't bother answering
Image


Last edited by fadreus on 22 Dec 2017, 08:58, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Stuck autosell/autobuy
PostPosted: 22 Dec 2017, 08:56 
Offline
Human
Human

Joined: 28 Nov 2010, 00:57
Posts: 32
fadreus wrote:
Yaham wrote:
The use macro.txt "console" function makes the kore a bit slower! (at least is what everyone says)


Slower? How many milliseconds? :?

Yaham wrote:
Your idea would work if the only item the kore will buy is red potion!
But in the scenario where it buys red potion and fly wing... if the fly wing is over but openkore still have some red potion in inventory it will never proc.


Nope. When you put command autosell, autobuy and autostorage will follow up.
When doing autobuy, everything you set to buy will be restocked to maxAmount.
It will proc.



I read a thread about why they didn't implement "console" option in eventMacro a few months ago.. don't remember exactly the arguments, but was something with "console" needs to check every single char that openkore sends... demanding an huge amount o CPU to only this function!


But it seems to me the autosell won't be triggered unless the Red Potion got to 0

If fly wing is 0 and red potion is 50
Autobuy is triggered... he tries to buy the "buy_auto" list
Try to buy the red potion to complete the 300.... stuck by weight!
automacro OhShetRedPotGone trigger
Red potion isn't <= 0 so don't go to :ShetBotDumbCantCalculateWeight


Top
 Profile  
 
 Post subject: Re: Stuck autosell/autobuy
PostPosted: 22 Dec 2017, 09:08 
Offline
OpenKore Monk
OpenKore Monk
User avatar

Joined: 17 Nov 2017, 23:32
Posts: 485
Location: Genting Highland, Malaysia
Yaham wrote:
I read a thread about why they didn't implement "console" option in eventMacro a few months ago.. don't remember exactly the arguments, but was something with "console" needs to check every single char that openkore sends... demanding an huge amount o CPU to only this function!


Hmm.. Really? I always use console condition & my sleepTime is 250000.
My CPU only 1.3 Ghz. No problemo.

Yaham wrote:
But it seems to me the autosell won't be triggered unless the Red Potion got to 0

If fly wing is 0 and red potion is 50
Autobuy is triggered... he tries to buy the "buy_auto" list
Try to buy the red potion to complete the 300.... stuck by weight!
automacro OhShetRedPotGone trigger
Red potion isn't <= 0 so don't go to :ShetBotDumbCantCalculateWeight


Simple; change
Code:
if (&invamount (Red Potion) <= 0) goto ShetBotDumbCantCalculateWeight


to
Code:
if (&invamount (Red Potion) <= 300) goto ShetBotDumbCantCalculateWeight


I just give suggestion.
Edit as you see fit.
Don't have to follow letter by letter (which is why I use nigga there :lol: :lol: :lol: )
Hahahahahaha...

_________________

I'll not give answer. I'll just showing you the way to find it
Wiki & Google are your best allies. If you're lazy to read I won't bother answering
Image


Top
 Profile  
 
 Post subject: Re: Stuck autosell/autobuy
PostPosted: 22 Dec 2017, 09:18 
Offline
OpenKore Monk
OpenKore Monk
User avatar

Joined: 17 Nov 2017, 23:32
Posts: 485
Location: Genting Highland, Malaysia
Well, indeed eventMacro is more efficient but what's the point if I can't use as I wanted (by using hooks).
As for now, I using both macro and eventMacro; calling out each other and clearing/disabling one another.
EventMacro is still new and I haven't use it much.
To lazy writing all the stuff just for performance increase while using macro have nothing much different.
;)

_________________

I'll not give answer. I'll just showing you the way to find it
Wiki & Google are your best allies. If you're lazy to read I won't bother answering
Image


Top
 Profile  
 
 Post subject: Re: Stuck autosell/autobuy
PostPosted: 22 Dec 2017, 09:37 
Offline
Human
Human

Joined: 28 Nov 2010, 00:57
Posts: 32
I never had problems too... but just to be safe i'm slowing converting everything to eventMacros

I know you're just giving an suggestion!

I'm just showing some "errors" that may occur if he basically just copy paste the new code!




I never used hooks with the macros.txt, console aways supplyed everythin i always needed.
But now with eventMacro i'm using some simple hooks, like the one i posted earlyer.

Convert from macros to eventMacros really takes time... but in the end is kind of satisfying see that everything is running according to the plan! haha


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group