PDA

View Full Version : simple script help



drnaxhax
12-03-2016, 12:55 PM
ok so after almost 10 years i decided to say hello to tibia.

i made a simple script whick i need some help to put it running.

my script:

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
dofile("SyntaxLuaLib.lua")

function onWalkerSelectLabel(labelName)

if (labelName == "check") then
delayWalker(3000)
if count(268) <= 80 then
gotoLabel("out")
else
gotoLabel("hunt")
end

elseif (labelName == "Deposit") then
delayWalker(3000)
Self.Say("Hi")
sleep(math.random(700, 1400))
Self.SayToNpc("Deposit all")
sleep(math.random(700, 1400))
Self.SayToNpc("Yes")
Self.Say("withdraw 10000")
sleep(math.random(700, 1400))
Self.SayToNpc("yes")
sleep(math.random(700, 1400))
Self.SayToNpc("bye")
elseif (labelName == "enddeposit") then
delayWalker(3000)
gotoLabel("gomana")
end
end

elseif (labelName == "manas") then
Walker.Stop()
Self.SayToNpc({"hi","vials","yes","yes","yes","trade"}, 65)
wait(2000)
if (Self.ItemCount(268) < 81) then
BuyItems(268, 200)
wait(500)
elseif (labelName == "ready") then
delaywalker(3000)
gotolabel("gohunt")
end

some hlep would be apreciated.

thank you

dr naxhax

Fetbojj
12-04-2016, 12:04 PM
I don't know what you are trying to create, but I would recommend a setup such as this one:


--- BP Settings ---
local BPCount = 4 -- Main, Product, Loot, Gold
local GoldBP = "golden backpack"
local ProdBP = "red backpack"
local LootBP = "blue backpack"

--- Hunt Settings ---
local CapLeave = 250 --- Leave spawn if cap is below this.
local LeavePots = 50 --- Leave spawn if mana potions is below this.
local ManaBuy = 200 --- Amount of mana pots to bring on hunt.

--- Misc ---
local ManaPots = 268 --- Don't change this.
local ManaPrice = 50 --- Don't change this.
local EmptyPot = 285

--- MISC Info
--- Your #1 BP inside depot will recieve stackables.

Targeting.Start()
Looter.Start()

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")

print([[
---------------------------------
------This script was created by:------
---------------------------------
---------------Fetbojj-------------
---------------------------------
-----------Happy Hunting!------------
---------------------------------]])
wait(7000)

function onWalkerSelectLabel(labelName)
if (labelName == "Check") then
if (Self.Cap() < CapLeave) then
Walker.Goto("LeaveHunt")
elseif (Self.ItemCount(ManaPots) < LeavePots) then
Walker.Goto("LeaveHunt")
else
Walker.Goto("Hunt")
end

elseif (labelName == "Bank") then
local amount = 10000
Walker.Stop()
wait(1200,2500)
Self.SayToNpc("hi")
wait(2100,5400)
Self.SayToNpc("deposit all")
wait(1000,2200)
Self.SayToNpc("yes")
wait(2100,5400)
if (Self.ItemCount(ManaPots) < ManaBuy) then
Self.SayToNpc("withdraw " .. amount)
wait(1000,2100)
Self.SayToNpc("yes")
end
wait(1500,2700)
Self.SayToNpc("balance")
wait(1000)
Walker.Start()

elseif (labelName == "Rafzan") then
Walker.Stop()
wait(800,1740)
Self.SayToNpc("hi")
wait(1000,2140)
Self.SayToNpc("trade")
wait(1200, 2800)
Self.ShopSellAllItems(17812)
wait(800, 1400)
Self.ShopSellAllItems(17846)
wait(800, 1400)
Self.ShopSellAllItems(17813)
wait(800, 1400)
Self.ShopSellAllItems(17810)
wait(800, 1400)
Self.ShopSellAllItems(17859)
wait(800, 1400)
Walker.Start()

elseif (labelName == "BuyPots") then
Walker.Stop()
wait(800,1740)
Self.SayToNpc("hi")
wait(1000,2140)
Self.SayToNpc("trade")
wait(1200, 2800)
if (Self.ItemCount(EmptyPot) > 0) then
Self.ShopSellAllItems(EmptyPot)
end
wait(2000, 3800)
if (Self.ItemCount(ManaPots) < ManaBuy) then
Self.ShopBuyItemsUpTo(ManaPots, 100)
wait(700, 1400)
Self.ShopBuyItemsUpTo(ManaPots, ManaBuy)
end
wait(1500,2800)
Walker.Start()

elseif (labelName == "BackpackReset") then
delayWalker(2000)
Self.CloseContainers()
end
end


-----------------

function BACKPACK_OPENER()

if #Container.GetAll() < BPCount then
Targeting.Stop()
Looter.Stop()
setWalkerEnabled(false)
wait(500,1000)
Self.CloseContainers()
wait(500,1000)
Self.OpenMainBackpack(true):OpenChildren({ProdBP, true}, {LootBP, true}, {GoldBP, true})
wait(500,1000)
Targeting.Start()
Looter.Start()
wait(500,1000)
setWalkerEnabled(true)
end

end

local BACKPACK_OPENER_MODULE = Module.New('BACKPACK_OPENER', 'BACKPACK_OPENER')

Guivalaadao
12-08-2016, 01:14 AM
local ManaPotID = 268 -- ID MP
local LeavePots = 80 -- Leave spawn if mana potions is below this
local ManaBuy = 200 -- Amount of mana pots to bring on hunt
local PriceMP = 50 -- Price Mana Potion



function onWalkerSelectLabel(labelName)
--CHECK FOR GO OUT --
if (labelName == "Check") then
Walker.ConditionalGoto((Self.ItemCount(ManaPotID) <= LeavePots), "Out", "Hunt")

-- BANK --
elseif (labelName == "Bank") then
Walker.Stop()
wait(800,1400)
Self.SayToNpc("hi")
wait(800,1400)
Self.SayToNpc("deposit all")
wait(800,1400)
Self.SayToNpc("yes")
wait(1800,2400)
Self.WithdrawMoney((PriceMP*(ManaBuy-Self.ItemCount(ManaPotID)))+5000)
wait(800,1400)
Self.SayToNpc("balance")
Walker.Start()

-- COMPRA OS POTS QUE ESTA DEFINIDO LA EM CIMA.
elseif (labelName == "BuyPots") then
Walker.Stop()
wait(500,1000)
Self.SayToNpc({"Hi", "Vial", "yes", "trade"}, 80)
wait(500,1000)
Self.ShopSellFlasks()
wait(500,1000)
Self.ShopBuyItemsUpTo(ManaPotID, ManaBuy)
wait(500,1000)
Walker.Start()


try this