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
find items.
#1
Hey, im looking for a script to find x item(s) on screen and walk on it.
Reply

#2
Hello.

local Items = { 1234 } -- Items ID to find and reach.

local tiles = gettiles()
for _, tile in ipairs(tiles) do
    for __, item in ipairs(Items) do
        if tile.topitem.id == item then
            reachlocation(tile.posx, tile.posy, tile.posz, true)
            wait(800, 1200)
        end
    end
end
Reply

#3
|Only Registered members can see download links. | Click here to buy subscription or here to register.

Tested this code, added item ID and tested diffrent item ID's but it get stuck on line 6. something wrong in this line? 
there is no error code so it basicly just dont "find" my item.
by print(tiles) i get massive information in console and i can find my item in this list.' atleest.
Reply

#4
gettiles() returns all tiles on your screen, but if you cannot find your item so you are probably using wrong id.

Here's another way to do that.
local Items = { 1234 } -- Items ID to find and reach.

local player_x = posx()
local player_z = posy()
local player_z = posz()

for x = -7, 7, 1 do
    for y = -5, 5, 1 do
        local top_item = topitem(player_x + x, player_y + y, player_z)
        for _, item in ipairs(Items) do
            if top_item.id == item then
                reachlocation(player_x + x, player_y + y, player_z, true)
                wait(800, 1200)
                return
            end
        end
    end
end
Reply

#5
|Only Registered members can see download links. | Click here to buy subscription or here to register.

This works, just made a small change on local Player_z to (y)
but i dont understand why the other wont work i triple check the ID's i set all im unsure of is line 6. ofcourse gettiles() will result in all items found or it would be useless.
Reply

#6
Hello.

You don't need to change anything.

gettiles() works just fine, it returns information about all tiles on screen. However, the script isn't checking for all items but just the top one.
You can read about it here:
|Only Registered members can see download links. | Click here to buy subscription or here to register.


This would check for all items on tile.
local Items = { 1234 } -- Items ID to find and reach.

local tiles = gettiles()
for _, tile in ipairs(tiles) do
    for __, titem in ipairs(tile.items) do
        for ___, item in ipairs(Items) do
            if titem.id == item then
                reachlocation(tile.posx, tile.posy, tile.posz, true)
                wait(800, 1200)
                return
            end
        end
    end
end
Reply

#7
|Only Registered members can see download links. | Click here to buy subscription or here to register.

this one works. The first one WONT go to my item i chose. all others works fine. but guess it could cause overload if it wants to check for all items every time.

local Items = { 1948 } -- Items ID to find and reach.

local tiles = gettiles()
for _, tile in ipairs(tiles) do
    for __, item in ipairs(Items) do
        if tile.topitem.id == item then
            reachlocation(tile.posx, tile.posy, tile.posz, true)
            wait(800, 1200)
        end
    end
end

reachlocation(tile.posx, tile.posy, tile.posz, true) <---- Will not do this if i set item ID 1948 or any other ID's (i use HUD show cursor info enter the id i can see and enter it on local Items but it will not execute reachlocation or it keeeps trying but failing.
Reply

#8
|Only Registered members can see download links. | Click here to buy subscription or here to register.

Is it possible to reach the closest item of all found?
if i got one item 1sqm east of me it will always try reach top left item. guess it starts reading from top left to bottom right.
Reply

#9
Well, you can use tile.posx, tile.posy, player_x and player_y to calculate which is the closest one OR tilereachcost().

local Items = { 1234 } -- Items ID to find and reach.


local closest_tile = { cost = -1, posx = 0, posy = 0, posz = 0 }


local tiles = gettiles()
for _, tile in ipairs(tiles) do
    for __, titem in ipairs(tile.items) do

        local flag = false

        for ___, item in ipairs(Items) do
            if titem.id == item then
                local walk_cost = math.abs(player_x - posx) + math.abs(player_y - posy)
                if closest_tile.cost == -1 or walk_cost < closest_tile.walk_cost then
                    closest_tile =  { cost = walk_cost, posx = tile.posx, posy = tile.posy, posz = tile.posz }
                    flat = true
                    break
                end
              
            end
        end
        if flag then
            break
        end
    end
end

if closest_tile.cost >= 0 then
    reachlocation(closest_tile.posx, closest_tile.posy, closest_tile.posz)
    wait(800, 1200)
end

local Items = { 1234 } -- Items ID to find and reach.


local closest_tile = { cost = -1, posx = 0, posy = 0, posz = 0 }


local tiles = gettiles()
for _, tile in ipairs(tiles) do
    for __, titem in ipairs(tile.items) do
        local flag = false
        for ___, item in ipairs(Items) do
            if titem.id == item then
                local walk_cost = tilereachcost(tile.posx, tile.posy, tile.posz, false)
                if closest_tile.cost == -1 or walk_cost < closest_tile.walk_cost then
                    closest_tile =  { cost = walk_cost, posx = tile.posx, posy = tile.posy, posz = tile.posz }
                    flag = true
                    break
                end
            end
        end
        if flag then
            break
        end
    end
end

if closest_tile.cost >= 0 then
    reachlocation(closest_tile.posx, closest_tile.posy, closest_tile.posz)
    wait(800, 1200)
end
Reply

#10
|Only Registered members can see download links. | Click here to buy subscription or here to register.
awesome thanks.
Reply



Forum Jump:



Forum software by © MyBB Theme © iAndrew 2016