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
Spears
#1
Can't get this one to work.



--EDITED TO ADD CREDITS--
Credits:
|Only Registered members can see download links. | Click here to buy subscription or here to register.

local CONFIG =
{
   spearsLocation = 'red backpack',
   maxSpears = 22,            -- Max. amount
   minSpears = 3,             -- Amount to ignore monsters and start to pickup.
   Hand = 'lhand',            -- 'rhand' for RIGHT HAND.
   moveStuff = true,          -- Move random stuff on floor that are over spears.
   AroundOnly = false,        -- Pickup spears only when they are around you.
   weaponNoSpears = true,     -- Use weapon when no spears?
   Weapon = 'spike sword',   -- Weapon name/id.
   WeaponLocation = 'red backpack', -- Weapon location.
}

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

local SPEAR_ID = 2389
local SPEAR_WEIGH = 20

if PICKUP_PAUSE == nil then
   PICKUP_PAUSE = false
end

if equipspears == nil then
   function equipspears(sCount)

       local WEAPON_ID = itemid(CONFIG.Weapon)
       for i = 0, 3 do

           local hand = getslotitem(CONFIG.Hand)
           if hand.id > 0 and hand.id ~= WEAPON_ID and hand.id ~= SPEAR_ID then
               moveitems(hand.id, 'ground', CONFIG.Hand)
               wait(400)
               hand = getslotitem(CONFIG.Hand)
           end

           if hand.id == WEAPON_ID or hand.id == 0 or (hand.id == SPEAR_ID and hand.count < 100) then
               if sCount == nil or sCount == -1 then
                   sCount = itemcount(SPEAR_ID, CONFIG.spearsLocation)
               end

               if sCount > 0 then
                   if hand.id == WEAPON_ID then
                       moveitems(hand.id, CONFIG.WeaponLocation, CONFIG.Hand)
                       wait(400)
                       hand = getslotitem(CONFIG.Hand)
                   end

                   if hand.id == 0 or hand.id == SPEAR_ID then
                       moveitems(SPEAR_ID, CONFIG.Hand, CONFIG.spearsLocation, 100)
                       wait(400)
                       hand = getslotitem(CONFIG.Hand)
                       if hand.id == SPEAR_ID then
                           break
                       end
                   end
               else
                   if hand.id == 0 or hand.id ~= WEAPON_ID then
                       moveitems(WEAPON_ID, CONFIG.Hand, CONFIG.WeaponLocation)
                       wait(400)
                       hand = getslotitem(CONFIG.Hand)
                       if hand.id == WEAPON_ID then
                           break
                       end
                   end
               end
           end
       end
   end
end

if grabspears == nil then
   function grabspears(px, py, pz, itemGroundCount, currentSpearsCount)

       while getVariable('iswalking') do                                    
           stopattack()
           wait(500)
       end

       if currentSpearsCount < CONFIG.maxSpears then
           cap = getVariable('cap')
           local maxSpears = math.floor(cap / SPEAR_WEIGH)
           if maxSpears > 0 then
               local maxPickup = CONFIG.maxSpears - currentSpearsCount
               local count = 0
               if maxSpears > maxPickup then
                   maxSpears = maxPickup
               end

               if maxSpears >= itemGroundCount then
                   count = 100
               else
                   count = maxSpears
               end

               local WEAPON_ID = itemid(CONFIG.Weapon)
               hand = getslotitem(CONFIG.Hand)
               if hand.id > 0 and hand.id ~= SPEAR_ID and hand.id ~= WEAPON_ID then
                   moveitems(hand.id, 'ground', CONFIG.Hand)
                   wait(400)
                   hand = getslotitem(CONFIG.Hand)
                   if hand.id == 0 then
                       moveitems(SPEAR_ID, CONFIG.Hand, ground(px, py, pz), count)
                       wait(400)
                   end
               elseif hand.id == 0 or hand.id == SPEAR_ID then
                   moveitems(SPEAR_ID, CONFIG.Hand, ground(px, py, pz), count)
                   wait(400)
               elseif hand.id == WEAPON_ID then
                   moveitems(SPEAR_ID, CONFIG.spearsLocation, ground(px, py, pz), count)
                   wait(400)
                   stackitems('spear')
               end
           end
       end
   end
end

