PDA

View Full Version : Help with Roadcolor in RadiallWalk



IronTeapot
10-25-2006, 08:48 PM
After following WT-Fakawi's RadialWalk tutorial, I pretty much know how to use it properly, the only problem is the change in road color each time a distance is walked that causes the game to load a new section.

How do I set it so it gets the new road color?
Would I use RadialRoadWalk, Cause I have tried that and it gives the following message
THROUGH MINIMAP!!!!!!!!---> 65536
RoadColor[1] = 65536
THROUGH RADIALROADWALK= ---> 65536

But that color is black, not the road color. And it clicks sometimes on the road color, and sometimes on whatever it wants. Unless I am using it wrong( Example: RadialRoadWalk(RoadColor,80,90,70,1,1);), could some one explain how it is to be used?

Any help walking roads would be appreciated. Just need this to work and I can submit my script to get membership status :D

WT-Fakawi
10-25-2006, 10:16 PM
Distance 70 should be within tolerance, however it is near the border of the minimap. Whenever the client loads, there sometimes is a large black rectangle at the outer border of the Minimap. With distance 70, you will prolly have clicked on the blackstuff, thus resulting in color 0 (black).

Workaround: Try taking smaller steps. I hardly ever walk in steps larger then 60, sometimes even 20 to come near to an object I have spotted.

Hope this helps.

CamHart
10-25-2006, 11:09 PM
Distance 70 should be within tolerance, however it is near the border of the minimap. Whenever the client loads, there sometimes is a large black rectangle at the outer border of the Minimap. With distance 70, you will prolly have clicked on the blackstuff, thus resulting in color 0 (black).

Workaround: Try taking smaller steps. I hardly ever walk in steps larger then 60, sometimes even 20 to come near to an object I have spotted.

Hope this helps.

Same thing happened to me, but i've lowered it to 30+random(7)ish and it would still find that same black color. So i threw this thing together, it works well for me.... And It's what I'm going to continue useing and updating until someone finds a better way, or explains how im doing the radialwalk wrong.


//Declare these in your whole program, whether useing or not. Unless you want to edit the functions
ABadColor: Array of Integer;
IBadColor, Road:integer;

Function InArray(One:Integer; Arrays:Array of Integer):Boolean;//Self Explainitory?
var c:integer;
Begin
For c:=0 to (GetArrayLength(Arrays) - 1) Do
If(One = Arrays[c])Then
Result:= true;
End;

Function RoadMaskBitMap:integer;
var
a, q, z, stuff:integer;
Begin
a := BitmapFromString(4, 3, 'z78DA7373A30E0000CEFE13B1');//bitmap of 4x3 area with same color
FindBitMapMaskTolerance(a, q, z, 648 - 70, 83 - 70, 648 + 70, 83 + 70, 1, 1)//searches for bitmap in minimap
stuff:= GetColor(q, z);//stuff gets the color from where the bitmap was found
If(q > 0)and(stuff > 0)Then//if the coords aren't crap (ill clean this up later) then it returns the color
Begin
Writeln('Coord: ('+IntToStr(q)+', '+IntToStr(z)+') - '+IntToStr(stuff));
result:=stuff;//stuff = color found at bitmap
End;
FreeBitMap(a);//frees bitmap so memory not sucked (atleast i hope)
End;

Function GetRoadColor:integer;
var c, w:integer;
compassangle:extended;
Begin
//ActivateClient; Might want this added in, ill test later
c:=0;
KeyDown(VK_Right);//should start camera turning
repeat
repeat
w:=RoadMaskBitMap;//w returns as the color from the search
Wait(1);//make this biggier for slower computers
c:=c+1;//counter to break loop
until(((w > 4000000) and (w < 8000000) and (Not (InArray(w, ABadColor)))) or (c > 15000));
If((C > 15000) and (Not (InArray(w, ABadColor))))Then Writeln('Road Color Might be Off');
until((w > 0) and (Not (InArray(w, ABadColor))));
KeyUp(VK_Right);
result:=w;
End;

