also,
Depending upon how Type Variables are accessed in DBpro, you'd most likely be better off pulling the players details into LOCAL variables (since the players position isn't changing) rather than constantly checking fields from the type. (which is most likely 2 operations i.e. the first being pop to a temp local anyway)
The only other thing that comes to mind (apart from what is already stated), is that you can remove those calcs on MAXGRID X & Y in the second nest, mostly outside the inner loop. For the Y calc it really depends a lot on whats in the look up table, but anyway.
found=FALSE()
; MOve player into some locals
PlayerX#=playerInfo(player).x#
PlayerZ#=playerInfo(player).z#
for tX=0 to MAXGRIDX>>1
` pre calc the X offset for this row
MAXGRIDX_SUBTX=MAXGRIDX-tX
MAXGRIDY_SUBTX= MAXGRIDY>>1
for tY=0 to MAXGRIDY>>1
if gridData(tX,tY).inRange=GRID_INRANGE
if PlayerX#>=gridData(tX,tY).x
if PlayerX#<=gridData(tX,tY).dx
if PlayerZ#>=gridData(tX,tY).y
if PlayerZ#<=gridData(tX,tY).dy
x=tX
y=tY
found=TRUE()
` Set Outer loop counter pass the 'to' limit.
tX=MAXGRIDX
exit
endif
endif
endif
endif
endif
if gridData(MAXGRIDX_SUBtX,MAXGRIDY_SUBtY).inRange=GRID_INRANGE
if playerx#>=gridData(MAXGRIDX_SUBtX,MAXGRIDY_SUBtY).x
if playerx#<=gridData(MAXGRIDX_SUBtX,MAXGRIDY_SUBtY).dx
if playerZ#>=gridData(MAXGRIDX_SubtX,MAXGRIDY_SUBtY).y
if playerZ#<=gridData(MAXGRIDX_SubtX,MAXGRIDY_SUBtY).dy
x=tX
y=tY
found=TRUE()
` Set Outer loop counter pass the 'to' limit.
tX=MAXGRIDX
exit
endif
endif
endif
endif
endif
dec MAXGRIDY_SUBTX
next tY
next tX
Kevin Picone
Play Basic - Visible Worlds - Kyruss II
[url]www.underwaredesign.com[/url]