View Full Version : Some help would be appreciated.
DjimmaJIm
08-03-2012, 05:09 PM
Hello, I'm not able to fine find a solution to this problem. I assume I'm just missing something obvious.
dofile("Forgee.lua")
function onWalkerSelectLabel(labelName)
if
(labelName == "capcheck") then
delayWalker(1000)
setWalkerEnabled(false)
else
(Self.Cap() < chkcap) or
(Self.ItemCount(spearID) <= 7) or
(self.itemcount(chkmanas) <= 15) then -- check Cap, Royal Spears, Strong Manas
setWalkerEnabled(true)
gotoLabel("stophunt")
end
I receive this error message: lua: Script11.lua:45: syntax error near 'or'
Regards,
DjimmaJIm
DjimmaJIm
08-03-2012, 05:10 PM
This is a part of a larger script.
Forgee
08-03-2012, 05:29 PM
Replace 'else' with 'if' and add another 'end' at the bottom.
Not sure if that's it, got to run now. :p
DjimmaJIm
08-03-2012, 05:42 PM
Replace 'else' with 'if' and add another 'end' at the bottom.
Not sure if that's it, got to run now. :p
That did not solve the problem. But as I said, It is a part of a bigger script. But I do not want to post it here.
Would it be possible for you to take a look at it if I sent it to you? In plain text of course.
Kind Regards,
DjimmaJIm
Forgee
08-03-2012, 06:15 PM
Sure.
DjimmaJIm
08-03-2012, 06:44 PM
Sure.
I was able to solve the problem, but new problems occurred. I will try to solve them myself, since that is the best way to learn in my opinion.
I will keep on posting my problems/progress here.
And thank you for being willing to help me.
My Kindest Regards,
DjimmaJIm
Jakob Miller
08-03-2012, 07:03 PM
I was able to solve the problem, but new problems occurred. I will try to solve them myself, since that is the best way to learn in my opinion.
I will keep on posting my problems/progress here.
And thank you for being willing to help me.
My Kindest Regards,
DjimmaJIm
Post progress and I'll try!
DarkstaR
08-03-2012, 07:20 PM
That did not solve the problem. But as I said, It is a part of a bigger script. But I do not want to post it here.
Would it be possible for you to take a look at it if I sent it to you? In plain text of course.
Kind Regards,
DjimmaJIm
If you can't fix a simple syntax error when given the exact line of fallacy, I can promise noone with a mind gives two shits about your script - especially when it would be missing the xbst anyways.
Jakob Miller
08-03-2012, 07:21 PM
If you can't fix a simple syntax error when given the exact line of fallacy, I can promise noone with a mind gives two shits about your script - especially when it would be missing the xbst anyways.
Calm down mate. Not everyone has the patient to even look at the errors.. :)
DarkstaR
08-03-2012, 07:41 PM
Calm down mate. Not everyone has the patient to even look at the errors.. :)
I'm calm, just stating an obvious fact. Lol.
DjimmaJIm
08-03-2012, 09:59 PM
Well, The script is almost complete. The only thing that is missing is a way for the bot to pick a depot on its own. But I have been searching and it seems that is not possible, am I correct?
I guess I can paste the script here...
I just it is all that bad, since some people here seems to have a problem with people that havent been scripting for more then a total of 10 hours...
Well, here it goes.
-- [RP, Yalahar, Cemetery, (Zombie, Nightstalker, Lich) 60+ by DjimmaJIm] --
local chkcap = 70 -- Deposit on cap.
local chkmanas = 40 -- Manas to deposit on.
local random = 0 -- Amount to fill out amount < 0.
local bpspears = 25 -- Amount of spears to bring to hunt.
local spearID = 7378 -- The type of spear to hunt with.
local spearprice = 15 -- The price of the spears in use.
local bpmanas = 100 -- The amount of manas you want to buy (your amount in backpack)
local mpID = 237 -- The type of Mana Potion in use.
local manaprice = 80 -- Price of Strong Mana Potion.
local goldbp = 2871 -- ID Gold Backpack (Golden BP ID)
local rarebp = 5949 -- ID Rare Backpack (Pirate BP ID)
local stackbp = 2872 -- ID Stack Backpack (Como BP ID)
local dpstack = 0 -- stack itmes deposited in dp
local dprare = 1 -- rare items deposited in dp
registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
function NpcConv(...)
for _, str in ipairs(arg) do
wait((tostring(str):len() / 125) * 60000 * math.random(1.1, 1.8))
Self.SayToNpc(str)
end
end
dofile("Forgee.lua")
function onWalkerSelectLabel(labelName)
if
(labelName == "capcheck") then
delayWalker(1000)
setWalkerEnabled(false)
if
(Self.Cap() <= chkcap)
or
(Self.ItemCount(spearID) <= 7)
or
(Self.ItemCount(mpID) <= 15)
then -- check Cap, Royal Spears, Strong Manas
setWalkerEnabled(true)
gotoLabel("stophunt")
else
gotoLabel("starthunt")
delayWalker(1000)
setWalkerEnabled(true)
end
elseif
(labelName == "sellshop") then
delayWalker(2000)
setWalkerEnabled(false)
Self.SayToNpc({"hi", "trade"}, 65)
wait(2000, 3700)
Self.ShopSellItem(3351, Self.ShopGetItemSaleCount(3351))
wait(2000, 3700)
Self.SayToNpc({"bye", "hi", "trade"}, 65)
wait(2000, 3700)
Self.ShopSellItem(3269, Self.ShopGetItemSaleCount(3269))
wait(900, 1200)
setWalkerEnabled(true)
end
if
(labelName == "atbank") then
local withdrawmanas = (bpmanas-Self.ItemCount(mpID))*manaprice -- Shows requested amount of Manas for hunt, counts manas in backpack,.
local withdrawspear = (bpspears-Self.ItemCount(spearID))*spearprice -- same as above, but with Spears.
local goldamount = (withdrawmanas + withdrawspear) -- Adding the Gold you need to be able to buy the defined amont of Manas and Spears into one variable.
delayWalker(9000)
Self.SayToNpc({"hi", "deposit all", "yes"}, 65)
if (true == true) then
Self.SayToNpc({"withdraw " .. goldamount, "yes", "balance"}, 65) -- The total amount of gold to withdraw for Manas and Spears.
end
elseif
(labelName == "finddepot") then
delayWalker(15000)
Self.DepositItems(
{3055, dprare}, -- p-ammy
{10196, dpstack} -- white pearl
elseif
(labelName == "bpopen") then -- Resets the backpack
setWalkerEnabled(false)
Self.ResetBackpacks()
delayWalker(15000)
setWalkerEnabled(true)
elseif
(labelName == "buymanas") then-- The Mana Buyer
local manaCount = (bpmanas-Self.ItemCount(mpID))
delayWalker(8000)
Self.SayToNpc({"hi", "vials", "yes", "trade"}, 65)
wait(2000)
while
(Self.ItemCount(mpID) < bpmanas) do
Self.ShopBuyItem(mpID, manaCount)
wait(200, 500)
end
elseif
(labelName == "buyspears") then -- The Spear Buyer
local spearCount = (bpspears-Self.ItemCount(spearID))
delayWalker(8000)
Self.SayToNpc({"hi", "trade"}, 65)
wait(2000)
while
(Self.ItemCount(spearID) < bpspears) do
Self.ShopBuyItem(spearID, spearCount)
wait(200, 500)
end
end
end
I hope it is something that can be of use to someone else.
Kind Regards,
DjimmaJIm
Forgee
08-03-2012, 10:17 PM
I didnt' read through your script, but I applaude your effort to learn and not just ask for completed scripts.
I have made a function to choose a depot. I suggest you update your Forgee.lua to v 1.0 (released today) as it contains that function.
Place a node in dp so that you can see as many depots as possible on screen, then make a label to call Self.ReachDepot(). :)
silis
08-03-2012, 10:28 PM
I have made a function to choose a depot. I suggest you update your Forgee.lua to v 1.0 (released today) as it contains that function.
Place a node in dp so that you can see as many depots as possible on screen, then make a label to call Self.ReachDepot(). :)
I cant really find any documentation of the xenobot functions, do you just get them from the release changelogs or somewhere else?
i was using an edited version of Self.OpenDepot like
local depotpos ={
[1] = {x = 33205, y = 32455, z = 8},
[2] = {x = 33207, y = 32455, z = 8},
[3] = {x = 33209, y = 32455, z = 8},
[4] = {x = 33211, y = 32455, z = 8},
}
ReachOpenDepot(depotpos)
DjimmaJIm
08-03-2012, 10:32 PM
I didnt' read through your script, but I applaude your effort to learn and not just ask for completed scripts.
I have made a function to choose a depot. I suggest you update your Forgee.lua to v 1.0 (released today) as it contains that function.
Place a node in dp so that you can see as many depots as possible on screen, then make a label to call Self.ReachDepot(). :)
Thank you Forgee! That will be of great us to me, and others. I can also say that I have had the script running for two hours now, and it has been able to:
1. Run back from the spawn at low cap/mana/spear.
2. Get past the gate.
3. Sell the loot.
4. Deposit the gold and withdraw gold for manas and spears.
5. (Not deposit since i did not have the fuction, or whatever it is called.)
6. Reset the backpack.
7. Buy new manas and spears.
6. Get back through the gates.
8. Taking up hunting in the spawn.
I will add Self.ReachDepot() to the script and some gate safety that will prevent the character from getting stuck if it misses the gate and jumps a label. Then I guess the script can be called 100% afk.
Kind Regards,
DjimmaJIm
Forgee
08-03-2012, 10:37 PM
Good to hear DjimmaJIm!
silis that code doesen't tell me much at all. Where is ReachOpenDepot defined?
I have just looked in XenoluaLib.lua, but there is a more comprehensive list at http://www.lualand.net/functions.
silis
08-03-2012, 10:42 PM
Good to hear DjimmaJIm!
silis that code doesen't tell me much at all. Where is ReachOpenDepot defined?
I have just looked in XenoluaLib.lua, but there is a more comprehensive list at http://www.lualand.net/functions.
that was just my edit fuction from Self.OpenDepot..
function ReachOpenDepot(pos)
if (type(pos) ~= "table") then
error("bad argument #1 to 'ReachOpenDepot' (table expected, got " .. type(pos) .. ")")
return false
end
if (#pos < 1) then
error("bad argument #1 to 'ReachOpenDepot' (table lenght must be at least 1)")
return false
end
local tries = 0
local locker, depot = Container.GetByName("Locker"), Container.GetByName("Depot Chest")
if(depot:isOpen())then -- depot is already open
return true
end
if not (locker:isOpen()) then -- locker isn't open
while not locker:isOpen() do
if tries < 5 then
for i = 1, #pos do
Self.UseItemFromGround(pos[i].x, pos[i].y, pos[i].z) -- open locker
wait(getDistanceBetween(getSelfPosition(),pos[i])*800)
locker = Container.GetByName("Locker")
if locker:isOpen() then break end
end
tries = tries + 1
else
break
end
end
end
if(locker:isOpen()) then -- if the locker opened successfully
locker:UseItem(0) -- open depot
wait(1000, 1600)
depot = Container.GetByName("Depot Chest")
if(depot:isOpen()) then -- if the depot opened successfully
return true
end
end
return false
end
tho i didn't know about Map.GetUseItems.. ill look some older updates, just went back to tibia xd
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.