
Originally Posted by
Enslaved
code atm? if its private, paste snipplets of where relevant
By using Marktime these are your main commands:
marktime(t);
repeat
(Look at the example code)
until(TimeFromMark(t) > 30000);
~
~ * Look at example*
~
if (TimeFromMark(TT) >= Twait2) then
begin to unstuck...
.....
....
If its hard for you to read this, then open it from this pastebin link: http://pastebin.com/xa1ps42G simply go on that site click on Raw and copy paste the code to simba. Note it wont compile, you have to do that, but this is what i use for my script, basically add the unstuck procedure to main loop and it only starts if its actually lost.
Code:
program StallStealer;
{$DEFINE SMART8}
{$I SRL-OSR/SRL.Simba}
var
x,y:integer; //anything that keeps the script stable and its always there undisrupted then add it...
checkifstuckicon,Foundmynpc,foundthestall,FoundthisFailsafeicon: boolean; // you can add as many icon/colors/objects whatever you want to add to the list as boolean functions.
procedure playersetup;
begin
//playername,pw etc.. all info
end;
procedure StealFromStall;
begin
//if find this npc, or this icon on the mini map, then right click stall.. steal then drop if inv full etc.. do whatever here. this is the heart of your script.
end;
function Checkifstuckicon: Boolean;
var
Minimapicon:TpointArray;
begin
if (FindBitmapToleranceIn(Minimapicon,X,y,MIX1, MIY1, MIX2, MIY2, 10)) then // I gave an example as a Bitmap, but you can use Colors and Tpoint Arrays or objects.. It all leads to the same desired result
begin
Safe := true;
result := true;
end
else
begin
Safe := False;
result := false;
end;
end;
procedure TelePort;
begin
Gametab(tab_magic);
Wait(500);
MouseBox(658, 325, 674, 342, mouse_left);
Wait(2000 + Random(500));
MouseBox(230, 423, 288, 435, mouse_left);
end;
//if find this icon that is ALWAYS on the minimap (be it a bank icon or some unique color dot/area/wall etc.. anything thats always there that can be used as a fail to KNOW your still at the right spot
//we'll start a mark time, and the script will exit it when ever it KNOWS its not lost/doesnt need to tele, so everytime it finds our Fail Safe objects/colors it will exit the count and continue with the main loop. Now if 30 seconds have passed and it still didn't find the Stable icons on our screen, it will start to unstuck. (its better to do marktime(tt), a second marktime for the unstuck phase, if that doesn't solve it and it still cant find the icons, then it will terminate.
procedure checkifstuck;
begin
marktime(t);
repeat
if (Checkifstuckicon) then
exit;
if (Checkifstuckicon2) then
exit;
if (not(loggedin)) then
exit;
FindnormalRandoms; // This wilL Find random events if you get any!
until(TimeFromMark(t) > 30000);
if (Checkifstuckicon) then
exit;
if (Checkifstuckicon2) then
exit;
if (not(loggedin)) then
exit;
Findnormalrandoms;
if (TimeFromMark(T) >= Twait1) then
begin
TelePort;
wait(randomrange(5000,10000);
if (Checkifstuckicon) then
exit;
if (Checkifstuckicon2) then
exit;
if (not(loggedin)) then
exit;
//So this is second failsafe now, if it teleports or tries to teleport and it still cant find the area, then we'll make it terminate
if (not(CheckifstuckIcon)) or (not(CheckifStuckicon2)) then
begin
Writeln('we are lost, we have teleported and still cant find the area, maybe we got stuck in a random event, time to terminate');
terminatescript;
end;
end;
end;
procedure mainloop;
begin
repeat
StealfromStall;
checkifstuck;
until (not(loggedin));
end;
begin
setupsrl;
playersetup;
repeat
mainloop;
until (not(loggedin))
if not (loggedin) then
loginplayer;
end.