When it attempts to rotate the camera, the client MUST be activated. When you're useing the radial road walk i suggest you add a counter, if the radialroadwalk returns false over so many times then have it add that road color to the ABadColor array.


If your useing radialroadwalk in a loop (repeat until, while do) then you'll want to add this in incase it finds bad colors.

//RadialRoadWalk crap
BadColorCount:= BadColorCount + 1;
If(BadColorCount > 100)Then //100 being it cannot find the road color
Begin
Writeln('Adding color to bad colors list');//tells you a bad color found, debugging
ABadColor[IBadColor]:= Road;//IBadColor is how many bad colors have been found ABadColor is an array storing all of the bad colors
IBadColor:= IBadColor + 1;//
Road:= GetRoadColor; //Gets a new color
PerfectNorth; //Makes map north again
End;



Seems to work for me so far, I'm going to see if i can make it better for slower computers. Add biggier waits in for slower computers for now though... It might bug, but i like it better than the getcolor stuff they already have.

Edit: If you start to see "Coord: x, y - color" and the camera isn't moving then the client isn't activated properly. Just click the RS screen and move the camera for it.

IronTeapot
10-26-2006, 02:06 AM
@WT-Fakawi, I tried almost every number of radial tolerance between 5 and 60, it would stiff give me the same message, just with the number being a black color.

What I am trying to do is walk from the lumbridge castle court yard to the cow pen accross the river. Would you be able to include a few lines of code to get me started moving in that direction with it getting the proper road color? IF I use RadialWalk and input the color manually it works almost perfect, but stops working when the client changes the road color.

@CamHart, I realy have no idea what your code is trying to do or how to incorporate it into my script, so I cant really use it.

CamHart
10-26-2006, 02:40 AM
Lol sorry mate... I'll try to clear it up. What my code does, is looks for bitmaps of areas 4X3 or larger with all the same color in the minimap. Once it finds a bitmap, it gets the color from the the coords it returns having found the bitmap at. I walked around a little, and found that the road colors are almost always greater than 4000000 and less than 8000000. So it looks until it finds a bitmap with those colors. Once it does find one, then it returns as that color.

Now, because i understand that it will find some bitmaps who's colors aren't roads, i added this "ABadColor" array (Not necessary, but recommended). Now so far whenever i use RadialRoadWalk (I havent used it that much), I've always had it in a loop until it finds something. So the way this ABadColor array works is if it cant find the road color RadialRoadWalk say 100 times, then it gets a new color for the road, stores the currentbad color in the ABadColor array, and never returns that color again.

I'm sorry this is still very confusing lol, It's a little late and I'll try to post a better one or i could get on aim/msn/gtalk to talk you through it if you want.

Until then I'll post the start of my first script (first rs2 atleast, i made a few rsc ones way way back). It's a miner.

If the road colors change halfway through the first script show's you how to work around it. The second won't, but both have examples of how to use my methods for getting road colors.

IronTeapot
10-26-2006, 02:27 PM
Hey, thats a pretty good explanation, And yeah I wouldnt mind a walkthrough, ill PM you my gtalk. Im at school atm, so i cant check out the way you used the script, but ill make sure to check it out when i get home.

EDIT: Ok, I understand your code now, just not really how to implement it. Like how do i call to it when i need to find the road color? and then start walking the desired direction.

If only radialroadwalk would work....WT-Fakawi & Wizzup? whats wrong with radialroadwalk! :'(

EDIT2: OK got RadialRoadWalk to work, turns out i have to give it the starting road color, and it will dynamically change thereafter. Cant just use RadialRoadWalk(RoadColor,90,120,60,0,0) for example and expect it to pick the road color... Although CamHart's way of finding those bitmap things is pretty neat. Possibily even an added alternate SRL include function to auto get colors?