SRL Archive - OSR Help

Help with multiple road colors


GREEN GIANT

2013-07-02 18:07:38

Hi, i'm very new to writing scripts but have been using them for a while. Basically i am using RadialRoadWalking to navigate the map

and of course as you all know the colors are constantly changing, I've accumulated a list of the various color integers and now need

to know how i can call upon the RadialRoadWalking function to distinguish between which is needed etc.

I've seen a lot of people using autocolor functions but i cant seem to get my head around it all. Can anyone help?

EDIT: To further explain myself, at present my function reads as follows;

const

RoadA = 45464654;
RoadB = 54848484;

begin
RadialRoadWalk(RoadA,160,200,49,50,50)
RadialRoadWalk(RoadB,160,200,49,50,50)

But i would like my script to be more like

const

RoadA = 45464654, 485485, 8484854, 8485454;
RoadB = 54848484, 7848484, 8484848, 848484;

begin
RadialRoadWalk(RoadA,160,200,49,50,50)
RadialRoadWalk(RoadB,160,200,49,50,50)

How would i make it search all possibilities of RoadA and then click to one if its available?

NKN

2013-07-03 01:18:47

From: GREEN GIANT
/clear


You'd put all the colors into an integer array and loop through it I guess.


var
RoadA:TIntArray;
i:integer;
RoadA := numbers
for i := 0 to High(RoadA) do
begin
if(RadialRoadWalk(RoadA[i],x1,y1,x2,y2)) then
//code here
end;

Typed that out here, dunno if it's 100% correct

GREEN GIANT

2013-07-03 07:32:34

Hi thanks for the help but i still cant get it work :( Can you see the problem with the following code;

program New;
{$DEFINE SMART8}
{$i SRL-OSR\SRL.Simba}

var
RoadAArray:TIntegerArray;
i:Integer;

begin
setupsrl;
setlength(RoadAArray,7);
RoadAArray[0] :=5000276;
RoadAArray[1] :=6776687;
RoadAArray[2] :=6974065;
RoadAArray[3] :=7105652;
RoadAArray[4] :=7171702;
RoadAArray[5] :=7105908;
RoadAArray[6] :=7171958;

for i := Low(RoadAArray) to High(RoadAArray) do
writeLn(ToStr(RoadAArray));

makecompass('N')
RadialRoadWalk(RoadAArray,160,200,49,50,50) @@at present its say im out of range on this line
end.

The Mayor

2013-07-03 07:50:19

From: GREEN GIANT
Hi thanks for the help but i still cant get it work :( Can you see the problem with the following code;

program New;
{$DEFINE SMART8}
{$i SRL-OSR\SRL.Simba}

var
RoadAArray:TIntegerArray;
i:Integer;

begin
setupsrl;
setlength(RoadAArray,7);
RoadAArray[0] :=5000276;
RoadAArray[1] :=6776687;
RoadAArray[2] :=6974065;
RoadAArray[3] :=7105652;
RoadAArray[4] :=7171702;
RoadAArray[5] :=7105908;
RoadAArray[6] :=7171958;

for i := Low(RoadAArray) to High(RoadAArray) do
writeLn(ToStr(RoadAArray));

makecompass('N')
RadialRoadWalk(RoadAArray,160,200,49,50,50) @@at present its say im out of range on this line
end.


Try this


program New;
{$DEFINE SMART8}
{$i SRL-OSR\SRL.Simba}

var
RoadAArray: TIntegerArray;
i: Integer;

begin
setupsrl;
RoadAArray := [5000276, 6776687, 6974065, 7105652, 7171702, 7105908, 7171958];
setlength(RoadAArray, Length(RoadAArray));
for i := Low(RoadAArray) to High(RoadAArray) do
begin
writeLn(ToStr(RoadAArray[i]));
makecompass('N')
RadialRoadWalk(RoadAArray[i],160,200,49,50,50)
end;
end.

GREEN GIANT

2013-07-03 08:21:05

From: The Mayor
Try this


program New;
{$DEFINE SMART8}
{$i SRL-OSR\SRL.Simba}

var
RoadAArray: TIntegerArray;
i: Integer;

begin
setupsrl;
RoadAArray := [5000276, 6776687, 6974065, 7105652, 7171702, 7105908, 7171958];
setlength(RoadAArray, Length(RoadAArray));
for i := Low(RoadAArray) to High(RoadAArray) do
begin
writeLn(ToStr(RoadAArray[i]));
makecompass('N')
RadialRoadWalk(RoadAArray[i],160,200,49,50,50)
end;
end.


Worked a charm thank you :)

Another question if i may, i now want to repeat the process for a second array (different color path) i've just tried declaring RoadBArray: TIntegerArray; as a second variable and pasted the code below but now it just continuously lists the integers in my chat box without attempting to move.

So my question is, how do i now stop the initial Radialwalk and start a new one after it with a new set of Arrays.

EDIT: I kind of got it to work, but any input is greatly appreciated as i'm guessing my method isn't the most efficient.