SRL Archive - OSR Help

Where does my error come from?


Troll

2010-12-24 13:31:42

First of i want to say thanks as you guys have been very helpful and most my posts seems to be here asking for help.

Well im getting Invalid number of parameters and proberly a number of other errors as i get to the end of my first scirpt, its only a small 175 line scirpt.


program new;
//{$DEFINE SMART}
{$i srl\srl.scar}
//{$i reflection\reflection.simba}

procedure DeclarePlayers;
begin
HowManyPlayers := 1;//Change this accordingly
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

With Players[0] do
begin
Name :=''; //Name
Pass :=''; //Pass
Active := True; //True if you want this player to be used
Integers[0] := 0;//Time To run before breaking
end;

{
With Players[1] do //copy and change number accordingly to add players
begin
Name :='';
Pass :='';
Active:=True;
Booleans[0] := false;//Are you ranging?
Integers[0] := 0;//1st color of monster
Integers[1] := 0;//2nd color of monster
Integers[2] := 0;//3rd color of monster
Strings[0] := '';//monster name
end;
}
end;

Procedure MyWait(TimeToWait:Integer);
Var Time:Integer;
Begin
MarkTime(Time);
FindNormalRandoms;
Repeat
Case Random(5000) Of
1: RandomRClick;
2: HoverSkill('attack',False);
3: HoverSkill('defence',False);
4: HoverSkill('strength',False);
5: HoverSkill('hitpoints',False);
6: PickUpMouse;
7: RandomMovement;
8: BoredHuman;
9: LevelUp;
End;
Until(TimeFromMark(Time)>=TimeToWait)
End;

Function FindChicken:Boolean;
Var x,y,i,tol:Integer;
Begin
I := 0
tol := 41
If Not LoggedIn Then Exit;
If srl_InFight Then Exit;
Repeat
If FindColorSpiralTolerance(x,y,3655910,MSX1,MSY1,MSX2,MSY2,41) Then
Begin
MMouse(x,y,2,2);
MyWait(Random(50));
writeln('Moving Mouse');
If IsUpText('ick') Then
Begin
GetMousePos(x,y);
writeln('Getting mouse pos');
MyWait(Random(100));
If Random(20) = 1 Then
Begin
MyWait(Random(10));
Mouse(x,y,0,0,True);
writeln('Clicking');
Result := True;
Break;
End Else Begin
Mouse(x,y,0,0,False);
ChooseOption('ttac');
writeln('Right clicking');
Result := True;
Break;
End;
End Else Begin
writeln('Couldnt not find uptext');
Inc(I);
End;
End Else Begin
writeln('Did not find colour');
Inc(I);
Inc(Tol);
End;
Until(I>20)
If I > 20 Then
Begin
writeln('Could not find chicken');
Exit;
End;
End;

Function FindLoot:Boolean;
Var x,y:Integer;
Begin

If Not LoggedIn Then Exit;
If IsMoving Then Exit;
SetColorToleranceSpeed(2);
SetColorspeed2Modifiers(0.10,0.89);
If IsMoving Then
Mywait(RandomRange(1000,2000));
If FindColorSpiralTolerance(x,y,10921922,MSX1,MSY1,MSX2,MSY2,6) Then
Begin
MMouse(x,y,3,3);
If WaitUptext('ake',RandomRange(250,650)) Then
Begin
GetMousePos(X,Y);
Mouse(x,y,0,0,False);
If ChooseOption('eathe') Then
writeln('Found feathers');
MyWait(RandomRange(400,950));
End;
End Else writeln('Not found colour, this is normaly as im loop it at least 4 times to check we have everything :)');
End;

