PDA

View Full Version : Use Item at ground always with the same ID



softbzero
12-14-2015, 01:16 PM
shadowart
i know you will help me.
I need to know there is avaiable command in xenobot which char use on others positions these same id statue.
example:
if my char is in venore then label xxx use statue . if im in yalahar then this same label xxx and use statue.. i know i made it with Self.useitemonground(pos) but i dont have time to checking in ~11 cities pos of statues

shadowart
12-14-2015, 01:45 PM
You'll have to use Map.GetTopUseItem to search for the trainer on the screen:

local trainerIDs = {
["distance"] = 16201,
["sword"] = 16198,
["magic"] = 16202,
["axe"] = 16199,
["club"] = 16200
}

function logoutTrainer(skill)
local skill = skill:lower()
local trainerID = trainerIDs[skill]

if trainerID then
local pos = Self.Position()
for dx = -7, 7 do
for dy = -5, 5 do
if Map.GetTopUseItem(pos.x+dx, pos.y+dy, pos.z).id == trainerID then
Self.UseItemFromGround(pos.x+dx, pos.y+dy, pos.z)
wait(5000, 7000)
os.exit()
end
end
end
end

-- Catches both the situation when the user supplies an invalid skill, and the case when no trainer is visible.
os.exit()
end

If you don't want to close the client you can change the first os.exit() to return and the second to Self.Logout() or Cavebot.Stop().

softbzero
12-14-2015, 02:33 PM
shadowart
i think is only one line like
= self.useItemFromGround(xxx) but
ok thanks, need few changes but your help is always the best.
Thanks :)

softbzero
12-14-2015, 03:11 PM
I can't send pm to you, and it not need a new thread so i only ment you -> shadowart

and paste my problem there:

Hey, i know you are better scripter than me, and sometimes i need your help bro.
Also i wroted code with channel it work with actions like /resetbackpacks etc.
But i want make channel like in your or OX scripts.
-What?
Ok, so if my character in label xxx done action like shopsell , then in channel i need to print : xxxxxxx

But if i made this:


elseif (labelName == "Potions") then
channel:SendOrangeMessage('SoftbzeroInformations', 'XXxxxxxxxx')
Walker.Stop()
wait(400)
Self.SayToNpc('hi')
wait(500,800)
Self.SayToNpc('trade')
wait(500,800)
Self.ShopBuyItemsUpTo(ManaID, ManaMax)
wait(500,800)
Self.ShopBuyItemsUpTo(HealthID, HealthMax)
wait(400,500)

then it do nothing :/
also channel config:

http://pastebin.com/WuA64Xpv

I know you can help me. -> When you help me in some functions, then i always wrote in code (special thanks to you or something like this)
.

shadowart
12-15-2015, 05:03 AM
I hate your formatting but there's nothing straight up wrong about the code you posted. Most likely the error is due to channel being out of scope when used. There are two possible fixes for this: 1) Move the code that creates the channel so that it comes before the label handler. Or 2) Change channel from a local to a global variable.

softbzero
12-15-2015, 01:50 PM
Thanks shadowart.
Hate my formatting? What do you mean?

shadowart
12-15-2015, 01:54 PM
The code isn't consistently indented.

softbzero
12-15-2015, 02:17 PM
shadowart

Thank you for criticism , I'm sure I'll be working on this . thanks.