SRL Archive - OSR Help

Object DTM Out of Range Error


mounty

2012-11-15 19:56:12

Hi guys

I've written a firemaking script which uses objdtm as a walking system between the bank and road outside.

While running the script i am getting an error which takes me to the ObjDTMInclude script. The error is: 'Error: Out Of Range at line 647'

This error relates to the section of ObjDTMIncludes shown below for groundlevelcheck:

function GroundLevelCheck: Boolean;
By: euphemism
Last Edit: 03 Apr 2012 -- euphemism
Description: Creates a circular slice out of the minimap, and checks to see
if the dominant color is black.
*******************************************************************************)
var
H, Half, I, Passed, TempColor, TPALength, Valid: Integer;
Lum, Hue, Sat: Extended;
begin

for H := 0 to 4 do
begin

[COLOR="Red"]TPALength[/COLOR] := Length(MinimapSlices[h]);
Half := Floor(TPALength / 2);

for I := 0 to (TPALength - 1) do
begin
{$DEFINE SMART}
{$i srl/srl.simba}
{$i ObjectDTM\ObjDTMInclude.simba}
TempColor := GetColor(MinimapSlices[h][i].x, MinimapSlices[h][i].y)
ColorToHSL(TempColor, Hue, Sat, Lum);

if Lum < 5 then
Inc(Valid);
end;
if (Valid < Half) then
Inc(Passed);
end;
Result := (Passed > 2);
end;

I've tried all i can think of to make it work but i know its bound to be something stupid and simple. I have used the same code (different ObjDTM) in another script and it works fine so cant understand whats going wrong here.

Below is the section of script that causes the error to occur.
Specifically it occurs at the if statement highlighted.

Procedure WalkOutside;
var x,y: integer;
OutsideDTM: TStringArray;
begin
OutsideDTM := ['79:61:1:0:7:76:49:4:65:38:66:73:107:74:92:32']; //'86:52:3:0:7:76:37:1:7:115:36:2:7:111:65:5:43:19:24:70:124:109:150:48:114:9'];

[COLOR="Red"]if ObjDTM_InArea(OutsideDTM[0], True) then[/COLOR]
begin
ObjDTM_Walk(OutsideDTM[0], 0, 100, 80, True);
Writeln('We are Outside!');
end
else
begin
writeln('Outside not found');
//do something else
end;
end;

Hope someone can help

Thanks

Ian

2012-12-20 19:46:17

Hey mounty :). I just had the exact same problem, and a google search brought me here :D. Did you find a way to fix it? I think that the problem may be from choosing sub-points that are too close to the edge of the minimap. I'll try with different sub-points and report back.

Olly

2012-12-20 20:05:36

Sure your doing ObjDTM_Setup?

Ian

2012-12-20 20:16:41

From: Ollybest
Sure your doing ObjDTM_Setup?


Whoops, yeah I forgot to add it.:duh:

Thanks :p

euphemism

2012-12-20 22:08:38

From: Ollybest
Sure your doing ObjDTM_Setup?


Yup, that would be your problem.