PDA

View Full Version : Need some help with a script



lassan
04-02-2013, 07:26 PM
Hello!
I was planning on hunting some dwarf guards but i've run into abit of a problem..
I want the bot to hunt dwarfguards as normal, kill & loot. I then want it to drop the heavier loot such as scale armor, steel helmet and so on at a certain place in the cave and what i've come up with is this script, i took another "drop x" script and modified it abit.
I'm Newb at this sort of thing so havnt got the slightest idea of if this is the right way to do it..
Any help is much appreciated!


Node
Node
Stand at x coord - Drop all loot on ground on same coord
Node
Node
Node


-- SETTING -------------------------------------------
-----------------------------------------------------
ManaType = 3031, 3377 -- 3031/gold, 3377/scale arm and so on.
ManasToDrop = 5 -- How many empty vials before drop?
-----------------------------------------------------
-- END OF SETTING--------------------------------------

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

while (cont:isOpen()) do
for spot = 0, cont:ItemCount() do
local item = cont:GetItemData(spot)
if (item.id == id and item.count >= cnt) 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
if (dropItem(ManaType,ManasToDrop)) then
wait(1000, 4000) --Since we've already dropped a stack, wait a bit of time before trying to drop another
else
wait(2000) --havent dropped shit, wait2 seconds and try again. No need for randomization since we didn't do anything
end
end

Zofz
04-02-2013, 09:17 PM
Hello Lassan!

You make the script with the waypoints, you add the stand at your location. Then you add a label called "LootDrop" or w/e. Then you use a script like :


local DropCap = 200 -- drop items if cap is lower than this
local ConsiderCap = true -- considers the above cap, if you ignore this and want to drop every time, set false!
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

function onWalkerSelectLabel(labelName)
if(labelName == "LootDrop" and (Self.Cap() > DropCap and (ConsiderCap)) then
Self.DropItems(Self.Position().x, Self.Position().y, Self.Position().z, Item1,Item2,Item3,Item4, Item5, Item6)
end
end

As I read it, the ConsiderCap seems unlogical.. might have to remove that part!


Think that should work, put this in a textfile, but save it as .lua! (Notepad++ is recommended, search google for it if you do not have it). Put this in your script colder and load it together with the waypoints and the label "LootDrop"

lassan
04-09-2013, 03:17 PM
Thanks for the help Zofz, think im close to getting it to work :)
Im getting this error message though, no idea what to do!


XenoScript Error:
Script: [KNIGHT] DGS KAZ lootdrop.lua
Line #: 5
Chunk: C:\Users\Lassan\Documents\XenoBot\Scripts\[KNIGHT] DGS KAZ lootdrop.lua
Error: ')' expected near 'then'
This is an error with user-input and should not be reported as a bug with XenoBot.

Joshwa534
04-10-2013, 01:17 AM
Thanks for the help Zofz, think im close to getting it to work :)
Im getting this error message though, no idea what to do!


XenoScript Error:
Script: [KNIGHT] DGS KAZ lootdrop.lua
Line #: 5
Chunk: C:\Users\Lassan\Documents\XenoBot\Scripts\[KNIGHT] DGS KAZ lootdrop.lua
Error: ')' expected near 'then'
This is an error with user-input and should not be reported as a bug with XenoBot.


local DropCap = 200 -- drop items if cap is lower than this
local ConsiderCap = true -- considers the above cap, if you ignore this and want to drop every time, set false!
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
function onWalkerSelectLabel(labelName)
if (labelName == "LootDrop") and (Self.Cap() < DropCap) and (ConsiderCap) then
Self.DropItems(Self.Position().x, Self.Position().y, Self.Position().z, Item1, Item2, Item3, Item4, Item5, Item6)
end
end

Fixed 3 errors on line 5. =]