Page 1 of 1

How to find out if there is any kind of obejct on the ground

Posted: 2009-12-02 20:31:31
by solin
Hello, I am finishing my mining script and now I need to do last thing... walking, on my shard it is nightmare because of rocks appearing on the ground. My idea is to scan the direction I want to go if there is a rock on the ground or not, if there is rock, try to find different path. I hope it is clear what I need. Some function like IsThereObjectOnTheGround, is in inject something like that?

Posted: 2009-12-03 13:22:00
by Ever1x
Can you get information with command ,info?
,info -> Target that rock or something -> Does info shows up?

Posted: 2009-12-03 15:02:05
by solin
yes it does show info.
now I found this
,findtype type [color container_object|ground|my] - seek for object and point finditem on it if found.
Number of item stacks found may be retrieved by uo.findcount()

this is almost what I need, the only trouble is that it is scaning all the squares in finddistance, just if I can set the coords where it should scan, it will be great

Posted: 2009-12-03 18:27:02
by Destruction
solin wrote:yes it does show info.
now I found this
,findtype type [color container_object|ground|my] - seek for object and point finditem on it if found.
Number of item stacks found may be retrieved by uo.findcount()

this is almost what I need, the only trouble is that it is scaning all the squares in finddistance, just if I can set the coords where it should scan, it will be great

Is'nt supported.

You must search using finddistance and filter search results.

e.g.:

Code: Select all

; rock description
var rock_type = '0x0000'
var rock_colr = '0x0000'
; search tile x,y
var tile_x = 1500
var tile_y = 1600
var result = false
uo.ignorereset()
uo.findtype( rock_type, rock_colr, 'ground' )
while uo.findcount()
    if uo.getX( 'finditem' ) == tile_x and uo.getY( 'finditem' ) == tile_y then
        result = true
    endif
    uo.ignore( 'finditem' )
    uo.findtype( rock_type, rock_colr, 'ground' )
wend
if result then
    ; rock was found in defined coordinates
else
    ; rock wasnt found
endif

Re: How to find out if there is any kind of obejct on the gr

Posted: 2009-12-03 19:58:15
by Nmy
solin wrote:Hello, I am finishing my mining script and now I need to do last thing... walking, on my shard it is nightmare because of rocks appearing on the ground. My idea is to scan the direction I want to go if there is a rock on the ground or not, if there is rock, try to find different path. I hope it is clear what I need. Some function like IsThereObjectOnTheGround, is in inject something like that?


This will not work.
Use already known walkers.

Posted: 2009-12-03 22:19:24
by solin
Destruction wrote:
solin wrote:yes it does show info.
now I found this
,findtype type [color container_object|ground|my] - seek for object and point finditem on it if found.
Number of item stacks found may be retrieved by uo.findcount()

this is almost what I need, the only trouble is that it is scaning all the squares in finddistance, just if I can set the coords where it should scan, it will be great

Is'nt supported.

You must search using finddistance and filter search results.

e.g.:

Code: Select all

; rock description
var rock_type = '0x0000'
var rock_colr = '0x0000'
; search tile x,y
var tile_x = 1500
var tile_y = 1600
var result = false
uo.ignorereset()
uo.findtype( rock_type, rock_colr, 'ground' )
while uo.findcount()
    if uo.getX( 'finditem' ) == tile_x and uo.getY( 'finditem' ) == tile_y then
        result = true
    endif
    uo.ignore( 'finditem' )
    uo.findtype( rock_type, rock_colr, 'ground' )
wend
if result then
    ; rock was found in defined coordinates
else
    ; rock wasnt found
endif


this was very usefull, thanks

Posted: 2009-12-06 03:35:35
by CuHTpoH
findtype does not work for static objects
use injection.dll of version 505.18 and use function uo.privategettile
You can find out how it works by search on this forum

Posted: 2009-12-06 19:04:33
by solin
CuHTpoH wrote:findtype does not work for static objects
use injection.dll of version 505.18 and use function uo.privategettile
You can find out how it works by search on this forum


Yes that was new to me, I have findtype for the rock searching and I am using privategettile for searching the possible mining spots and paths, I have this done, now I need to think about some clever walking alg, but now when I have these searching tools, it should not be big problem:)

Posted: 2009-12-07 11:10:44
by Destruction
Try to search something like AStar alg.

Also u can see/modify existing walkers.

See this post: viewtopic.php?p=66813#66813

Posted: 2009-12-07 11:19:59
by CuHTpoH
imho if you wanna really good walker, the only way to do your own or use perl injection pathfinder on 2.0.3 :)