SRL Archive - OSR Help

Help with my first script


GodGenesis

2012-11-17 09:41:50

Hey there and this is my first day scripting!

After looking through tutorials here, I thought about making one and this is what I got so far.


What I want the script to do is to walks from Yanille Bank to the Bar, open the door and walk back to bank and deposit the whole inventory. :) Kinda Pointless but it helps me to learn.


program YanilleWalker;
{$DEFINE SMART}
{$DEFINE SMART8}
{$i srl/srl.simba}
{$i sps/sps.simba}

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := ''; // Character Name
Pass := ''; // Character Pass
Pin := ''; // Character Pin
Nick := ''; // Character Nickname
Active := True; // Use player in script?
Member := True; // Member?
end;
end;

procedure WriteInDebugBox;
begin
Writeln('GodGenesis First Script');
end;

Var
myPath:TPointArray;

procedure WalkToBartender;
begin;
SetupSRL;
SPS_Setup(RUNESCAPE_SURFACE,['5_10']);

myPath := [Point(2284, 4297), Point(2250, 4283), Point(2227, 4277),
Point(2208, 4279), Point(2174, 4279), Point(2156, 4293), Point(2137, 4306),
Point(2108, 4311), Point(2068, 4310), Point(2057, 4329), Point(2046, 4334),
Point(2051, 4347)];
SPS_WalkPath(myPath);
end;

function OpenDoor(var fx, fy: Integer): Boolean;
var
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2: Integer;
P: TPoint;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 0.78);

if not(FindColorsTolerance(arP, 1327963, MSX1, MSY1, MSX2, MSY2, 16)) then
begin
Writeln('Failed to find the color, no object found.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
end;

procedure WalkToBank;
begin;
SetupSRL;
SPS_Setup(RUNESCAPE_SURFACE,['5_10']);

myPath := [Point(2046, 4337), Point(2062, 4321), Point(2107, 4306),
Point(2130, 4310), Point(2143, 4305), Point(2160, 4290), Point(2176, 4280),
Point(2202, 4278), Point(2243, 4283), Point(2257, 4285), Point(2279, 4297),
Point(2285, 4299)];
SPS_WalkPath(myPath);
end;

procedure OpenBankAll;

begin;
Openbank('ynb', True,True);
Deposit(1 , 28, True);
end;


begin
ClearDebug;
WriteInDebugBox;
WalkToBartender;
OpenDoor;
WalkToBank;
OpenBankAll;
end.

However, I do not understand this error that I get when running the script

"Identifier expected at line 65"
Line 65 is the procedure "WalkToBank"

Also any comments to improving this script would be so great!

Footy

2012-11-17 09:44:36

You are missing an end in function open door. :p

riwu

2012-11-17 09:45:47

You missed an end; before that line.
Your OpenDoor at main program has no argument when the function specify a parameter.

procedure WriteInDebugBox;
begin
Writeln('GodGenesis First Script');
end;
1 liner procedure, not very meaningful? ;)
Call the writeln directly.


function OpenDoor(var fx, fy: Integer): Boolean;
var
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2: Integer;
P: TPoint;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 0.78);

if not(FindColorsTolerance(arP, 1327963, MSX1, MSY1, MSX2, MSY2, 16)) then
begin
Writeln('Failed to find the color, no object found.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
end;
So you are not planning to do anything if the color is found?

GodGenesis

2012-11-17 09:45:59

From: Footy
You are missing an end in function open door. :p


Ah thanks! Missed that out. :S

GodGenesis

2012-11-17 09:50:02

From: riwu

So you are not planning to do anything if the color is found?


Of course I want to open the door. Just needa search how to do it with the mouse thing. Haven't got there yet. :D