Everyone who has never used our Bots before, can test each one for 2 days without any limitation.
The trial is given automatically when you login on the Bot, but in some cases it wouldn't work (security reasons).
If this happens, send me a private message and i will be checking the failed trials manually and adding it for those who didn't get it.
We are looking for resellers who may accept payment methods different from ours, including classictibia's cash, realesta's cash, mastercores' cash, etc. Interested? Click here at anytime.



Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
FREE Pickup Spears
#1
Hello.

This is a basic script to pickup spears/small stones to a BACKPACK, it's able to move dead bodies away and pickup.
There are two scripts, both works pretty much same way except the way it stops walking for other tools like Targeting, Cavebot and Looter. The first script just uses an internal function pausewalking() to stop walking and the 2nd script actually disables cavebot, targeting and looter then enables again after picking up.

I will NOT give any support on this script, not even to fix bugs. So please, don't ask to because you will be ignored.

1st script
local CONFIG =
{
    MinCapacity = 80,               -- Minimal amount of cap to pickup spears.
    Hand = 'lhand',                  -- 'rhand' for RIGHT hand / 'lhand' for LEFT hand.
    MaxSpears = 22,                  -- Max. amount
    MinSpears = 3,                   -- Amount to ignore monsters and start to pickup.
    SpearsLocation = 'backpack',
    SearchRange = 3,                 -- Distance range to search for spears.
    Untrash = true,                  -- Move random stuff on floor that are over spears.
    UseWeaponWhenNoSpears = true,    -- Use weapon when no spears?
    Weapon = 'spike sword',          -- Weapon name/id.
    WeaponLocation = 'backpack', -- Weapon location.
    SpearId = 3277,
    SpearWeigh = 20,
}