Procedure MainLoop;
Var I,Time:Integer;
Begin
Repeat
Time := 0
MarkTime(Time);
LogInPlayer;
Repeat
If FindChicken Then
Begin
I := 0
MyWait(RandomRange(750,2200));
While srl_InFight Do
MyWait(Random(250));
FindLoot;
End Else Inc(I);
Until((I > 50) Or Not LoggedIn Or (TimeFromMark > CurrentPlayer.Integer[0]))
If I > 50 Then
Begin
writeln('Could not find monsters : Player now inactive');
If LoggedIn Then
Logout;
NextPlayer(False);
End;
If Not LoggedIn Then
Begin
writeln('Not Logged in : Player now inactive');
NextPlayer(False);
End;
If (TimeFromMark > CurrentPlayer.Integer[0]) Then
Begin
If Not HowManyPlayers = 1 Then
Begin
writeln('Only one player breaking for time you set');
Logout;
NextPlayer(True);
Wait(CurrentPlayer.Integer[1]);
End Else Begin
writeln('More then one player moving onto next player');
Logout;
NextPlayer(True);
End;
Until(AllPlayersInactive);
End;

begin
SetupSRL;
end.

Thanks :D

TomTuff

2010-12-24 13:39:10

Line 144, TimeFromMark has a parameter.

**BANNED The Man

2010-12-24 13:41:44

Until (I > 50) or (Not LoggedIn) or (TimeFromMark(Time) > Players[CurrentPlayer].Integers[0])
You have to set what Mark to check the time from.
Also, I think you have to do:
Players[CurrentPlayer].Integers[0]
instead of the way you did.

Ninja'd -.-

-Boom

Troll

2010-12-24 14:20:46

Ok, thanks. How could i miss that :p

Thanks again

Edit:
Also
Identifier expected at line 170
Which is
Until(AllPlayersInactive)

Thanks again

**BANNED The Man

2010-12-24 14:36:14

program new;
//{$DEFINE SMART}
{$i srl\srl.scar}
//{$i reflection\reflection.simba}

procedure DeclarePlayers;
begin
HowManyPlayers := 1;//Change this accordingly
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

With Players[0] do
begin
Name :=''; //Name
Pass :=''; //Pass
Active := True; //True if you want this player to be used
Integers[0] := 0;//Time To run before breaking
end;

{
With Players[1] do //copy and change number accordingly to add players
begin
Name :='';
Pass :='';
Active:=True;
Booleans[0] := false;//Are you ranging?
Integers[0] := 0;//1st color of monster
Integers[1] := 0;//2nd color of monster
Integers[2] := 0;//3rd color of monster
Strings[0] := '';//monster name
end;
}
end;

Procedure MyWait(TimeToWait:Integer);
Var Time:Integer;
Begin
MarkTime(Time);
FindNormalRandoms;
Repeat
Case Random(5000) Of
1: RandomRClick;
2: HoverSkill('attack',False);
3: HoverSkill('defence',False);
4: HoverSkill('strength',False);
5: HoverSkill('hitpoints',False);
6: PickUpMouse;
7: RandomMovement;
8: BoredHuman;
9: LevelUp;
End;
Until(TimeFromMark(Time)>=TimeToWait)
End;

Function FindChicken:Boolean;
Var x,y,i,tol:Integer;
Begin
I := 0
tol := 41
If Not LoggedIn Then Exit;
If srl_InFight Then Exit;
Repeat
If FindColorSpiralTolerance(x,y,3655910,MSX1,MSY1,MSX2,MSY2,41) Then
Begin
MMouse(x,y,2,2);
MyWait(Random(50));
writeln('Moving Mouse');
If IsUpText('ick') Then
Begin
GetMousePos(x,y);
writeln('Getting mouse pos');
MyWait(Random(100));
If Random(20) = 1 Then
Begin
MyWait(Random(10));
Mouse(x,y,0,0,True);
writeln('Clicking');
Result := True;
Break;
End Else Begin
Mouse(x,y,0,0,False);
ChooseOption('ttac');
writeln('Right clicking');
Result := True;
Break;
End;
End Else Begin
writeln('Couldnt not find uptext');
Inc(I);
End;
End Else Begin
writeln('Did not find colour');
Inc(I);
Inc(Tol);
End;
Until(I>20)
If I > 20 Then
Begin
writeln('Could not find chicken');
Exit;
End;
End;

