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
drop loot
#1
im trying something like this..
the goal is to drop loot on ground depending on which place i am.

if tileshootable(LOCATION5.X,LOCATION5.Y,LOCATION5.Z) then
    for _, item in ipairs(ITEMS_DROP) do
        if itemcount(item) > 0 then
            moveitems(item, ground(LOCATION5.X,LOCATION5.Y,LOCATION5.Z), '', 100)
            wait(173, 251)
        end
    end
end
if tileshootable(LOCATION50.X,LOCATION50.Y,LOCATION50.Z) then
    for _, item in ipairs(ITEMS_DROP) do
        if itemcount(item) > 0 then
            moveitems(item, ground(LOCATION50.X,LOCATION50.Y,LOCATION50.Z), '', 100)
            wait(173, 251)
        end
    end
end
if tileshootable(LOCATION6.X,LOCATION6.Y,LOCATION6.Z) then
    for _, item in ipairs(ITEMS_DROP) do
        if itemcount(item) > 0 then
            moveitems(item, ground(LOCATION6.X,LOCATION6.Y,LOCATION6.Z), '', 100)
            wait(173, 251)
        end
    end
end
if tileshootable(LOCATION7.X,LOCATION7.Y,LOCATION7.Z) then
    for _, item in ipairs(ITEMS_DROP) do
        if itemcount(item) > 0 then
            moveitems(item, ground(LOCATION7.X,LOCATION7.Y,LOCATION7.Z), '', 100)
            wait(173, 251)
        end
    end
end
if tileshootable(LOCATION70.X,LOCATION70.Y,LOCATION70.Z) then
    for _, item in ipairs(ITEMS_DROP) do
        if itemcount(item) > 0 then
            moveitems(item, ground(LOCATION70.X,LOCATION70.Y,LOCATION70.Z), '', 100)
            wait(173, 251)
        end
    end
end

i get in console LUA Script -> drop items: 18: global 'tileshootable' is not callable (a nil value)
why? is there a better way to write this code?

keep in mind the moveitems part works flawlessly, which means that the values i assigned to LOCATION variables are working.
Reply

#2
Hello.

It's likely that you are replacing the tileshootable function with nil somewhere then LUA cannot find it when it's going to use it.

Open Bot and run this on Bot's Console tab:
print(type(tileshootable))
It will print "function", because it's defined when you start Bot.
If you run the code above in your script and it prints "nil" then it has been replaced somewhere in your code.

If you recreate the Persistent then Bot will recreate LUA instance and redeclare tileshootable properly.
Reply

#3
I recreated it and everything works, ty.

I think you have a typo in the docs:
|Only Registered members can see download links. | Click here to buy subscription or here to register.


The description for isposonscreen() and isitemontile() are switched

Im trying to use isposonscreen and I get LUA Script -> Persistent01: 18: global 'isposonscreen' is not callable (a nil value)

Same usage:

if isposonscreen(LOCATION5.X,LOCATION5.Y,LOCATION5.Z) then
    for _, item in ipairs(ITEMS_DROP) do
        if itemcount(item) > 0 then
            moveitems(item, ground(LOCATION5.X,LOCATION5.Y,LOCATION5.Z), '', 100)
            wait(111, 322)
        end
    end
end
Reply

#4
Hello.

Thanks for the heads up, i will fix it.

isposonscreen doesn't exists on Kasteria OTBot for some reason, i will fix on next release.
For now, this will work:
if math.abs(posx() - LOCATION5.X) <= 7 and math.abs(posy() - LOCATION5.Y) <= 5 and posz() == LOCATION5.Z then
    for _, item in ipairs(ITEMS_DROP) do
        if itemcount(item) > 0 then
            moveitems(item, ground(LOCATION5.X,LOCATION5.Y,LOCATION5.Z), '', 100)
            wait(111, 322)
        end
    end
end
Reply

#5
Ok, thanks for the solution and fast responses.
Reply



Forum Jump:



Forum software by © MyBB Theme © iAndrew 2016