Stuck autosell/autobuy

For everything NOT server specific support. Do NOT ask for connectivity help here!.

Moderator: Moderators

Message
Author
xnewb123
Noob
Noob
Posts: 9
Joined: 19 Dec 2017, 13:57
Noob?: Yes

Stuck autosell/autobuy

#1 Post by xnewb123 »

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

User avatar
fadreus
The Kore Devil
The Kore Devil
Posts: 708
Joined: 17 Nov 2017, 23:32
Noob?: No
Location: Genting Highland, Malaysia
Contact:

Re: Stuck autosell/autobuy

#2 Post by fadreus »


iRO Supporter.
Read before you ask is the wisest thing human can do.
Unless you're a cat.
Image

Yaham
Human
Human
Posts: 31
Joined: 28 Nov 2010, 00:57
Noob?: No

Re: Stuck autosell/autobuy

#3 Post by Yaham »

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

User avatar
fadreus
The Kore Devil
The Kore Devil
Posts: 708
Joined: 17 Nov 2017, 23:32
Noob?: No
Location: Genting Highland, Malaysia
Contact:

Re: Stuck autosell/autobuy

#4 Post by fadreus »

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: Select all

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!
}

iRO Supporter.
Read before you ask is the wisest thing human can do.
Unless you're a cat.
Image

Yaham
Human
Human
Posts: 31
Joined: 28 Nov 2010, 00:57
Noob?: No

Re: Stuck autosell/autobuy

#5 Post by Yaham »

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: Select all

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: Select all

	} 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: Select all

	} 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: Select all

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

User avatar
fadreus
The Kore Devil
The Kore Devil
Posts: 708
Joined: 17 Nov 2017, 23:32
Noob?: No
Location: Genting Highland, Malaysia
Contact:

Re: Stuck autosell/autobuy

#6 Post by fadreus »

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.
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..
Last edited by fadreus on 22 Dec 2017, 08:58, edited 1 time in total.

iRO Supporter.
Read before you ask is the wisest thing human can do.
Unless you're a cat.
Image

Yaham
Human
Human
Posts: 31
Joined: 28 Nov 2010, 00:57
Noob?: No

Re: Stuck autosell/autobuy

#7 Post by Yaham »

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

User avatar
fadreus
The Kore Devil
The Kore Devil
Posts: 708
Joined: 17 Nov 2017, 23:32
Noob?: No
Location: Genting Highland, Malaysia
Contact:

Re: Stuck autosell/autobuy

#8 Post by fadreus »

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: Select all

if (&invamount (Red Potion) <= 0) goto ShetBotDumbCantCalculateWeight
to

Code: Select all

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...

iRO Supporter.
Read before you ask is the wisest thing human can do.
Unless you're a cat.
Image

User avatar
fadreus
The Kore Devil
The Kore Devil
Posts: 708
Joined: 17 Nov 2017, 23:32
Noob?: No
Location: Genting Highland, Malaysia
Contact:

Re: Stuck autosell/autobuy

#9 Post by fadreus »

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.
;)

iRO Supporter.
Read before you ask is the wisest thing human can do.
Unless you're a cat.
Image

Yaham
Human
Human
Posts: 31
Joined: 28 Nov 2010, 00:57
Noob?: No

Re: Stuck autosell/autobuy

#10 Post by Yaham »

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

Post Reply