Log in

View Full Version : Drop Empty Vial? [NOT potion flask]



Colte
09-27-2013, 05:03 PM
I am currently making a script for POI Dragon Lords and I decided to carry a bp of oil and blood with me at all times since my withdrawer fucked up.
Now here's the thing, it works good the first round and uses the blood and oil, but the second round it tries to use the first item in my oil/blood bp, and that item is now an empty vial because it was used in the round before it.

Now I need some line of code to drop the first item in my oil/blood bp after using it. Like this:
Blood
vialBp:DropItems(Self.Position().x, Self.Position().y, Self.Position().z, 2874)
Oil
oilBp:DropItems(Self.Position().x, Self.Position().y, Self.Position().z, 2874)

But this will drop ALL of them. Is there a way to find the first index in the backpack and only drop that item.
Note: ALL vials have the same item ID.

Colte
09-28-2013, 12:36 AM
bumpssssss

Flappy Joe
09-28-2013, 01:14 AM
Do you not just want a script that will drop an empty vial if it's in your bp?

function dropItem(id)
local cont = Container.GetFirst()

while (cont:isOpen()) do
for spot = 0, cont:ItemCount() do
local item = cont:GetItemData(spot)
if (item.id == id) then
cont:MoveItemToGround(spot, Self.Position().x, Self.Position().y, Self.Position().z)
return true
end
end

cont = cont:GetNext()
end

return false
end


while(true) do
local c = Container.GetByName("Golden Backpack")
local vials = 1

if(c:CountItemsOfID(2874) >= vials) then
dropItem(2874)
end
wait(700,1200)
end

All you need to do is change the name of your backpack that they'll be in.

Colte
09-28-2013, 09:09 AM
Do you not just want a script that will drop an empty vial if it's in your bp?

function dropItem(id)
local cont = Container.GetFirst()

while (cont:isOpen()) do
for spot = 0, cont:ItemCount() do
local item = cont:GetItemData(spot)
if (item.id == id) then
cont:MoveItemToGround(spot, Self.Position().x, Self.Position().y, Self.Position().z)
return true
end
end

cont = cont:GetNext()
end

return false
end


while(true) do
local c = Container.GetByName("Golden Backpack")
local vials = 1

if(c:CountItemsOfID(2874) >= vials) then
dropItem(2874)
end
wait(700,1200)
end

All you need to do is change the name of your backpack that they'll be in.

I want a script to drop the first item in a certain backpack.
It should not depend on Item ID. But maybe your script works, to drop 1.
I'll try it, ty.

Edit:
11:21 XenoScript Error:
Script: POI.lua
Line #: 114
Chunk: C:?Users?Admin?Documents?XenoBot?Scripts?POI.lua
Error: attempt to call global 'dropItem' (a nil value)
This is an error with user-input and should not be reported as a bug with XenoBot.

dropItem(2874)

Colte
09-28-2013, 10:05 AM
got it to work, ty!

Realized another solution is to sell the empty vial at the pot store each round, "hi > flask > yes"
>.<

Flappy Joe
09-28-2013, 11:50 AM
got it to work, ty!

Realized another solution is to sell the empty vial at the pot store each round, "hi > flask > yes"
>.<

Hahaha that's one way of making it work, sorry my script didn't work.

teilrmoun
07-27-2015, 02:03 AM
Can anyone help me? i've got this problem everytime i try to exec that script:
23:02 XenoScript Error:
Script: dropflask.lua
Line #: 1
Chunk: C:?Users?Igor?DOCUME?1?XenoBot?Scripts??DROPFL?1.L UA
Error: <name> or '...' expected near '285'
This is an error with user-input and should not be reported as a bug with XenoBot.

All I did was change the item id on function dropItem(id)