Page 3 of 6

Re: Cleanbag userfunction 2.3

Posted: Sat Jan 05, 2013 11:20 am
by kenzu38
Hey guyz, is there a way I can make this function keep any type of Phirius potion without having to list all of them in the forcekeep table?

Thanks.

Re: Cleanbag userfunction 2.3

Posted: Sat Jan 05, 2013 12:01 pm
by botje
err... you mean it trows them out? O.o

i didnt know phirius would be seen as a normal potion...

you could do what i do in the meantime, adjust your <option name="INV_AUTOSELL_FROMSLOT" value="13" />

to only check from slot 13, which leaves the first 2 rows alone, i always do that to store stuff i really need to keep.

and ill see if i can fix the potions from dropping :)

Re: Cleanbag userfunction 2.3

Posted: Sat Jan 05, 2013 12:26 pm
by botje
i have no idea how to differenciate phirius from normal potions >.<

perhaps rock could help me? :P

Re: Cleanbag userfunction 2.3

Posted: Sat Jan 05, 2013 12:36 pm
by rock5
They have the word "Phirius" in the name? ;) Or maybe you could use a list of the Phirius pot ids. There can't be that many of them.

Re: Cleanbag userfunction 2.3

Posted: Sat Jan 05, 2013 12:40 pm
by botje
do we have something like StringInString in lua?

would

if not string.find(item.Name, "phirius") then
item:delete();
end

work in the bot?

Re: Cleanbag userfunction 2.3

Posted: Sat Jan 05, 2013 1:26 pm
by kenzu38
Hi botje, thanks for responding.

Actually, I already added some of them to the forcekeep table, so this is how my CleanBag lua file looks atm:

Code: Select all

-- version 2.3 --
-- sell prize = value which drops all below it
-- rarity = / 0 = white / 1 = green / 2 = blue / 3 = purple / 4 = orange / 5 = gold
-- drop true/false = if allready learned recipes should be dropped
function CleanBag(sellprize, rarity, drop, logg)
	inventory:update();
	
	-- custom database for user added items to trow out
	forcedrop = {
		"Lost Gift",
	}
	
	-- custom database for user added items to keep
	forcekeep = {
		"Blend Rune",
		"Phirius Potion - Type A",
		"Phirius Potion - Type B",
		"Phirius Elixir - Type A",
		"Phirius Elixir - Type B"
	}
	
I tested it using commandline, typed CleanBag() and it still deletes the items in the forcekeep table. I also tested it with a normal waypoint file, which is the KS script found here in the forum. Same problem, still deletes said items.

Any idea what I am doing wrong?

Re: Cleanbag userfunction 2.3

Posted: Sat Jan 05, 2013 1:28 pm
by botje
it does? weird, when i tested it it worked just fine O.o

ill debug it.

Re: Cleanbag userfunction 2.3

Posted: Sat Jan 05, 2013 1:32 pm
by kenzu38
Lol that was some fast reply. Ok, thanks.

Re: Cleanbag userfunction 2.3

Posted: Sat Jan 05, 2013 1:59 pm
by botje
dunno what i did, but it works fine on my end, perhaps i changed something between uploads, so ill upload my current one so you can test :roll:

Re: Cleanbag userfunction 2.4

Posted: Sat Jan 05, 2013 2:14 pm
by botje
k, uploaded and updated, also SHOULD ignore phirius potions now xd

Re: Cleanbag userfunction 2.4

Posted: Sat Jan 05, 2013 3:15 pm
by kenzu38
Tested the new file just now, and it still didn't work.

But when I tried to change "phirius" into "Phirius" with a capital "P" then it worked. So string.find seems case-sensitive. You might want to change your uploaded file again.

Also, your forcekeep table still doesn't work. I think the problem is that this code:

Code: Select all

			for j, l in ipairs(forcekeep) do
				--printf("force Item:  "..l.."\n");
				--printf("Item name:  "..item.Name.."\n");
				if l == item.Name then
					--keep it
					printf("Keeping Item:  "..item.Name.."\n");
				else
...is overridden by the lines under it. So It just prints "Keeping item:" but it's deleting them anyway.