Function FindLoot:Boolean;
Var x,y:Integer;
Begin

If Not LoggedIn Then Exit;
If IsMoving Then Exit;
SetColorToleranceSpeed(2);
SetColorspeed2Modifiers(0.10,0.89);
If IsMoving Then
Mywait(RandomRange(1000,2000));
If FindColorSpiralTolerance(x,y,10921922,MSX1,MSY1,MSX2,MSY2,6) Then
Begin
MMouse(x,y,3,3);
If WaitUptext('ake',RandomRange(250,650)) Then
Begin
GetMousePos(X,Y);
Mouse(x,y,0,0,False);
If ChooseOption('eathe') Then
writeln('Found feathers');
MyWait(RandomRange(400,950));
End;
End Else writeln('Not found colour, this is normaly as im loop it at least 4 times to check we have everything :)');
End;

Procedure MainLoop;
Var I,Time:Integer;
Begin
Repeat
Time := 0
MarkTime(Time);
LogInPlayer;
Repeat
If FindChicken Then
Begin
I := 0
MyWait(RandomRange(750,2200));
While srl_InFight Do
MyWait(Random(250));
FindLoot;
End Else Inc(I);
Until (I > 50) or (Not LoggedIn) or (TimeFromMark(Time) > Players[CurrentPlayer].Integers[0])
If I > 50 Then
Begin
writeln('Could not find monsters : Player now inactive');
If LoggedIn Then
Logout;
NextPlayer(False);
End;
If Not LoggedIn Then
Begin
writeln('Not Logged in : Player now inactive');
NextPlayer(False);
End;
If (TimeFromMark(Time) > Players[CurrentPlayer].Integers[0]) Then
Begin
If Not HowManyPlayers = 1 Then
Begin
writeln('Only one player breaking for time you set');
Logout;
NextPlayer(True);
Wait(Players[CurrentPlayer].Integers[1]);
End Else
Begin
writeln('More then one player moving onto next player');
Logout;
NextPlayer(True);
End;
End;
Until(AllPlayersInactive);
End;

begin
SetupSRL;
end.
You needed an extra end :)
^ That compiles successfully

-Boom

Death12652

2010-12-24 14:39:04

before you submit this script you should learn about Standards. You can check them out here.

http://villavu.com/forum/showthread.php?t=60288

A lot of people would appreciate it and give you more feedback.

Troll

2010-12-24 14:52:59

Thanks Dynamite your the best :D and ill try to keep that in mind thanks death

Dang, i feel like a idiot with all these errors :( but when i run what Dynamite posted i get this in Login.scar or is it .simba

[Hint] C:\Simba\Includes\SRL/SRL/core/gametab.scar(1514:3): Variable 'P' never used at line 1513
[Hint] (105:10): Variable 'Result' never used at line 104
Compiled succesfully in 889 ms.
SRL Compiled in 0 msec
1
2
4
Error: Out Of Range at line 395
The following DTMs were not freed: [SRL - Lamp bitmap]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap]
File[C:\Simba\Includes\SRL/logs/SRL log 24-12-10 0.txt] has not been freed in the script, freeing it now.

Thanks for all your help

~The idiot :p

TomTuff

2010-12-24 15:56:38

The hints don't matter. As for the out of range, maybe you didn't have user/pass filled in? Or you don't have Active set to true.

Death12652

2010-12-24 17:48:50

Thats weird it ran for me.

Shuttleu

2010-12-24 17:56:46

just a small note, i prefer if you were to post threads asking for help than not posting at all
it shows that your trying to learn :)

~shut

Troll

2010-12-24 17:57:13

It compiles, but it you call the main loop you get the error :(

Also thanks Shuttleu :)