SRL Archive - OSR Help

Not Clicking


King

2012-07-08 15:46:56

program KingsDragons;
{$DEFINE SMART}
{$i SRL/srl.simba}
{$i SRL/SRL/skill/fighting.simba}
{$i SRL/SRL/skill/magic.simba}
{$i sps/sps.simba}

var
x, y, T, DTMHouse: integer;




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

With Players[0] Do
Begin
Name := ''; //Player username.
Pass := ''; //Player password.
Nick := ''; //Player nickname - 3-4 letters of Player username.
Active := True;
end;

end;

procedure LoadDTMs;
begin

DTMHouse := DTMFromString('mWAAAAHicY2FgYLBhYmBwAGJnILYA4idAsZdA/AiI3wCxnoYBgwSrPEN32zGGrMgDDPxAMWTMiIZBAADlWQj7');

end;

procedure ReleaseDTMS;
begin
FreeDTM(DTMHouse);
end;

function TeleportToEdge:Boolean;
begin
writeln('Could not find bank, teleporting to Edgeville and walking to bank');
wait(500+random(50));
GameTab(tab_Magic);
wait(1000+random(50));
if FindDTM(DTMHouse, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
Mouse(x, y, 0, 0, True);
end else
begin
writeln('Could not find spell');
end;
end;

function AtBank:Boolean;
begin
if FindSymbol(x, y, Symbol_Furnace) then
begin
Result:= True;
writeln('Found the bank');
end else
begin
Result:= False;
writeln('We could not find the bank');
end;
end;


function WalkToBank:Boolean;
begin
wait(250 + random(50));
if TeleportToEdge then
if not AtBank then
begin
MarkTime(T);
repeat
wait(50);
until(AtBank or (TimeFromMark(T)>= 120000));
end else
begin
TerminateScript;
end;
end;


procedure MainLoop;
begin
if AtBank then
begin
// Banking;
end else
begin
WalkToBank;
end;
end;
procedure SetupChar;

begin
SetupSRL();
SetupMagic();
SetAngle(0);
ClickNorth(0);
end;


procedure Startup;
begin
Smart_Server := 10;
Smart_Members:= true;
Smart_Signed := true;
Smart_SuperDetail := false;
SetupSRL;
DeclarePlayers;
LogInPlayer;
end;

begin
Startup;
SetupChar;
MainLoop;
ReleaseDTMS;
end.

Finds the DTM in the editor everytime but it says that it cannot find it in the client or in SMART, am I scripting something wrong? I am redoing my beginning of the GDK right now. Any help? (:

Mark

2012-07-08 15:50:10

Your not loading your DTM

Also try to load and free your DTM in the same Function/procedure
example:

function TeleportToEdge:Boolean;
begin
DTMHouse := DTMFromString('mWAAAAHicY2FgYLBhYmBwAGJnILYA4idAsZdA/AiI3wCxnoYBgwSrPEN32zGGrMgDDPxAMWTMiIZBAADlWQj7');
writeln('Could not find bank, teleporting to Edgeville and walking to bank');
wait(500+random(50));
GameTab(tab_Magic);
wait(1000+random(50));
if FindDTM(DTMHouse, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
Mouse(x, y, 0, 0, True);
end else
begin
writeln('Could not find spell');
FreeDTM(DTMHouse);
end;
end;

King

2012-07-08 17:40:57

From: CRU1Z1N
Your not loading your DTM

Also try to load and free your DTM in the same Function/procedure
example:

function TeleportToEdge:Boolean;
begin
DTMHouse := DTMFromString('mWAAAAHicY2FgYLBhYmBwAGJnILYA4idAsZdA/AiI3wCxnoYBgwSrPEN32zGGrMgDDPxAMWTMiIZBAADlWQj7');
writeln('Could not find bank, teleporting to Edgeville and walking to bank');
wait(500+random(50));
GameTab(tab_Magic);
wait(1000+random(50));
if FindDTM(DTMHouse, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
Mouse(x, y, 0, 0, True);
end else
begin
writeln('Could not find spell');
FreeDTM(DTMHouse);
end;
end;



Thankyou..I knew it was something stupid XD

Mark

2012-07-08 17:59:31

there is alot to improve in that just to give you an idea

NKN

2012-07-08 18:20:12

If it's a small DTM, one that you won't use for extended periods of time. (Over twenty seconds), do it locally, or else make a procedure for calling all your DTMs, then another procedure to Free them all, Add the free one like this:

addonterminate("FreeDTMz")
So your DTMs always get freed

King

2012-07-08 18:26:28

program KingsDragons;
//{/$DEFINE SMART}
{$i SRL/srl.simba}
{$i SRL/SRL/skill/fighting.simba}
{$i SRL/SRL/skill/magic.simba}
{$i sps/sps.simba}


const

FoodType ='';//Enter the type of food to use here



var
x, y, T, DTMHouse, DTMEdgeville: integer;




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

With Players[0] Do
Begin
Name := ''; //Player username.
Pass := ''; //Player password.
Nick := ''; //Player nickname - 3-4 letters of Player username.
Active := True;
end;

end;

procedure LoadDTMs;
begin
DTMHouse := DTMFromString('mWAAAAHicY2FgYLBhYmBwAGJnILYA4idAsZdA/AiI3wCxnoYBgwSrPEN32zGGrMgDDPxAMWTMiIZBAADlWQj7');
DTMEdgeville := DTMFromString('mrAAAAHic42BgYFBmhGBNINYGYg0glgNiKSieCVSzHIgXAvF0IJ4AxL1Q/hwgXrX9IMPUOYsZdDQ1GXQSEhlEDcIYHIvyGYLFpcAYH+AHYkYCGAYA98kONA==');
end;

procedure ReleaseDTMS;
begin
FreeDTM(DTMHouse);
FreeDTM(DTMEdgeville);
end;


Function CheckForFood:Boolean;
begin
if IsUpText(FoodType) then
begin
result:= True;
end else
begin
result:= False;
end;
end;

function TeleportToEdge:Boolean;
begin
writeln('Could not find bank, teleporting to Edgeville and walking to bank');
wait(500+random(50));
GameTab(tab_Magic);
wait(1000+random(50));
if FindDTM(DTMHouse, x, y, MIX1, MIY1, MIX2, MIY2) then
begin
Mouse(x, y, 0, 0, True);
wait(1200+random(200));
end else
begin
writeln('Could not find spell');
end;
if FindDTM(DTMEdgeville, x, y, MSX1, MSY1, MSX2, MSY2) then
begin
Mouse(x, y, 0, 0, True);
if not FindSymbol(x, y, Symbol_Shop) then
begin
MarkTime(T)
repeat
wait(50);
until(FindSymbol(x, y, Symbol_Shop) or (TimeFromMark(T)>= 120000))
end else
begin
writeln('Could not find location');
end;
end;
end;

function AtBank:Boolean;
begin
if FindSymbol(x, y, Symbol_Furnace) then
begin
Result:= True;
writeln('Found the bank');
end else
begin
Result:= False;
writeln('We could not find the bank');
end;
end;


function WalkToBank:Boolean;
begin
wait(250 + random(50));
if TeleportToEdge then
if not AtBank then
begin
MarkTime(T);
repeat
wait(50);
until(AtBank or (TimeFromMark(T)>= 120000));
end else
begin
TerminateScript;
end;
end;


procedure MainLoop;
begin
if AtBank then
begin
// Banking;
end else
begin
WalkToBank;
end;
end;
procedure SetupChar;

begin
SetupSRL();
SetupMagic();
SetAngle(0);
ClickNorth(0);
LoadDTMs;
end;


procedure Startup;
begin
Smart_Server := 10;
Smart_Members:= true;
Smart_Signed := true;
Smart_SuperDetail := false;
SetupSRL;
DeclarePlayers;
LogInPlayer;
end;

begin
Startup;
SetupChar;
MainLoop;
addonterminate('ReleaseDTMS');
end.

This is what I have rewritten so far, I'm also using custom SPS maps for the walking and probably some TPAs to fight the dragons ect?