But I think you already found the solution with the line:

Code: Select all

						if not string.find(item.Name, "Phirius") then
Maybe something like this will work:

Code: Select all

					elseif item:isType("Runes") or item:isType("Production Runes") then
						if not string.find(item.Name,[forcekeep]) then
						item:delete()
Now, I don't know how to exactly make it string.find all the items listed in the forcekeep table, but if you can do that, then it could work.

Anyway, at least for now my Phirius potions don't get deleted. Thanks for helping out. :)


EDIT: Or maybe this is the proper code?

Code: Select all

				elseif item:isType("Runes") or item:isType("Production Runes") then
			                        for j, l in ipairs(forcekeep) do
						if not string.find(item.Name, l) then
							item:delete();
Can anyone help? Thanks.

Re: Cleanbag userfunction 2.4

Posted: Sat Jan 05, 2013 4:54 pm
by botje
seems its case sensitive indeed, ill change that.

i tested it with link runes, and it did'nt delete them, but that was after i took it out of my lootfilter xd

i forgot it was in lootfilter+, so it kept deleting it xd

and no, its not over ridden by the lower lines, because its in a if then statement.

edit: just tested it again, it prints keeping item, and keeps it, no deleting going on here O.o

Re: Cleanbag userfunction 2.4

Posted: Sat Jan 05, 2013 5:23 pm
by botje
perhaps rock or lisa could jump in with this problem, and perhaps see if they can optimize my code a bit, im sure its a bit slow xd

Re: Cleanbag userfunction 2.4

Posted: Sat Jan 05, 2013 5:37 pm
by lisa
botje wrote:perhaps rock or lisa could jump in with this problem, and perhaps see if they can optimize my code a bit, im sure its a bit slow xd
Sorry I haven't really been watching this thread, can you sum up the issue you are having and I'll see if I can help.

Re: Cleanbag userfunction 2.4

Posted: Sat Jan 05, 2013 5:42 pm
by kenzu38
Ok, now it's gotten weirder. When I only list one item to the forcekeep table, then it keeps that item. But when I list more, then it'll delete the items, even the first one on the list gets deleted as well as soon as I list more than one.

Whether I list it like this:

Code: Select all

	forcekeep = {
		"Purify Rune","Activate Rune",
	}
Or like this:

Code: Select all

	forcekeep = {
		"Purify Rune",
		"Activate Rune",
	}
As long as there's more than one on the list, then it deletes all in the list. So any idea why it's doing that?

Re: Cleanbag userfunction 2.4

Posted: Sat Jan 05, 2013 5:45 pm
by botje
basicly, the database i tried using in determining what items to keep fails, when you use more then 1 item it seems O.o

lets wait for guru assistance xd

Re: Cleanbag userfunction 2.4

Posted: Sat Jan 05, 2013 5:50 pm
by kenzu38
I think it's being overridden afterall. I don't know but maybe if you change this:

Code: Select all

			for j, l in ipairs(forcekeep) do
				--printf("force Item:  "..l.."\n");
				--printf("Item name:  "..item.Name.."\n");
				if l == item.Name then
					--keep it
					printf("Keeping Item:  "..item.Name.."\n");
				else
to this:

Code: Select all

			for j, l in ipairs(forcekeep) do
				--printf("force Item:  "..l.."\n");
				--printf("Item name:  "..item.Name.."\n");
				if l == item.Name then
					--keep it
					printf("Keeping Item:  "..item.Name.."\n");
				end
end
Then it'll probably work. Just guessing though, will try it out in a bit.

Re: Cleanbag userfunction 2.4

Posted: Sat Jan 05, 2013 5:53 pm
by botje
but that would stop all other processing of the items, and skip all lines below it, dont think that works.

Re: Cleanbag userfunction 2.4

Posted: Sat Jan 05, 2013 6:00 pm
by kenzu38
Lol yep, that idea didn't work. Now, I'm getting really puzzled over this. The forcedrop works fine, though, even if I list multiple items. It's just the forcekeep table giving me problems.

Re: Cleanbag userfunction 2.4

Posted: Sat Jan 05, 2013 6:08 pm
by botje
i know, i could replicate that O.o