XenoBot Forums - Powered by vBulletin

User Tag List

Results 1 to 4 of 4

Thread: Need help with lua script :) use item on ground/wall

  1. #1

    Join Date
    Jan 2016
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need help with lua script :) use item on ground/wall

    Hello i need a bit of help with a Label in my script im making
    I want to use a item in my backpack on a special item on the floor/wall so when it comes on the label it does the script and then keeps walking

    Is it possible to make that one something more like this
    ItemID = 1234 -- item to use on
    ItemToUse = 1234 -- Item To Use

    elseif (labelName == "123456789") then
    for x = -7, 7 do
    for y = -7, 7 do
    if Map.GetTopUseItem(Self.Position().x + x, Self.Position().y + y, Self.Position().z).id = ItemID then
    Self.UseItemWithGround(ItemToUse, Self.Position().x + x, Self.Position().y + y, Self.Position().z)
    break
    end
    end


    But the one i made above is not working for me (and yes its in the middle of the script)

  2. #2
    Senior Member Jontor's Avatar
    Join Date
    Sep 2014
    Posts
    446
    Mentioned
    51 Post(s)
    Tagged
    1 Thread(s)
    Try using this:
    Code:
    elseif (labelName == "123456789") then
        local pos = Player.pos()
    
        for x = -7, 7 do
            for y = -5, 5 do
                if (Map.IsItemAtPosition(ItemID, pos.x, pos.y, pos.z)) then
                    wait(500)
                    Self.UseItemWithGround(ItemToUse, pos.x, pos.y, pos.z)
                    return
                end
            end
        end
    end
    And if it won't work, explain what you're trying to do.



  3. #3

    Join Date
    Jan 2016
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okey so i tried your script but it didnt get the location of the char,
    so i went deeper and found out that this script is more like the one i wanted

    local itemID = {12061, 12063, 12075} -- ItemID of slimes
    Module.New('SlimeRemover', function(module)
    if (Self.TargetID() ~= 1) then
    pos = Self.Position()
    for y = -3, 3 do
    for x = -3, 3 do
    if table.contains(itemID, Map.GetTopUseItem(pos.x + x, pos.y + y, pos.z).id) then
    Cavebot.Stop()
    Self.UseItemWithGround(12077, pos.x + x, pos.y + y, pos.z)
    wait(5500)
    else
    Cavebot.Start()
    end
    end
    end
    end
    end)

    But when i use it the bot keeps trying to use it over and over and over again so it gets stuck. any help?
    Cuz i just want it to use it once on the label and then start walker again and keep running untill next label

  4. #4

    Join Date
    Sep 2016
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Jontor View Post
    Try using this:
    Code:
    elseif (labelName == "123456789") then
        local pos = Player.pos()
    
        for x = -7, 7 do
            for y = -5, 5 do
                if (Map.IsItemAtPosition(ItemID, pos.x, pos.y, pos.z)) then
                    wait(500)
                    Self.UseItemWithGround(ItemToUse, pos.x, pos.y, pos.z)
                    return
                end
            end
        end
    end
    And if it won't work, explain what you're trying to do.
    Bro... how can i use a item on other item.. in the same backpack?

Posting Permissions

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