--[[ DON'T EDIT BELOW THIS LINE --]]
--[[ DON'T EDIT BELOW THIS LINE --]]
--[[ DON'T EDIT BELOW THIS LINE --]]

if PICKUP_PAUSE == nil then
   PICKUP_PAUSE = false
end

if spearsCount == nil then
    function spearsCount()
        local bpCount = itemcount(CONFIG.SpearId, CONFIG.SpearsLocation)
        local hand = getequipment(CONFIG.Hand)
        local handCount = 0
        if hand.id == CONFIG.SpearId then
            handCount = hand.count
        end
        return { total = bpCount + handCount, hand = handCount, bp = bpCount }
    end
end

if grabSpears == nil then
    function grabSpears(x, y)
        local flag = false
        pausewalking(99999)
        if iswalking() then
            pressesc()
            wait(300)
        end

        local player_z = posz()
        if reachlocation(x, y, player_z) then
            local item = topitem(x, y, player_z)
            while item.id ~= CONFIG.SpearId do
                local dir = wheretomoveitem(x,y,player_z, true, 1)
                moveitems(item.id, ground(dir.posx, dir.posy, player_z), ground(x, y, player_z), 100)
                wait(400, 700)
                item = topitem(x, y, player_z)
            end
            local spearLocation = CONFIG.SpearsLocation
            local hand = getequipment(CONFIG.Hand)
            if hand.id == CONFIG.SpearId or hand.id == 0 then
                spearLocation = CONFIG.Hand
            end
            if moveitems(CONFIG.SpearId, spearLocation, ground(x, y, player_z), 100) then
                wait(400, 700)
                flag = true
            end
        end
        pausewalking(0)
        return flag
    end
end

if findSpears == nil then
    function findSpears(rangeX, rangeY, topOnly)
        local closesTile = {x = -1, y = -1, dist = -1, count = -1, top = false }
        local tiles = gettiles()
        local player_x = posx()
        local player_y = posy()
        local player_z = posz()
        for _, tile in ipairs(tiles) do
            if math.abs(tile.posx - player_x) <= rangeX and math.abs(tile.posy - player_y) <= rangeY and tile.posz == player_z then
                local foundSpearsCount = 0
                if topOnly and tile.topitem.id == CONFIG.SpearId then
                    foundSpearsCount = tile.topitem.count
                else
                    for __, item in ipairs(tile.items) do
                        if item.id == CONFIG.SpearId then
                            foundSpearsCount = foundSpearsCount + item.count
                        end
                    end
                end
                if foundSpearsCount > 0 then
                    local dist = proximity(player_x, player_y, tile.posx, tile.posy)
                    if closesTile.dist == -1 or dist < closesTile.dist or (dist == closesTile.dist and foundSpearsCount > closesTile.count) then
                        closesTile = { x = tile.posx, y = tile.posy, dist = dist, count = foundSpearsCount, top = tile.topitem.id == CONFIG.SpearId }
                    end
                end
            end
        end
        return closesTile
   end
end

if connected() then
    local count = spearsCount()
    if cap() >= CONFIG.MinCapacity and islooting() == false and ((attacked().id == 0 and count.total < CONFIG.MaxSpears) or count.total < CONFIG.MinSpears) then
        local spear = findSpears(CONFIG.SearchRange, CONFIG.SearchRange, CONFIG.Untrash)
        if spear.x ~= -1 and grabSpears(spear.x, spear.y) then
            count = spearsCount()
        end
    end

    if count.bp > 0 then
        local WEAPON_ID = itemid(CONFIG.Weapon)
        local hand = getequipment(CONFIG.Hand)
        if hand.id == WEAPON_ID then
            if moveitems(WEAPON_ID, CONFIG.WeaponLocation, CONFIG.Hand) then
                wait(400, 700)
                hand = getequipment(CONFIG.Hand)
            end
        end
        if hand.id == 0 or hand.id == CONFIG.SpearId then
            if moveitems(CONFIG.SpearId, CONFIG.Hand, CONFIG.SpearsLocation) then
                wait(400, 700)
            end
        end
    elseif count.total == 0 and CONFIG.UseWeaponWhenNoSpears then
        local WEAPON_ID = itemid(CONFIG.Weapon)
        local hand = getequipment(CONFIG.Hand)
        if hand.id > 0 and hand.id ~= WEAPON_ID and hand.id ~= CONFIG.SpearId then
            if moveitems(hand.id, 'ground', CONFIG.Hand) then
                wait(400, 700)
            end
        end
        if moveitems(WEAPON_ID, CONFIG.Hand, CONFIG.WeaponLocation) then
            wait(400, 700)
        end
    end
end

2nd script
This is an alternative that checks of it's possible to reach and disable Cavebot, Targeting and Looter to pickup.
local CONFIG =
{
    MinCapacity = 80,               -- Minimal amount of cap to pickup spears.
    Hand = 'lhand',                  -- 'rhand' for RIGHT hand / 'lhand' for LEFT hand.
    MaxSpears = 22,                  -- Max. amount
    MinSpears = 3,                   -- Amount to ignore monsters and start to pickup.
    SpearsLocation = 'backpack',
    SearchRange = 3,                 -- Distance range to search for spears.
    Untrash = true,                  -- Move random stuff on floor that are over spears.
    UseWeaponWhenNoSpears = true,    -- Use weapon when no spears?
    Weapon = 'spike sword',          -- Weapon name/id.
    WeaponLocation = 'backpack', -- Weapon location.
    SpearId = 3277,
    SpearWeigh = 20,
}

--[[ DON'T EDIT BELOW THIS LINE --]]
--[[ DON'T EDIT BELOW THIS LINE --]]
--[[ DON'T EDIT BELOW THIS LINE --]]


if PICKUP_PAUSE == nil then
   PICKUP_PAUSE = false
end

if spearsCount == nil then
    function spearsCount()
        local bpCount = itemcount(CONFIG.SpearId, CONFIG.SpearsLocation)
        local hand = getequipment(CONFIG.Hand)
        local handCount = 0
        if hand.id == CONFIG.SpearId then
            handCount = hand.count
        end
        return { total = bpCount + handCount, hand = handCount, bp = bpCount }
    end
end

if grabSpears == nil then
    function grabSpears(x, y)
        local flag = false
        setsettings('Targeting/Settings/Enabled', false)
        setsettings('Looter/Settings/Enabled', false)
        setsettings('Cavebot/Settings/Enabled', false)
        pausewalking(99999)
        if iswalking() then
            pressesc()
            wait(300)
        end
        local player_z = posz()
        if reachlocation(x, y, player_z) then
            local item = topitem(x, y, player_z)
            while item.id ~= CONFIG.SpearId do
                local dir = wheretomoveitem(x,y,player_z, true, 1)
                moveitems(item.id, ground(dir.posx, dir.posy, player_z), ground(x, y, player_z), 100)
                wait(400, 700)
                item = topitem(x, y, player_z)
            end
            local spearLocation = CONFIG.SpearsLocation
            local hand = getequipment(CONFIG.Hand)
            if hand.id == CONFIG.SpearId or hand.id == 0 then
                spearLocation = CONFIG.Hand
            end
            if moveitems(CONFIG.SpearId, spearLocation, ground(x, y, player_z), 100) then
                wait(400, 700)
                flag = true
            end
        end
        pausewalking(0)
        setsettings('Targeting/Settings/Enabled', true)
        setsettings('Looter/Settings/Enabled', true)
        setsettings('Cavebot/Settings/Enabled', true)
        return flag
    end
end

if findSpears == nil then
    function findSpears(rangeX, rangeY, topOnly)
        local closesTile = {x = -1, y = -1, dist = -1, count = -1, top = false }
        local tiles = gettiles()
        local player_x = posx()
        local player_y = posy()
        local player_z = posz()
        for _, tile in ipairs(tiles) do
            if math.abs(tile.posx - player_x) <= rangeX and math.abs(tile.posy - player_y) <= rangeY and tile.posz == player_z then
                local foundSpearsCount = 0
                if topOnly and tile.topitem.id == CONFIG.SpearId then
                    foundSpearsCount = tile.topitem.count
                else
                    for __, item in ipairs(tile.items) do
                        if item.id == CONFIG.SpearId then
                            foundSpearsCount = foundSpearsCount + item.count
                        end
                    end
                end
                if foundSpearsCount > 0 then
                    local dist = proximity(player_x, player_y, tile.posx, tile.posy)
                    if (closesTile.dist == -1 or dist < closesTile.dist or (dist == closesTile.dist and foundSpearsCount > closesTile.count)) and tilereachable(tile.posx, tile.posy, tile.posz) then
                        closesTile = { x = tile.posx, y = tile.posy, dist = dist, count = foundSpearsCount, top = tile.topitem.id == CONFIG.SpearId }
                    end
                end
            end
        end
        return closesTile
   end
end

if connected() then
    local count = spearsCount()
    if cap() >= CONFIG.MinCapacity and islooting() == false and ((attacked().id == 0 and count.total < CONFIG.MaxSpears) or count.total < CONFIG.MinSpears) then
        local spear = findSpears(CONFIG.SearchRange, CONFIG.SearchRange, CONFIG.Untrash)
        if spear.x ~= -1 and grabSpears(spear.x, spear.y) then
            count = spearsCount()
        end
    end

    if count.bp > 0 then
        local WEAPON_ID = itemid(CONFIG.Weapon)
        local hand = getequipment(CONFIG.Hand)
        if hand.id == WEAPON_ID then
            if moveitems(WEAPON_ID, CONFIG.WeaponLocation, CONFIG.Hand) then
                wait(400, 700)
                hand = getequipment(CONFIG.Hand)
            end
        end
        if hand.id == 0 or hand.id == CONFIG.SpearId then
            if moveitems(CONFIG.SpearId, CONFIG.Hand, CONFIG.SpearsLocation) then
                wait(400, 700)
            end
        end
    elseif count.total == 0 and CONFIG.UseWeaponWhenNoSpears then
        local WEAPON_ID = itemid(CONFIG.Weapon)
        local hand = getequipment(CONFIG.Hand)
        if hand.id > 0 and hand.id ~= WEAPON_ID and hand.id ~= CONFIG.SpearId then
            if moveitems(hand.id, 'ground', CONFIG.Hand) then
                wait(400, 700)
            end
        end
        if moveitems(WEAPON_ID, CONFIG.Hand, CONFIG.WeaponLocation) then
            wait(400, 700)
        end
    end
end
Reply



Forum Jump:



Forum software by © MyBB Theme © iAndrew 2016