PDA

View Full Version : Reflection Path Maker



Falorion
04-09-2015, 09:59 AM
I just started making scripts for Old School Runescape today and after seeing Turpinator's version of a path maker, I decided that making my own version would be helpful for getting familiar with pascal as well as being a useful tool for the future. I kept with with Turpinator's general flow but made some slight changes.

Instructions:

1. Go to the first point on your path
2. Make sure you have the inventory tab open
3. Start it up(It will capture your first point and then disable SMART)
4. Move on to your next point
5. Enable SMART(It will disable itself shortly after it captures the coordinates)
6. Move on to your next point and so on...
7. When you are finished, simply switch to another game tab(Give it time to fully switch) and enable SMART once more
8. Viola! There will be two separate outputs, one that displays the path with randomness and one that does not

Here's the program:

program PathMaker;

{$DEFINE SMART8}
{$I SRL-OSR/SRL.Simba}
{$I SRL-OSR/SRL/Reflection/Reflection.simba}

var
pc, CurrentTab, LevelofRandomness: Integer;
locationX, locationY, r: String;
location: TPoint;
XLocations, YLocations: Array[1..100] of String;
PathCount: Array of String;
Randomness: Boolean;

Procedure DeclarePlayers;
Begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

// Counter for the number of points
pc := 1;

// Change your level of randomness here
LevelofRandomness := 1;

// So I can be lazy and have it log in for me
Players[0].Name := '';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;
end;

Procedure getCurrentTile;
begin
location := R_GetTileGlobal;
end;

Procedure GetXCoord;
begin
locationX := IntToStr(location.x);
end;

Procedure GetYCoord;
begin
locationY := IntToStr(location.y);
end;

Procedure GetCoords;
begin
GetCurrentTile;
GetXCoord;
GetYCoord;
end;

Procedure PathToString;
var
i : integer;
RandomString, PathWithRandomness, PathWithoutRandomness: String;
begin
SetLength(PathCount, pc);

// Without Randomness
r := '';
for i := 1 to length(PathCount)-1 do
r := r + ' Point(' + XLocations[i] + ', ' + YLocations[i] + '),';
r[1] := '[';
r[length(r)] := ']';
PathWithoutRandomness := r;

// With Randomness
r := '';
RandomString := ' + RandomRange(' + IntToStr(LevelofRandomness*-1) + ', ' + IntToStr(LevelofRandomness) + ')';
for i := 1 to length(PathCount)-1 do
r := r + ' Point(' + XLocations[i] + RandomString + ', ' + YLocations[i] + RandomString + '),';
r[1] := '[';
r[length(r)] := ']';
PathWithRandomness := r;

// Outputs the paths
writeln('');
writeln('With Randomness: R_WalkPath(' + PathWithRandomness + ');');
writeln('');
writeln('Without Randomness: R_WalkPath(' + PathWithoutRandomness + ');');
writeln('');

end;

begin
SetUpSRL;
SetupReflection;
ActivateClient;
DeclarePlayers;
LoginPlayer;
repeat
repeat
wait(500);
until SmartEnabled(SmartCurrentTarget);
CurrentTab := GetCurrentTab;
if (CurrentTab = 24) then
begin
GetCoords;
XLocations[pc] := LocationX;
YLocations[pc] := LocationY;
SmartSetEnabled(SmartCurrentTarget, false);
pc := pc + 1;
end;
until (not(CurrentTab = 24));

SmartSetEnabled(SmartCurrentTarget, false);
PathToString;

end.

Here's a sample output:


With Randomness: R_WalkPath([Point(3288 + RandomRange(-1, 1), 3190 + RandomRange(-1, 1)), Point(3290 + RandomRange(-1, 1), 3185 + RandomRange(-1, 1)), Point(3298 + RandomRange(-1, 1), 3184 + RandomRange(-1, 1))]);

Without Randomness: R_WalkPath([Point(3288, 3190), Point(3290, 3185), Point(3298, 3184)]);

xujnea
05-14-2015, 10:42 PM
I'll check it out,thanks o/

dutchp0wner
05-20-2015, 03:58 PM
Second, gonna try and report back to this thread! :)