if spearscount == nil then
   function spearscount()

       local hand = getslotitem(CONFIG.Hand)
       local spearsCount = itemcount(SPEAR_ID, CONFIG.spearsLocation)

       if hand.id == SPEAR_ID then
           if spearsCount > 0 then
               equipspears(spearsCount)
           end
           spearsCount = spearsCount + hand.count

       else
           if spearsCount >= CONFIG.minSpears then
               equipspears(spearsCount)
           else
               if CONFIG.weaponNoSpears then
                   local WEAPON_ID = itemid(CONFIG.Weapon)
                   local hand = getslotitem(CONFIG.Hand)

                   if hand.id > 0 then
                       if hand.id ~= SPEAR_ID and hand.id ~= WEAPON_ID then
                           moveitems(hand.id, 'ground', CONFIG.Hand)
                           wait(400)
                           hand = getslotitem(CONFIG.Hand)
                           if hand.id == 0 then
                               moveitems(WEAPON_ID, CONFIG.Hand, CONFIG.WeaponLocation)
                               wait(400)
                           end
                       elseif hand.id == SPEAR_ID then
                           moveitems(hand.id, CONFIG.spearsLocation, CONFIG.Hand)
                           wait(400)
                           hand = getslotitem(CONFIG.Hand)
                           if hand.id == 0 then
                               moveitems(WEAPON_ID, CONFIG.Hand, CONFIG.WeaponLocation)
                               wait(400)
                           end
                       end
                   else
                       moveitems(WEAPON_ID, CONFIG.Hand, CONFIG.WeaponLocation)
                       wait(400)
                   end
               end
           end
       end



       return spearsCount
   end
end

if pickupspears == nil then
   function pickupspears(around, currentSpearsCount)
       local px = posX()
       local py = posY()
       local pz = posZ()

       local pickupedSpears = false
       local breakFlag = false
       local mustUpdateMap = false

       if CONFIG.moveStuff == false then
           for x = -7, 7 do
               for y = -5, 5 do
                   local tileX = px + x
                   local tileY = py + y

                   if not around or (around and math.abs(tileX - px) <= 1 and math.abs(tileY - py) <= 1) then
                       local item = topitem(tileX, tileY, pz, false, false)

                       if item.id == SPEAR_ID then
                           if lootbodies() > 0 or getVariable('islooting') then
                               breakFlag = true
                               break
                           end

                           pausewalking(999999)
                           PICKUP_PAUSE = true

                           if not around then
                               if ((istargeting() or hastarget()) and getVariable('chasemode') == 1) or getVariable('iswalking') then                                    
                                   stopattack()
                                   stopattack()
                                   wait(400)
                               end
                           else
                               if ((istargeting() or hastarget()) and getVariable('chasemode') == 1) or getVariable('iswalking') then
                                   breakFlag = true
                                   break
                               end                            
                           end

                           local IsCloseToSpears = islocationxyz(tileX, tileY, pz, 1)

                           if not IsCloseToSpears then
                               if reachlocation(tileX, tileY, pz, false, 'pause') then
                                   while getVariable('iswalking') do
                                       wait(500)
                                   end
                                   wait(1000)
                                   IsCloseToSpears = islocationxyz(tileX, tileY, pz, 1)
                               else
                                   break
                               end
                           end

                           if IsCloseToSpears then
                               grabspears(tileX, tileY, pz, item.count, currentSpearsCount)
                               pickupedSpears = true
                               local spearsCount = spearscount()
                               local monstersAround = maround()
                               if (spearsCount >= CONFIG.minSpears and monstersAround > 0) or spearsCount >= CONFIG.maxSpears then
                                   breakFlag = true
                                   break
                               end
                               mustUpdateMap = true
                           end
                       end
                   end
               end
               if breakFlag then
                   break
               end
           end
       else

           local tileTopItem = nil
           local tilesScreen = gettiles(false, true, true)
           for j = 1, #tilesScreen do
               local TILE = tilesScreen[j]
               if math.abs(TILE.posx - px) <= 7 and math.abs(TILE.posy - py) <= 5 and TILE.posz == pz then
                   if not around or (around and math.abs(TILE.posx - px) <= 1 and math.abs(TILE.posy - py) <= 1) then
                       for k = 1, #TILE.items do
                           local ITEM = TILE.items[k]
                           if ITEM.id == SPEAR_ID then

                               if lootbodies() > 0 or getVariable('islooting') then
                                   breakFlag = true
                                   break
                               end

                               pausewalking(999999)
                               PICKUP_PAUSE = true

                               if not around then
                                   if ((istargeting() or hastarget()) and getVariable('chasemode') == 1) or getVariable('iswalking') then                                    
                                       stopattack()
                                       stopattack()
                                       wait(400)
                                   end
                               else
                                   if (istrapped() or (istargeting() or hastarget()) and getVariable('chasemode') == 1) or getVariable('iswalking') then
                                       breakFlag = true
                                       break
                                   end                            
                               end

                               local IsCloseToSpears = islocationxyz(TILE.posx, TILE.posy, pz, 1)

                               if not IsCloseToSpears then
                                   if reachlocation(TILE.posx, TILE.posy, pz, false, 'pause') then
                                       while getVariable('iswalking') do
                                           wait(500)
                                       end
                                       wait(1000)
                                       IsCloseToSpears = islocationxyz(TILE.posx, TILE.posy, pz, 1)
                                   else
                                       break
                                   end
                               end

                               if IsCloseToSpears then
                                   if tileTopItem == nil then
                                       tileTopItem = TILE.topitem
                                       if tileTopItem.id == 99 then
                                           tileTopItem = topitem(TILE.posx, TILE.posy, pz, false, false)
                                       end
                                   else
                                       tileTopItem = topitem(TILE.posx, TILE.posy, pz, false, mustUpdateMap)
                                   end

                                   local flagBreak = false
                                   for i = 0, 5 do
                                       islooting = getVariable('islooting')
                                       flagBreak = (islooting or lootbodies() > 0)
                                       if tileTopItem.id ~= SPEAR_ID and flagBreak == false then
                                           local destTile = getmovetile(TILE.posx, TILE.posy, pz, true, 2, false, true)
                                           if destTile.posx > 0 then
                                               moveitems(0, ground(destTile.posx, destTile.posy, pz), ground(TILE.posx, TILE.posy, pz))
                                               wait(600, 700)
                                           else
                                               moveitems(0, ground(posX(), posY(), pz), ground(TILE.posx, TILE.posy, pz))
                                               wait(600, 700)
                                           end
                                           tileTopItem = topitem(TILE.posx, TILE.posy, pz, false, true)
                                       else
                                           break
                                       end
                                   end

                                   if tileTopItem.id == SPEAR_ID and flagBreak == false then
                                       grabspears(TILE.posx, TILE.posy, pz, ITEM.count, currentSpearsCount)
                                       pickupedSpears = true

                                       local spearsCount = spearscount()
                                       local monstersAround = maround()
                                       if (spearsCount >= CONFIG.minSpears and monstersAround > 0) or spearsCount >= CONFIG.maxSpears then
                                           breakFlag = true
                                           break
                                       end
                                       mustUpdateMap = true
                                   end
                               else
                                   break
                               end

                           end

                       end

                   end

               end
               if breakFlag then
                   break
               end

           end
       end
       return pickupedSpears
   end
