I think it's a problem with the way I'm using my DDTM, but I can't seem to figure it out, my head's about ready to explode
Probably a nooby mistake...But here it is -
SCAR Code:
function LoadAllDTMWalks(WalkNumber: Integer): Integer;
var
dtmMainPoint: TDTMPointDef;
dtmSubPoints: array[0..4] of TDTMPointDef;
TempTDTM: TDTM;
begin
RDTMArea := 1;
case WalkNumber of
1: begin
dtmMainPoint.x := 857;
dtmMainPoint.y := 347;
dtmMainPoint.AreaSize := 1;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Color := FindFallyRoadColor;
dtmMainPoint.Tolerance := 1;
dtmSubPoints[0].x := 857;
dtmSubPoints[0].y := 347;
dtmSubPoints[0].AreaSize := RDTMArea;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Color := FindFallyRoadColor;
dtmSubPoints[0].Tolerance := 1;
dtmSubPoints[1].x := 853;
dtmSubPoints[1].y := 337;
dtmSubPoints[1].AreaSize := RDTMArea;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Color := FindFallyRoadColor;
dtmSubPoints[1].Tolerance := 1;
dtmSubPoints[2].x := 864;
dtmSubPoints[2].y := 342;
dtmSubPoints[2].AreaSize := RDTMArea;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Color := FindFallyRoadColor;
dtmSubPoints[2].Tolerance := 1;
dtmSubPoints[3].x := 852;
dtmSubPoints[3].y := 342;
dtmSubPoints[3].AreaSize := RDTMArea;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Color := FindFallyRoadColor;
dtmSubPoints[3].Tolerance := 1;
dtmSubPoints[4].x := 852;
dtmSubPoints[4].y := 336;
dtmSubPoints[4].AreaSize := RDTMArea;
dtmSubPoints[4].AreaShape := 0;
dtmSubPoints[4].Color := FindFallyRoadColor;
dtmSubPoints[4].Tolerance := 1;
TempTDTM.MainPoint := dtmMainPoint;
TempTDTM.SubPoints := dtmSubPoints;
Result := AddDTM(TempTDTM);
end;
end;
end;
Yes, I know it isn't finished yet ^^
SCAR Code:
procedure WalkToShop;
var rx,ry, count,x1,y1,x2,y2: integer;
begin
if not(loggedin) then LoginPlayer;
case Players[CurrentPlayer].Loc of
'havethecash': begin //Inside the bank ready to go
LoadAllDTMWalks(1);
count := 0;
repeat
if DTMRotated(TempTDTM,x,y,x1,y1,x2,y2) then
begin
mouse(x,y,2,2,true);
writeln('used ddtm');
FFlag(3);
break;
end else
begin
RDTMArea := RDTMArea + 1;
count := count + 1;
end;
until (count >= 10);
FreeDTM(TempTDTM);
if (count >= 10) then
begin
if not RadialRoadWalk(FindFallyRoadColor, 200, 260, 70, 2, 2) then
begin
if not RadialRoadWalk(FindFallyRoadColor, 190, 270, 70, 2, 2) then
begin
if not RadialRoadWalk(FindFallyRoadColor, 190, 270, 70, 2, 2) then
begin
if (UseCoords) then
begin
mouse(0,0,5,5,true); //NEED TO ADD COORDS
FFlag(3);
end else
begin
writeln('Failed walking to the shop, next player');
NextPlayer(false);
if (ActivePlayers = 0) then
begin
if (PlayMusic) then
PlaySound(Location);
end;
exit;
end;
end;
end;
end;
FFlag(3);
end;
Players[CurrentPlayer].Loc := '2pos';
end;
And there's where I use it, and I think I use it incorrectly (^^ That isn't the whole procedure btw). Also please point out any errors in my coding or anything I can improve on/shorten.
The error I'm getting -
SCAR Code:
[Runtime Error] : Exception: Access violation at address 006D691C in module 'scar.exe'. Read of address 00000000 in line 73 in script C:\Program Files\SCAR 3.15(2)\includes\SRL/SRL/Core/Color.scar
I searched this, and only found 1 result in which the error occurred because the DTM was improperly used.