shadowrecon Posted June 3, 2013 Share Posted June 3, 2013 (edited) Requirements to use SPS for RS07: [scar] {$DEFINE RS07} {$I GMRL\SCAR_SPS.scar} [/scar] Now you have some options with how you use SMART (SMART is required to use SPS): This method only uses the SPS include: [scar] {$DEFINE RS07} {$DEFINE SMART_SPS} {$I GMRL\SCAR_SPS.scar} [/scar] This method uses OSI along side SPS: [scar] {$DEFINE OSI} {$DEFINE RS07} {$DEFINE SMART} {$I OSI\OSI.scar} {$I GMRL\SCAR_SPS.scar} [/scar] After that you need to create a map for your project: Creating a custom map can be time consuming but is well worth the effort. There are no world maps created for RS07 because the world map is not a HIGH resolution picture. Step 1: Log-in to RS07 and use the Sniping tool provided with windows to take screenshots of your mini-map as you progress to your destination, use CTRL + C to copy each mini-map piece into Paint. Step 2: Now use a image editing software to cut the mini-map from the frame and layer them over each other making sure to align fences and roads along with mini-map symbols (This is why its important to get all the images you need for a map because once you log-out everything can change shape and be distorted). Should look like this now. Step 3: Fill in all the white space with black. The map is now almost done, but as you seen in the last image all the dots were present, in this image i have went through and sampled the colors around the dots and replace the color of the dots. You could also stay up really late and wait for no one to be online to take the images. Haha. Once the map has been created, load it into path tool (One of these tools is included with SPS). When creating paths try to keep points close together, the more points you use is not going to cause any effect on the speed of SPS but instead create a more human like path as the character walks because SPS always picks the furthest point from your characters location on the mini-map. Now back to SCAR-Divi, lets setup SPS Step 1: lets review the variables user have access to control SPS [scar] {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= User defined SPS global variables - These are defined by the user. If not defined by the user then SPS defaults them. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=} var SPS_IMG_PATH: AnsiString; // This is defaulted to the SPS img/ folder SPS_Debug: Boolean; // Set this to true to debug SPS SPS_Accuracy: Integer; // Splits mini-map/areas into squares of this side length; used for area recognition SPS_AnyAngle: Boolean; // true = work at any angle; false = only north // Best if set for true on RS07 SPS_ClickNorth: Boolean; // call ClickNorth instead of MakeCompass to set the compass to north (does not apply to RS07) SPS_KeepAlive: Boolean; // Set this to true and SPS will attempts to fix its settings if unsuccessful calls were made to SPS_GetMyPos; SPS_AttemptsToKeepAlive: Integer; // The number of attempts you wish to try to keep SPS alive 2 by default [/scar] Minimal RS07 variable setup: [scar] begin SPS_IMG_PATH := ScriptPath; //Path to where the folder which contains the maps. RUNESCAPE_CUSTOM_FOLDER := 'Maps\'; // Folder name that contains the maps.. ........ [/scar] Advanced RS07 variable setup: [scar] begin SPS_IMG_PATH := ScriptPath; // Path to the folder that contains the custom maps. RUNESCAPE_CUSTOM_FOLDER := 'Maps\'; // Folder name that contains the maps. SPS_Debug := True; // Set this to true to debug SPS SPS_Accuracy := 4; // Splits mini-map/areas into squares of this side length; used for area recognition SPS_AnyAngle := True; // true = work at any angle; false = only north // Best if set for true on RS07 SPS_KeepAlive := True; // Set this to true and SPS will attempts to fix its settings if unsuccessful calls were made to SPS_GetMyPos; SPS_AttemptsToKeepAlive := 2; // The number of attempts you wish to try to keep SPS alive 2 by default ........ [/scar] Step 2: Now to actually setup SPS. Note since these are custom maps you can only use one map at a a time but SPS_setup only takes around 80ms to finish so changing surfaces/maps/images is easy. [scar] ... ..... ...... // Surface Map name SPS_Setup(RUNESCAPE_CUSTOM, ['Chickens']); // needs to be called every time you change surface ....... [/scar] Step 3: Setup character walking, using your path you created earlier. [scar] myPath := [Point(82, 442), Point(94, 440), Point(103, 440), Point(112, 430), Point(113, 417), Point(113, 409), Point(131, 406), Point(151, 408), Point(165, 408), Point(181, 408), Point(195, 408), Point(205, 384), Point(221, 377), Point(249, 377), Point(278, 378), Point(298, 370), Point(307, 356), Point(311, 337), Point(310, 315), Point(298, 297), Point(281, 268), Point(263, 250), Point(263, 207), Point(249, 195), Point(223, 165), Point(214, 137), Point(213, 118), Point(213, 103), Point(209, 91)]; if SPS_WalkPath(myPath) then Writeln('Successfully walked to chickens') else WriteLn('Failed to walk to chickens'); [/scar] Step 4: Test your script, if the character fails to walk to the proper position try changing SPS_accuracy to a lower number like 3 or if it takes to long to walk raise the number to 5 or 6 to see if the character can still accurate walk. Completed script using only SPS [scar] program WalkToChickens; {$DEFINE RS07} {$DEFINE SMART_SPS} {$I GMRL\SCAR_SPS.scar} var myPath: TPointArray; begin SPS_Debug := True; // Set this to true to debug SPS SPS_Accuracy := 4; // Splits mini-map/areas into squares of this side length; used for area recognition SPS_AnyAngle := True; // true = work at any angle; false = only north // Best if set for true on RS07 SPS_KeepAlive := True; // Set this to true and SPS will attempts to fix its settings if unsuccessful calls were made to SPS_GetMyPos; SPS_AttemptsToKeepAlive := 2; // The number of attempts you wish to try to keep SPS alive 2 by default SPS_IMG_PATH := ScriptPath; RUNESCAPE_CUSTOM_FOLDER:= 'Maps\'; if SPS_Setup(RUNESCAPE_CUSTOM, ['Chickens']) then Writeln('SPS has been setup with a custom map.'); myPath := [Point(82, 442), Point(94, 440), Point(103, 440), Point(112, 430), Point(113, 417), Point(113, 409), Point(131, 406), Point(151, 408), Point(165, 408), Point(181, 408), Point(195, 408), Point(205, 384), Point(221, 377), Point(249, 377), Point(278, 378), Point(298, 370), Point(307, 356), Point(311, 337), Point(310, 315), Point(298, 297), Point(281, 268), Point(263, 250), Point(263, 207), Point(249, 195), Point(223, 165), Point(214, 137), Point(213, 118), Point(213, 103), Point(209, 91)]; if SPS_WalkPath(myPath) then Writeln('Successfully walked to chickens') else WriteLn('Failed to walk to chickens'); end. [/scar] Completed script using OSI: [scar] program WalkToChickens; {$DEFINE OSI} {$DEFINE RS07} {$DEFINE SMART} {$I OSI\OSI.scar} {$I GMRL\SCAR_SPS.scar} var myPath: TPointArray; begin SetupOSI; SPS_Debug := True; // Set this to true to debug SPS SPS_Accuracy := 4; // Splits mini-map/areas into squares of this side length; used for area recognition SPS_AnyAngle := True; // true = work at any angle; false = only north // Best if set for true on RS07 SPS_KeepAlive := True; // Set this to true and SPS will attempts to fix its settings if unsuccessful calls were made to SPS_GetMyPos; SPS_AttemptsToKeepAlive := 2; // The number of attempts you wish to try to keep SPS alive 2 by default SPS_IMG_PATH := ScriptPath; RUNESCAPE_CUSTOM_FOLDER:= 'Maps\'; if SPS_Setup(RUNESCAPE_CUSTOM, ['Chickens']) then Writeln('SPS has been setup with a custom map.'); myPath := [Point(82, 442), Point(94, 440), Point(103, 440), Point(112, 430), Point(113, 417), Point(113, 409), Point(131, 406), Point(151, 408), Point(165, 408), Point(181, 408), Point(195, 408), Point(205, 384), Point(221, 377), Point(249, 377), Point(278, 378), Point(298, 370), Point(307, 356), Point(311, 337), Point(310, 315), Point(298, 297), Point(281, 268), Point(263, 250), Point(263, 207), Point(249, 195), Point(223, 165), Point(214, 137), Point(213, 118), Point(213, 103), Point(209, 91)]; if SPS_WalkPath(myPath) then Writeln('Successfully walked to chickens') else WriteLn('Failed to walk to chickens'); end. [/scar] Done! http://www.megafileupload.com/en/file/422978/WalkToChickens-7z.html Useful notes: * The variable "_SPS_LastKnownPos" contains the last position SPS_GetMyPos got. If you are trying to compare a location to points or what ever you can just call SPS_GetMyPos(); and the location is stored for later use globally throughout the script. Edited June 3, 2013 by shadowrecon Quote Link to comment Share on other sites More sharing options...
LordJashin Posted June 3, 2013 Share Posted June 3, 2013 Nice tutorial! Deserves a golden star! Images and everything! Quote Link to comment Share on other sites More sharing options...