Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home/iano/public_html/tpforums-vb5/forum/includes/class_core.php on line 5842

PHP Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_BOTH - assumed 'MYSQL_BOTH' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 588

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 612

PHP Warning: Use of undefined constant archive_postsperpage - assumed 'archive_postsperpage' (this will throw an Error in a future version of PHP) in ..../archive/index.php on line 456
UseItemOnTile - what is wrong? [Archive] - Forums

PDA

View Full Version : UseItemOnTile - what is wrong?



muttley
11-28-2009, 09:45 PM
Hello,

What wrong in my code?


client.Inventory.UseItemOnTile(Tibia.Constants.Ite ms.Tool.Rope,Tibia.Constants.Tiles.Rope);

Also tried that


client.Inventory.UseItemOnTile(3003,386);

Muttley

DarkstaR
11-28-2009, 11:05 PM
I'm pretty sure you need a tile object which represents which actual tile on the map to use it on?

I dont use TibiaAPI but I'm pretty sure that is needed.

muttley
11-28-2009, 11:18 PM
Yes, because I'm making a cavebot - everything works, but I need to use item X on tile Y or use item X on X,Y,Z but I didn't find any funcs in TibiaAPI like UseItemOnXYZ.

Keyen Night
11-29-2009, 10:47 PM
client.Inventory.UseItemOnTile(Tibia.Constants.Ite ms.Tool.Rope,Tibia.Constants.Tiles.Rope);

All parameters are wrong, you are passing to parameter a const and this parameter need id of item and tile in where use item and you can give this information first obtain the tile for position and agree .Id to rope consts


client.Inventory.UseItemOnTile(Tibia.Constants.Ite ms.Tool.Rope.Id, client.Map.GetTile(New Location(0, 0, 0)));

:D Sorry my bad english

muttley
11-30-2009, 03:12 PM
Location ropeplace;
ropeplace = new Location(Convert.ToInt16(Split[1]), Convert.ToInt16(Split[2]), Convert.ToInt16(Split[3]));
client.Inventory.UseItemOnTile(Tibia.Constants.Ite ms.Tool.Rope.Id, client.Map.GetTile(ropeplace));

That code works for rope, thanks.

But one question - what about ladders?


Location useladder;
useladder = new Location(Convert.ToInt16(Split[1]), Convert.ToInt16(Split[2]), Convert.ToInt16(Split[3]));
client.Inventory.UseItemOnTile(Tibia.Constants.Til es.UpUse.Ladder3, client.Map.GetTile(useladder));

How to ?

Ian
11-30-2009, 05:04 PM
For ladders, you need to get the ladder Item on the tile at that location (I think it is the topmost item), and the call Use() on that Item.

Keyen Night
12-01-2009, 02:09 AM
I make this function to my bot :D


Public Function IsLadder(Byval sclient As Client, ByVal Loc As Location) As Boolean
For Each lItem As Item In sclient.Map.GetTile(Loc).Items
IsLadder = IsLadder Or lItem.LensHelp = Addresses.DatItem.Help.IsLadder)
Next
End Function

Return true is have Ladder in a location and false if not have any ladder.

Ian
12-04-2009, 05:54 AM
Good use of LensHelp!