SRL Archive - Help and Support

Not working??


[S]paz

2008-03-10 03:46:23

ok this is now very annoying, i made this simpley cos i was bored but its turned into something else as its rele starting to annoy me. Despite have activeleft procedure it still executes and terminates the script

program powerzchopperz;

{.include srl/srl/misc/smart.scar}
{.include srl/srl.scar}
{.include srl/srl/skill/woodcutting.scar}

var
x, y, active, stats, TreeDDTM, axe : integer;
chopped, loads, totchopped, totloads : integer;
q, smart, log : integer;

const
NumOfPlayers = 3; // Number of users.
tree = 2122071;
tree1 = 3367516;
YourSRLId = '';
YourSRLpass = '';

Procedure DeclarePlayers;
Begin
HowManyPlayers := NumOfPlayers;
NumberOfPlayers( HowManyPlayers );
CurrentPlayer := 2;

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

Players[1].Name :='';
Players[1].Pass :='';
Players[1].Nick :='';
Players[1].Active:=True;

Players[2].Name :='';
Players[2].Pass :='';
Players[2].Nick :='';
Players[2].Active:=True;

{ Players[3].Name :='';
Players[3].Pass :='';
Players[3].Nick :='';
Players[3].Active:=false;

Players[4].Name :='';
Players[4].Pass :='';
Players[4].Nick :='';
Players[4].Active:=false;

Players[5].Name :='';
Players[5].Pass :='';
Players[5].Nick :='';
Players[5].Active:=false; }

Writeln( IntToStr ( HowManyPlayers ) + ' Player[s]' );
End;

Procedure sendstats;
begin
SRLRandomsReport;
end;

procedure WhereTreeDDTM;
var
TreeMP: TDTMPointDef;
TreeSP: Array [0..4] of TDTMPointDef;
TreeSkel: TDTM;
begin
TreeMP.x := 883;
TreeMP.y := 332;
TreeMP.AreaSize := 1;
TreeMP.AreaShape := 0;
TreeMP.Color := 1135423;
TreeMP.Tolerance := 225;

TreeSP[0].x := 883;
TreeSP[0].y := 332;
TreeSP[0].AreaSize := 1;
TreeSP[0].AreaShape := 0;
TreeSP[0].Color := 1135423;
TreeSP[0].Tolerance := 225;

TreeSP[1].x := 889;
TreeSP[1].y := 326;
TreeSP[1].AreaSize := 1;
TreeSP[1].AreaShape := 0;
TreeSP[1].Color := 993368;
TreeSP[1].Tolerance := 10;

TreeSP[2].x := 876;
TreeSP[2].y := 327;
TreeSP[2].AreaSize := 1;
TreeSP[2].AreaShape := 0;
TreeSP[2].Color := 993368;
TreeSP[2].Tolerance := 10;

TreeSP[3].x := 870;
TreeSP[3].y := 336;
TreeSP[3].AreaSize := 2;
TreeSP[3].AreaShape := 0;
TreeSP[3].Color := 993368;
TreeSP[3].Tolerance := 10;

TreeSP[4].x := 882;
TreeSP[4].y := 346;
TreeSP[4].AreaSize := 1;
TreeSP[4].AreaShape := 0;
TreeSP[4].Color := 993368;
TreeSP[4].Tolerance := 10;

TreeSkel.MainPoint := TreeMP;
TreeSkel.SubPoints := TreeSP;
TreeDDTM := AddDTM(TreeSkel);
end;


function Checkifneartrees : boolean;
begin
If DTMRotated(TreeDDTM, x, y, mmx1, mmy1, mmx2, mmy2) then
result := true;
end;

procedure report;
var
i:integer;
begin
cleardebug;
for i:=0 to howmanyplayers-1 do
begin
writeln(inttostr(i)+': '+players[i].nick+' | '+left(booltostr(players[i].active),1)+' | '+inttostr(chopped)+' chopped | '+inttostr(loads)+' loads done');
end;
writeln('|||||||||||||||||||||||||||||||||||||||||||||');
writeln('\powerzchoperz');
writeln('\started at '+inttostr(q)+'');
writeln('\ran for '+TimeRunning);
writeln('\chnopped '+inttostr(totchopped)+' logs');
writeln('\loads done '+inttostr(totloads)+'');
writeln('//////////////////////////////////////////////');
end;

procedure minirep;
begin
case random(3) of
0: disguise('done '+inttostr(loads)+' loads');
1: disguise('chopped '+inttostr(chopped)+' logs');
2: disguise(+inttostr(active)+' active left');
end;
end;

procedure Findmyrandoms;
begin
sendstats;
FindNormalRandoms;
ftwait(2);
Findtalk;
FindLamp('Woodcutting');
end;

procedure choptrees;
var
gx, gy : integer;
begin
if not (loggedin) then exit;
repeat
If FindObjCustom(x, y, ['hop', 'ree', 'tree'], [tree, tree1], 4) then
mmouse(x, y, 1, 1);
If IsUptext('ree') then
getmousepos(gx, gy);
begin
Findmyrandoms;
FindEnt(x, y, true);
Mouse(x, y, 3, 3, false);
chooseoption('hop');
repeat
Findmyrandoms;
FTwait(4);
until FindBlackChatMessage('You get some');
minirep;
end;
until (invfull);
ReportVars[0] := ReportVars[0] + 28; //logs cut
sendstats;
end;

