SRL Archive - OSR Help

[Error] (17:1): Identifier expected at line 16 (Trying to find Nature Runes)


TkrZ

2012-01-05 08:59:34

I'm trying to make a procedure that finds Nature Runes in the inventory, can anyone help me please?


Procedure ItemCheck;
var x, y: integer;
begin
GameTab(Tab_Inv)
If FindObjCustom(x, y, ['ure', 'Rune', 'Natu'], [1276176, 8355717, 8684682], 5) Then
WriteLn('Nature runes found');
Else
WriteLn('Nature runes not found');
end;

But when I compile, I get this error:

[Error] (17:1): Identifier expected at line 16
Compiling failed.

Any help would be much appreciated! (Hey, I might even be using the shittiest method to find nature runes, I don't know ;P)


Robot

Jhangir

2012-01-05 09:23:17

GameTab(Tab_Inv) needs a semicolon after it I beleive. Also check if your missing any other semicolons or begins and ends.

Also try to use a DTM instead of the color function. DTM is more accurate. You can also use a bitmap too.

Kyle Undefined

2012-01-05 09:24:03

Try this:


Procedure ItemCheck;
var x, y: integer;
begin
GameTab(Tab_Inv);
If FindObjCustom(x, y, ['ure', 'Rune', 'Natu'], [1276176, 8355717, 8684682], 5) Then
WriteLn('Nature runes found')
Else
WriteLn('Nature runes not found');
end;

Shuttleu

2012-01-05 09:25:25

From: IRobot335
I'm trying to make a procedure that finds Nature Runes in the inventory, can anyone help me please?


Procedure ItemCheck;
var x, y: integer;
begin
GameTab(Tab_Inv)
If FindObjCustom(x, y, ['ure', 'Rune', 'Natu'], [1276176, 8355717, 8684682], 5) Then
WriteLn('Nature runes found');
Else
WriteLn('Nature runes not found');
end;

But when I compile, I get this error:

[Error] (17:1): Identifier expected at line 16
Compiling failed.

Any help would be much appreciated! (Hey, I might even be using the shittiest method to find nature runes, I don't know ;P)


Robot

if you have a else on the next line, do not put a semi colon on the line above

~shut

TkrZ

2012-01-05 09:27:33

Procedure ItemCheck;
var x, y: integer;
begin
GameTab(Tab_Inv);
If FindObjCustom(x, y, ['ure', 'Rune', 'Natu'], [1276176, 8355717, 8684682], 5) Then
WriteLn('Nature runes found')
Else
WriteLn('Nature runes not found');
end;

Still getting

[Error] (17:1): Identifier expected at line 16
Compiling failed.

:(

Shuttleu

2012-01-05 09:44:23

which line is 16?

~shut

Kyle Undefined

2012-01-05 11:21:59

That's not the issue, this compiles fine. The error is somewhere else.


program new;
{$i srl/srl.scar}

Procedure ItemCheck;
var x, y: integer;
begin
GameTab(Tab_Inv);
If FindObjCustom(x, y, ['ure', 'Rune', 'Natu'], [1276176, 8355717, 8684682], 5) Then
WriteLn('Nature runes found')
Else
WriteLn('Nature runes not found');
end;

begin
setupsrl;
itemcheck;
end.

TkrZ

2012-01-05 11:40:36

program asdf;
{$i srl/srl/misc/Smart.scar}
{$i srl/srl.scar}

procedure DeclarePlayers;
begin
With Players[0] do
begin
Name := ''; //Login Username
Pass := ''; //Login Password
Nick := '';
Active := true; //Leave this for now
Pin := ''; //Pin for bank
end;

Procedure ItemCheck;
var x, y: integer;
begin
GameTab(Tab_Inv);
If FindObjCustom(x, y, ['ure', 'Rune', 'Natu'], [1276176, 8355717, 8684682], 5) Then
WriteLn('Nature runes found')
Else
WriteLn('Nature runes not found');
end;
begin
SetupSRL;
DeclarePlayers;
LoginPlayer;
ItemCheck;
end

This is the entire thing so far.

Kyle Undefined

2012-01-05 11:57:04

Your last "end" is missing the "." Also, your "begin" is missing and "end;" in the DeclarePlayers.

Methrend

2012-01-05 12:24:34

This should work (For what was wrong, check Kyle's post above):

program asdf;
{$i srl/srl/misc/Smart.scar}
{$i srl/srl.scar}

procedure DeclarePlayers;
begin
With Players[0] do
begin
Name := ''; //Login Username
Pass := ''; //Login Password
Nick := '';
Active := true; //Leave this for now
Pin := ''; //Pin for bank
end;
end;

Procedure ItemCheck;
var x, y: integer;
begin
GameTab(Tab_Inv);
If FindObjCustom(x, y, ['ure', 'Rune', 'Natu'], [1276176, 8355717, 8684682], 5) Then
WriteLn('Nature runes found')
Else
WriteLn('Nature runes not found');
end;
begin
SetupSRL;
DeclarePlayers;
LoginPlayer;
ItemCheck;
end.

TkrZ

2012-01-05 13:00:56

Wahey! I finally got it to work, and I decided to use a DTM instead, also, how do you make it print "Nature runes found", and click the nature runes at the same time, because when I put both of them in, an error of some sort happens

program asdf;
{$i srl/srl.scar}

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

Players[0].Name := ''; // Username
Players[0].Pass := ''; // Password
Players[0].Nick := ''; // 3-4 lowercase letters from username
Players[0].Active := True; // Set to true if you want to use Player 0
Players[0].Pin := ''; // Leave blank if the player doesn't have a bank pin
end;

Procedure ItemCheck;
var
x, y, NatureRune, I:Integer;
begin
NatureRune := DTMFromString('mbQAAAHicY2VgYBBkYWBQAGJxIOYAYhYgzmFkYMgG4logrmKE8AVrhYGqGdEwJkBXAVcFAADSA1c=');
If FindDTM(NatureRune,x,y,550,210,730,460) Then
Mouse(x,y,5,5,True)// Here
WriteLN('Nature runes found')// Here
Else
WriteLn('Nature runes not found');
FreeDTM(NatureRune);
end;
begin
SetupSRL;
DeclarePlayers;
LoginPlayer;
ItemCheck;
end.

Shuttleu

2012-01-05 13:10:08

use begin and ends
program asdf;
{$i srl/srl.scar}

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

Players[0].Name := ''; // Username
Players[0].Pass := ''; // Password
Players[0].Nick := ''; // 3-4 lowercase letters from username
Players[0].Active := True; // Set to true if you want to use Player 0
Players[0].Pin := ''; // Leave blank if the player doesn't have a bank pin
end;

Procedure ItemCheck;
var
x, y, NatureRune, I:Integer;
begin
NatureRune := DTMFromString('mbQAAAHicY2VgYBBkYWBQAGJxIOYAYhYgzmFkYMgG4logrmKE8AVrhYGqGdEwJkBXAVcFAADSA1c=');
If FindDTM(NatureRune,x,y,550,210,730,460) Then
begin
Mouse(x,y,5,5,True);// Here
WriteLN('Nature runes found');// Here
end else
WriteLn('Nature runes not found');
FreeDTM(NatureRune);
end;
begin
SetupSRL;
DeclarePlayers;
LoginPlayer;
ItemCheck;
end.

~shut

TkrZ

2012-01-05 13:20:27

Thanks :D