Need Help: Storage State Problem

This place is for Closed bug reports only. NOT for asking help!

Moderators: Moderators, Developers

Message
Author
Uzah
Human
Human
Posts: 25
Joined: 04 Jun 2011, 18:29
Noob?: Yes
Location: pRO Payon

Need Help: Storage State Problem

#1 Post by Uzah »

Currently I'm using this storage state to check whether the storage is either open or closed.

Code: Select all

eval ((exists $::storage{opened}?1:0) == 0)
The bot considers the storage closed if the value is equal to zero; and, open if the value is equal to 1.

The problem is when you get disconnected while the storage is open, the storage state value remains 1; or in other words, the bot still deems the storage open.

And by the way, here's my automacros to illustrate the problem:

Code: Select all

automacro Talk {
	eval ((exists $::storage{opened}?1:0) == 0)
	location geffen 204 131
	exclusive 1
	call {
		do talknpc 203 123 c r1
		pause 2
		}
	}

automacro Get Items {
	priority 10
	eval ((exists $::storage{opened}?1:0) == 1)
	location geffen 204 131
	exclusive 1
	set ainc 250
	set ablue 300
	set asun 15
	set afud 20
	set aguy 25
	set agem 30
	call Evaluate
	}
Whenever I get disconnected while the storage is open then reconnected, "automacro Get Items" keeps triggering causing me to get disconnected repeatedly.

Is there a way to make the storage state value return to 0 every time I get disconnected? Thanks in advance.
What have you done so far?

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: Need Help: Storage State Problem

#2 Post by EternalHarvest »

That's a bug in openkore. Storage state reset should be added to initMapChangeVars in functions.pl.

Uzah
Human
Human
Posts: 25
Joined: 04 Jun 2011, 18:29
Noob?: Yes
Location: pRO Payon

Re: Need Help: Storage State Problem

#3 Post by Uzah »

I see. So, I guess I should make some experimentation in function.pl? I'm hoping that would be easy though.

Edit: I'll just forget it. When I saw functions.pl, it's completely different from automacros that I'm currently learning. *Gloomy*
What have you done so far?

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: Need Help: Storage State Problem

#4 Post by EternalHarvest »

Just try adding the following line (taken from storage_closed packet handler) inside "sub initMapChangeVars":

Code: Select all

delete $storage{opened};
As closing storage doesn't empty item list, we may skip that here too for a moment and just mark storage as closed.

Uzah
Human
Human
Posts: 25
Joined: 04 Jun 2011, 18:29
Noob?: Yes
Location: pRO Payon

Re: Need Help: Storage State Problem

#5 Post by Uzah »

Thank you, you're a genius!! It works perfectly. I tried disconnecting my bot 20 times while the storage is open and *pooff *!! It's no longer malfunctioning!!
I'm aware that you don't support spoon-feeding; however, when I opened functions.pl, I was overwhelmed by unfamiliar symbols and functions written there and made me surrender.
I just realize that help sometimes comes when least expected. Thanks again.
What have you done so far?

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: Need Help: Storage State Problem

#6 Post by EternalHarvest »

Fixed in r7914.

Post Reply