View Full Version : TileToMS, TGroundItem
blackfire553
07-01-2011, 07:19 PM
My problem is that when i convert a tile of a TGroundItem to mainscreen coordinates, it is never accurate. When i do not use offsets, it is typically a little bit to the lower right of the item. Using offsets in the x and y for the Mouse function makes it more accurate, but i feel this is a temporary solution for a larger problem.
The code i use is this:
ItemsOnGround := GetItemsNear(Players[CurrentPlayer].Integers[0]);
For j := 0 to high(ItemsOnGround) do
begin
ItemPoints[j] := TileToMS(ItemsOnGround[j].Tile,0)
end;
SortTPAFrom(ItemPoints,GetMyPos);
Mouse(ItemPoints[i].x, ItemPoints[i].y, 0, 0, false);
I want to be able to convert the MS point back into a tile to get the item again and check the ID, but it doesnt work because i cant get the proper coordinates anyways.
Another thing i noticed is that the ItemsOnGround[j].height is usually between -800 and -900.
Capricorn
07-01-2011, 10:08 PM
Just use the middle of the tile? That way you won't have to use negative height lol
blackfire553
07-02-2011, 05:51 AM
Just use the middle of the tile? That way you won't have to use negative height lol
how?
Smarter Child
07-02-2011, 07:48 AM
how?
MiddleTPA?
Although, you don't even sort the ground objects, GetItemsNear with 1-2 will only search in the squares very near to you.
Not to mention you can verify it via ID checking.
blackfire553
07-02-2011, 06:29 PM
MiddleTPA?
Although, you don't even sort the ground objects, GetItemsNear with 1-2 will only search in the squares very near to you.
Not to mention you can verify it via ID checking.
Im using GetItemsNear to find the tiles with items, i dont use TPAs except for the location to click the items.
Edit: So middleTPA wont work because the points are random dots all over the screen where items are located. (one dot per item)
I changed my code to where i dont need to convert the point back into a tile, but i still would like to have the exact coordinates without using offsets.
Awkwardsaw
07-02-2011, 06:37 PM
Im using GetItemsNear to find the tiles with items, i dont use TPAs except for the location to click the items.
Edit: So middleTPA wont work because the points are random dots all over the screen where items are located. (one dot per item)
I changed my code to where i dont need to convert the point back into a tile, but i still would like to have the exact coordinates without using offsets.
You can try to make a box around the tile of ground item, then find the middle of the tile. you shouldnt be picking up items that are more than 2-3 tiles away from your character anyways :p
Smarter Child
07-02-2011, 07:32 PM
Im using GetItemsNear to find the tiles with items, i dont use TPAs except for the location to click the items.
Edit: So middleTPA wont work because the points are random dots all over the screen where items are located. (one dot per item)
I changed my code to where i dont need to convert the point back into a tile, but i still would like to have the exact coordinates without using offsets.
The exact coordinate of ground items can be retrieved, and there is no need for any off-sets..
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.