procedure dropthem;
var
i: Integer;
begin
if not (LoggedIn) then Exit;
GameTab(4);
for i := 1 to 28 do
begin
if ExistsItem(i) then
DropItem(i);
end;
minirep;
ReportVars[1] := ReportVars[1] + 1; //loads done
begin
writeln('done reporting');
Findmyrandoms;
sendstats;
end;
end;

procedure ActiveLeft;
var
i: Integer;
begin
active := 0;
for I := 0 To HowManyPlayers - 1 do
begin
if (Players[i].active = True) then active := active + 1;
If (Active = 0) then
begin
WriteLn('All Players done :)');
exit;
end;
If (Active > 0) then
WriteLn('' + IntToStr(Active) + ' Players Remaining.');
end;
end;

procedure setup;
begin
SetupSRL;
DeclarePlayers;
Activateclient;
LoginPlayer;
ScriptID:='710'
SRLID := YourSRLId;
SRLPassword := YourSRLPass;
if (SRLID = '') or (SRLPassword = '') then
begin
ClearDebug;
Writeln('SRL Stats ID not found. Please register.');
Wait(1000);
Writeln('Loading registration page...');
Wait(1000);
OpenWebPage('http://stats.srl-forums.com/index.php?action=register');
TerminateScript;
end;
q:=GetSystemTime;
SetAngle(True);
WheretreeDDTM;
FindAxe;
end;

Procedure Initialisation;
begin
repeat
cleardebug;
Writeln('SMART initialising please wait');
wait(500);
cleardebug;
Writeln('SMART initialising please wait.');
wait(500);
cleardebug;
Writeln('SMART initialising please wait..');
wait(500);
cleardebug;
Writeln('SMART initialising please wait...');
wait(500);
smart := smart + 1
until (smart > 5)
end;

begin
Initialisation;
setup;
{Marktime(log);}
repeat
repeat
choptrees;
until (invfull) or {(TimefromMark(log) > 900000)}
if (InvFull) then
chopped:=chopped + 27;
loads:=loads + 1;
totchopped:=totchopped + 27;
totloads:=totloads + 1;
dropthem;
report;
{if (TimefromMark(log) > 900000) then
Nextplayer(true);
writeln('Preventing randoms');}
until (Active < 1);
end.

so even tho the time form mark is not 900000 it will still log out then terminate script…. why??

another thing is that the stats dont get sent. All i get sent was the time is chopped for, but the vars dont

any suggestions

~Spaz

Timer

2008-03-10 06:57:40

No Idea. Maybe its because you can only send stats every 5 Mins? And Every Time You Call SRLRandomsReport; or SendSRLReport; It Clears The Vars, But MIGHT NOT Be Sent To Server Due To The 5 Min Thing… =/ Add A TimeMark For About 6 Mins In There For Each Random Report.. Try That?

Naum

2008-03-10 09:56:01

Until (active < 1 )
shouldn't that be
Until (active >1)

[S]paz

2008-03-10 12:17:45

@ Nauman, well no cos if it repeats until active is bigger than 1 then it wouldnt run? cos it starts as active being over one anyways lol

@ timer, ok ill try that and see what i get

~Spaz

FrÕzÑ_§ÕµL

2008-03-10 13:47:44

 if (InvFull) then
chopped:=chopped + 27;
loads:=loads + 1;
totchopped:=totchopped + 27;
totloads:=totloads + 1;
dropthem;
report;
{if (TimefromMark(log) > 900000) then
Nextplayer(true);
writeln('Preventing randoms');}

Needing Begins?

[S]paz

2008-03-10 14:10:36

LOL thanks fr0zn :P lol im a bit dumb….. :P

~Spaz

ShowerThoughts

2008-03-10 14:14:21

haha lol! looks nice S paz!

[S]paz

2008-03-10 14:19:08

lol thanks hermpie :P but ive had a brainwave and i thought i should ask if its been done before,

is there a way of keeping a char ion a set area. to make it easier to explain say i made a dtm of some rocks
is it possible / has it been done, that if not findrocksddtm then move back to where it was…. so it would always stay within a set area (where it can see the rocks?) just an idea, would help with a powerchopper since trees lead them astray :P

~Spaz

ShowerThoughts

2008-03-10 14:25:09

you could do

if not find rock then find dtm place if not then nextplayer(false)

Cazax

2008-03-10 16:51:23

Also you are doing this:
 ReportVars[0] := ReportVars[0] + 28;  //logs cut
what if you get an inventory random ;)?
 ReportVars[0] := CountItemsDtm('inv', Log);  //if you use dtms.
ReportVars[0] := CountItemsBmp('inv', Log, Tolerance); //if you are using a bmp.
ReportVars[0] := CountItemsColor('inv', Color, Tolerance) ; //if you just want to use a color :p

[S]paz

2008-03-10 17:55:45

good point, never thought of that. LOL all this effort for something simple like a power chopper… LOL

i found my script executing problem but i cant find the solution
procedure ActiveLeft;  
var
I : Integer;
begin
for I := 0 To HowManyPlayers - 1 do
begin
if (Players[i].active = True) then inc(Active);
end;
If (Active = 0) then
begin
WriteLn('All Players done :)');
exit;
end;
WriteLn('' + IntToStr(Active) + ' Players Remaining.');
end;

that should give me the number of active peeps there are and in my mainloop i had until (active = 0); but the active counting wont work right, returns 0 every time … why>????

~Spaz