//============================================================================\\ //----------------//===\\ Auto Road Color Finder v2.1 //===\\-----------------\\ //----------------------//===\\ Author: Kelreth //===\\-----------------------\\ //-----------------//===\\ Released: October 24, 2005 //===\\-----------------\\ //============================================================================\\ // \\ // This script is built to determine the color \\ // of the road on your Minimap in the free \\ // world. It may or may not work in members \\ // only areas. In most cases this script can \\ // detect the Road Color as long as it is on \\ // your Minimap. \\ // \\ // This script is NOT to be modified or edited \\ // in ANY fashion. This script is free and is \\ // never to be sold. \\ // \\ // Questions and comments can be E-Mailed to \\ // Kelreth at, 'Kelreth@Gmail.com'. \\ // \\ // Thanks to Masquerader for the awesome help \\ // and inspiration to using bitmaps as the \\ // primary detection system. Also for his \\ // great 'Beta' testing abilities. \\ // \\ //============================================================================\\ //-----------------------//===\\ Version History //===\\----------------------\\ //============================================================================\\ // \\ // v1.0 - DTM Support added. \\ // v1.1 - Added backup Color Finder using FindColorTolerance. \\ // v1.2 - Added Manual Road Color, if needed. \\ // v1.3 - Added auto retry to find color. \\ // v1.4 - Added rotate to North. \\ // v1.5 - More DTMs for added detection. \\ // v1.6 - Fixed 'jumpy' rotation. \\ // v2.0 - Reworked detection systems. No longer uses FindColorTolerance, but \\ // in turn uses Bitmaps, and DTMs as backup. \\ // v2.1 - Fixed lag issue when searching for bitmap. \\ // \\ //============================================================================\\ //---------------------------//===\\ Setup //===\\----------------------------\\ //============================================================================\\ // \\ // Add the following command to the beginning of a script that needs the \\ // road color to be detected. \\ // FindRoadColor; \\ // \\ // Once found the road color is set to the variable \\ // "RoadColor" \\ // \\ // Your can set the road color manually using this variable. \\ // ManualRoadColor:=######; \\ // \\ // If 'ManualRoadColor' is set to 0 then the road color will be auto \\ // detected by this script. \\ // \\ // Built in Rotation System allows you to rotate your minimap to your \\ // specified angle. \\ // RotateMinimap('#');// N=North, E=East, S=South, W=West. \\ // \\ // Don't forget to include this script using \\ // {.include ARCF.txt} \\ // \\ //============================================================================\\ var CurrentMMAngle,MMAngle,RoadBMP,RoadColor,ManualRoadColor,RCx,RCy,RoadColorCurrentDTM,RoadColorDTM,RoadColorDTMAmount: Integer; RoadColorFound,RoadColorFoundDTM: Boolean; MinimapDirection,MinimapDirectionLong:string; ///////////////////////////////////==========\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ // >>> Rotates Minimap to specified direction. <<< \\ ///////////////////////////////////==========\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ procedure StopRotatingMinimap; begin repeat Status('Rotating to '+MinimapDirectionLong+'...'); CurrentMMAngle:=trunc(180/Pi*DetectRS2MinimapCompassAngle); if(CurrentMMAngle<(MMAngle+10))and(CurrentMMAngle>(MMAngle-10))or (MinimapDirection='N')and(CurrentMMAngle<=10)and(CurrentMMAngle>=350)then begin KeyUp(VK_Right); KeyUp(VK_Left); break; end; wait(100); until(false); Status(''); end; procedure RotateMinimap(MinimapDirection:String); begin if(not(MinimapDirection='N'))and(not(MinimapDirection='E'))and(not(MinimapDirection='S'))and(not(MinimapDirection='W'))then begin Writeln('Invalid direction.'); TerminateScript; end; CurrentMMAngle:=trunc(180/Pi*DetectRS2MinimapCompassAngle); SendArrowSilentWait(0,2000); case MinimapDirection of 'N', 'NORTH': begin MMAngle:=360; MinimapDirectionLong:='North'; if(CurrentMMAngle>=180)then KeyDown(VK_Right); if(CurrentMMAngle<180)then KeyDown(VK_Left); StopRotatingMinimap; end; 'E', 'EAST': begin MMAngle:=270; MinimapDirectionLong:='East'; if(CurrentMMAngle>=90)and(CurrentMMAngle<=270)then KeyDown(VK_Right); if(CurrentMMAngle<=90)or(CurrentMMAngle>=270)then KeyDown(VK_Left); StopRotatingMinimap; end; 'S', 'SOUTH': begin MMAngle:=180; MinimapDirectionLong:='South'; if(CurrentMMAngle>=0)and(CurrentMMAngle<=180)then KeyDown(VK_Right); if(CurrentMMAngle<=360)and(CurrentMMAngle>=180)then KeyDown(VK_Left); StopRotatingMinimap; end; 'W', 'WEST': begin MMAngle:=90 MinimapDirectionLong:='West' if(CurrentMMAngle<=90)or(CurrentMMAngle>=270)then KeyDown(VK_Right) if(CurrentMMAngle>=90)and(CurrentMMAngle<=270)then KeyDown(VK_Left) StopRotatingMinimap; end; end; end; ///////////////////////////////////==========\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ // >>> Finds road color via bitmap. <<< \\ ///////////////////////////////////==========\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ procedure FindRoadColorBMP; var acc, angle: Extended; begin status('Finding road color via bitmap...'); RoadBMP := BitmapFromString(6, 6, 'z78DA33373573317332A70B69E668696464421F120089982FAD'); wait(100); FindDeformedBitmapToleranceRotationIn(RoadBMP,RCx,RCy,565,5,730,165,30,0,acc,PI/4,0,PI,angle); wait(100); FindColoredAreaTolerance(RCx,RCy,7040373,RCx-10,RCy-10,RCx+10,RCy+10,49,30); RoadColor:=GetColor(RCx,RCy); FreeBitmap(RoadBMP); end; ///////////////////////////////////==========\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ // >>> Finds road color via DTMs. <<< \\ ///////////////////////////////////==========\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ procedure LoadRoadColorDTM; begin RoadColorDTMAmount:=4; case RoadColorCurrentDTM of 1:RoadColorDTM := DTMFromString('78DA63CC67626070644001F111110C46409A1' + '188FF0301630E508D11448E0BAA465B8381410EAA06041813806A' + '7C51D508BAA2A96904AA094655F3F9ED7B54355D4035FAA86ADEB' + 'D7B87A20600AB930FBC'); 2:RoadColorDTM := DTMFromString('78DA632C63626030654001F111110C46409A1' + '188FF0301630E508D03448E0BAAC6D3D385410EAA060418F3816A' + '3451D5BCFAFE1D554D0D508D1DAA9A77EFDEA1AA6900AA31C2AF0' + '600B7AB128F'); 3:RoadColorDTM := DTMFromString('78DA63EC606260F0624001F5E5650C46409A1' + '188FF03016331508D15448E0BAA262DCE8A410EAA060418FB806A' + '2C51D568844BA3AA590054E34D404D17504D0CAA9AC26C0D54353' + '9403581A86ACA0B7550D4000010B70F99'); 4:RoadColorDTM := DTMFromString('78DA639CCAC4C010C68002EACBCB188C80342' + '310FF070246901A5F881C17544D769C0C831C540D08305601D544' + 'A1AA292A4453B302A82616554DA48F228A1A00645C0C73'); //X:RoadColorDTM end; end; procedure FindRoadColorDTM; begin status('Finding road color via DTM...'); RotateMinimap('N'); RoadColorCurrentDTM:=0; repeat RoadColorCurrentDTM:=RoadColorCurrentDTM+1; LoadRoadColorDTM; RoadColor:=0; if(findDTM(RoadColorDTM,RCx,RCy,560,5,730,165))and(Getcolor(RCx,RCy)>5300000)and(Getcolor(RCx,RCy)<8000000)then begin RoadColor:=GetColor(RCx,RCy); RoadColorFoundDTM:=True; end; FreeDTM(RoadColorDTM); until(RoadColorCurrentDTM=RoadColorDTMAmount)or(RoadColorFoundDTM=True); end; ///////////////////////////////////==========\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ // >>> Checks if road color has been found. <<< \\ ///////////////////////////////////==========\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ procedure RoadColorCheck; begin if(RoadColor>5300000)and(RoadColor<8000000)then begin RoadColorFound:=True; end; end; ///////////////////////////////////==========\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ // >>> Initial procedure to find road color. <<< \\ ///////////////////////////////////==========\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ procedure FindRoadColor; begin status('Finding road color...'); ActivateClient; wait(250); if(ManualRoadColor=0)then begin FindRoadColorBMP; wait(100); RoadColorCheck; wait(100); if(RoadColorFound=False)then begin FindRoadColorDTM wait(100); RoadColorCheck; wait(100); end; if(RoadColorFound=False)then begin writeln(''); writeln(' Road Color can not be found. Please run script again'); writeln(' or set manually.'); writeln(''); TerminateScript; end else begin writeln('Road color = ' + inttostr(RoadColor)); status('Road color found.'); end; end else begin RoadColor:=ManualRoadColor; Writeln(''); Writeln(' Using Manual Road Color. Set to "0" for auto detection.'); Writeln(' Manual Road Color: ' + Inttostr(RoadColor)); Writeln(''); end; end; ///////////////////////////////////==========\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ // >>> Copyright © 2005. This script is subject to copyright. <<< \\ ///////////////////////////////////==========\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\