end

if updateSettings == nil then
   function updateSettings()
       if PICKUP_PAUSE then
           pausewalking(0)
       end
   end
end


local spearsCount = spearscount()

if cap >= SPEAR_WEIGH and islooting == false and lootbodies() == 0 and spearsCount < CONFIG.maxSpears then

   local justAround = CONFIG.AroundOnly
   local trapped = istrapped()

   if trapped or (spearsCount > CONFIG.minSpears and hastarget()) then
       justAround = true
   end
   --if trapped then
   --    justAround = true
   --end

   if justAround or spearsCount < CONFIG.minSpears or (hastarget() == false and spearsCount < CONFIG.maxSpears) then
       cap = getVariable('cap')
       if cap > SPEAR_WEIGH then
           if not pickupspears(justAround, spearsCount) then
               local runTime = runningtime()
               if LAST_GC == nil then
                   LAST_GC = runTime
               end

               if (LAST_GC + 10) < runTime then
                   cleanup()
                   LAST_GC = runningtime()
               end
               updateSettings()
           else
               return
           end
       end
       updateSettings()
   end
   updateSettings()

elseif spearsCount >= CONFIG.maxSpears then
   updateSettings()
else
  updateSettings()
end
Reply

#2
Hello.

This script wasn't developed for Classictibia Bot, so it will not work. To make it work, you must adapt to work on this bot and I will not be able to help you with that, sorry mate.
Otherwise, I already would have done that and posted it in the scripts section.

Basically, you are copying my scripts and not even giving me credits for such work.
Reply

#3
Lol, I dont care about the credit. Im not trying to steal ur credit for creating the script.


You have done a great job, can you try to provide a solution for it?
Reply

#4
The script picks up spear, but does not move the bodies. 
18:08:10 - Core:Lua:ExecuteScript
|Only Registered members can see download links. | Click here to buy subscription or here to register.
|Only Registered members can see download links. | Click here to buy subscription or here to register.alt="Tongue" title="Tongue" class="smilie smilie_5" />ersistent01: 123: attempt to call global 'getslotitem' (a nil value
Getting this error on the script.

Anyone can assist?

Credits for the script goes to: Arkilys!
Reply



Forum Jump:



Forum software by © MyBB Theme © iAndrew 2016