XenoBot Forums - Powered by vBulletin

User Tag List

Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: Some help would be appreciated.

  1. #11

    Join Date
    Jun 2012
    Location
    Sweden
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

    Code:
    -- [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
    Last edited by DjimmaJIm; 08-03-2012 at 11:05 PM.

  2. #12
    Senior Member Forgee's Avatar
    Join Date
    Feb 2012
    Location
    Sweden
    Posts
    555
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    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().

  3. #13
    silis's Avatar
    Join Date
    Dec 2011
    Location
    Somewhere Far Beyond
    Posts
    64
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Forgee View Post
    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

    Code:
    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)
    Moving on from Neo to Xeno!
    ❑ Single
    ❑ Taken
    ✔ Mentally dating a character that doesn't actually exist

  4. #14

    Join Date
    Jun 2012
    Location
    Sweden
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Forgee View Post
    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

  5. #15
    Senior Member Forgee's Avatar
    Join Date
    Feb 2012
    Location
    Sweden
    Posts
    555
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    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.

  6. #16
    silis's Avatar
    Join Date
    Dec 2011
    Location
    Somewhere Far Beyond
    Posts
    64
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Forgee View Post
    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..

    [code=lua]
    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
    [/code]

    tho i didn't know about Map.GetUseItems.. ill look some older updates, just went back to tibia xd
    Moving on from Neo to Xeno!
    ❑ Single
    ❑ Taken
    ✔ Mentally dating a character that doesn't actually exist

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •