SRL Archive - OSR Help

Line 44! (wonders yew chopnbank)


wondersueak

2010-09-19 02:59:03

I keep on getting an error at line 44 (this line):
if FindObjCustom(x, y, ['Yew'], [1259052, 3168591, 1586478], 7) then

and how do I incorporate breaking correctly?

Please let me know of any errors I missed .

complete script:

program wonderyewbanknchop;
{$DEFINE SMART}
{.include srl/srl/misc/smart.scar}
{.include srl/srl.scar}
{.include reflection/reflection.simba}
{.include srl/srl/misc/debug.scar}
{.include SRL/SRL/Skill/WoodCutting.scar}


{Setup:
1: Have Simba Set up with the latest reflection and SRL.
2: Make sure you have the required plugins.
3: Download this script.
4: Fill Out This Script.
5: Put your player next to/on the same tile as the yew tree.
6: Press the play button.}

const
World = 78;
Signed = True;
Members = True;

SRLStats_UserID = '';
SRLStats_Password = '';

BreakMins = 12; // How long the break should last

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

Players[0].Name := 'Username';
Players[0].Pass := 'Password';
Players[0].Nick := 'ame';
Players[0].Active := True;

end; {END SETUP. DO NOT CHANGE ANYTHING BELOW THIS!}



Procedure ChopTree;
begin
MakeCompass('S');
repeat
if FindObjCustom (x, y, ['Yew'], [1259052, 3168591, 1586478], 7) then
begin
Mouse(x,y,0,0,false);
repeat
Wait(100 + (random(150)));
ChooseOption('hop')
until(InvFull)
end;
until(InvFull)
end;



function Banking: Boolean;
begin
if (InvFull) then
begin
MakeCompass('N')
Wait (300 + random(160));
OpenBankQuiet('db');
if (PinScreen) then
InPin(YourPin);
if(FindColorSpiral(x, y, 669516, 547, 206, 734, 464))then
begin
Mouse(x, y, 4, 3, false);
ChooseOption('All');
end;
CloseBank;
Wait(150 + random (278));
MakeCompass('S');
end;
end;

Function AntiBan: Boolean;
begin
case Random(20) of // how often to perform, higher number less often
0: begin
BoredHuman;
end;

1: begin
RandomMovement;
end;

2: begin
HoverSkill('Woodcutting', false);
end;

3: begin
HoverSkill('Summoning', false);

4: begin
AlmostLogout;

5: begin
BoredHuman;

6: begin
HoverSkill('Smithing', false);
End;
End;

function CheckHatchet: Boolean;
var
Item: TInvItem;
Equiped: TEquipment;
begin

for j:= 0 to 27 do
begin
Item:= GetInvItemAt(j);
for i:= 8 downto 0 do
if (Item.ID = Hatchets[i]) then
begin
Writeln('Found a'+HatchetNames[i]+' in backpack');
Result:= True;
Exit;
end else
if (j = 27) then
Writeln('Could not find a '+HatchetNames[i]+' in backpack');
end;
Equiped:= GetEquippedItemAt(3);
for i:= 8 downto 0 do
if (Equiped.id = Hatchets[i]) then
begin
Writeln('Found '+HatchetNames[i]+' in hand');
Result:= True;
Exit;
end else
Writeln('Could not find a'+HatchetNames[i]+' in hand');
Writeln('You do not have a hatchet either in your backpack or weilded');
Logout;
ChangePlayer(False);
end;


procedure DoBreak;
var
BreakTime, T: Integer;
begin
if Debug then
Writeln('Starting the Break');
if (TimeFromMark(TimeSinceLastBreak) > (Players[CurrentPlayer].Integers[3]*60*1000)) then
if (PlayersActive > 1) then
ChangePlayer(True)
else
begin
Proggy(False);
BreakTime:= ((BreakMins*60*1000)+Random(5*60*1000));
ExitToLobby;
MarkTime(T);
repeat
Wait(1000);
until(TimeFromMark(T)>BreakTime);
LoginPlayer;
MarkTime(TimeSinceLastBreak);
end;
if Debug then
Writeln('Finished the Break');
end;

procedure ProgressReport(MainLoop: Boolean);
var
TempExp, TempLvl, Player: Integer;
begin
if (x=100)or(not(MainLoop)) then
begin
Me:= GetMe;
TempExp:= Me.Experience[Skill_WoodCutting];
TempLvl:= Me.Levels[Skill_WoodCutting];
ClearDebug;
if Debug then
Writeln(TempExp);
if Debug then
Writeln(TempLvl);
Writeln('Wonders Yew Chop N Bank Progress Report');
Writeln('+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_');
Writeln('Ran for: '+ TimeRunning);
Writeln('+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_');
for Player:=0 to High(Players) do
begin
Writeln('Player: '+Players[Player].Nick);
Writeln('Woodcutting Level: '+IntToStr(Players[Player].Integers[1]));
Writeln('Experience Gained: '+IntToStr(TempExp-Players[Player].Integers[0]));
Writeln('Levels Gained: '+IntToStr(TempLvl-Players[Player].Integers[1]));
Writeln('Logs chopped: '+IntToStr((TempExp-Players[Player].Integers[0])/332));
Writeln('+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_');
Writeln('Location: '+ Players[Player].Strings[0]);
Writeln('+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_');
end;
x:=0;
end else
x:= x + 1;
end;

Function AntiRandom: Boolean;
Begin
If Not LoggedIn Then Exit;
Case Lowercase(AntiRandomz) Of
'c':
Begin
Result := FindNormalRandoms;
If Not Result Then Result := R_FindRandoms;
FindNormalRandoms;
End;
'r':
Begin
Result := R_FindRandoms;
If Not Result Then Result := FindNormalRandoms;
R_FindRandoms;
End;
End;
End;

Procedure MainLoop;
SetupSRL;
repeat
ChopTree;
Banking;
until(false)
end.

TomTuff

2010-09-19 03:07:55

declary x and y as integer variables by adding the following lines before the begin/end; loop:

var
x, y: integer;

wondersueak

2010-09-19 03:13:54

Okay. Thanks!

now i get error at line 71:
InPin(YourPin);

how do I add breaks correctly? whenever i try it spits out an error.

BraK

2010-09-19 04:24:53

Change that line to:
InPIN(players[currentplayer].Pin);
and add a line to DeclarePlayers
 Players[0].Pin := ''; 
to the list

Rich

2010-09-19 05:53:44

I'm sure that there will be a guide on taking breaks in Tutorial Island somewhere. Have a look there. If nothing turns up, perhaps look for guides on incorporating multiplayer, as the two topics are quite closely linked.

wondersueak

2010-09-19 14:57:12

Thanks!

Er… Now I get an error at line 43:
var x ,y:interger;

I'm about ready to call it quits and let someone with skillz do the scripting =P

HyperSecret

2010-09-19 15:32:17

interger is integer, no r

wondersueak

2010-09-19 18:26:48

Ah, sorry, typo.