Results 1 to 12 of 12

Thread: Anyway to do this?

  1. #1
    Join Date
    Mar 2013
    Posts
    26
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default Anyway to do this?

    I'm trying to make a fail safe where if its not doing an action for less than a 30 seconds it teleports. I have the code for the teleport function thanks to Sjoe. I've been tweeking it but i can never get a fail safe to work like this. here is the code for.



    Code:
    Gametab(tab_magic);
       Wait(500);
       MouseBox(658, 325, 674, 342, mouse_left);
       Wait(2000 + Random(500));
       MouseBox(230, 423, 288, 435, mouse_left);

  2. #2
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    You could have a global variable of type Integer that marks the time after/before an action/event is executed and then check throughout the script if that variable is ever over 30000 ms (30 seconds). This way as long as the timer keeps being reset, it should continue executing x action(s) - in theory of course.

  3. #3
    Join Date
    Mar 2013
    Posts
    26
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    I'm a very big noob when it comes to scripting, care to explain that?

  4. #4
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Do you mean checking if the player is no longer teleporting or not in a area? why would the player stop teleporting? If they are in the wrong area you could count a fiew colors on the minimap using the countcolortolerance function

    You can do a timeout failsafe like

    Marktime(t)
    if (Timefrommark(t)>30000) then
    blah blah

  5. #5
    Join Date
    Mar 2013
    Posts
    26
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    No, its stealing. I want to make a fail safe for when it hasnt found or stole for like 30 seconds then it teleports (In case it walked away)

  6. #6
    Join Date
    Apr 2013
    Posts
    395
    Mentioned
    1 Post(s)
    Quoted
    177 Post(s)

    Default

    Check inventory count. If inventory count still same as 30 seconds ago, teleport.

  7. #7
    Join Date
    Apr 2012
    Posts
    157
    Mentioned
    10 Post(s)
    Quoted
    57 Post(s)

    Default

    I think you'd be better off with using Pixelshift, to check movement of your character. You'd test to make sure your character is "moving" or performing an action. And if the pixel shift stays under a certain number for too long, you know you've been stuck too long.

    Or the inventory thing. That may work assuming you are stealing a tangeable item that will add a slot to your inventory.

    Third, the MarkTime will work as well. You simply have to mark a global time variable at the beginning of your Steal procedure. And then you just check it at a later point. This way it will reset your timer each time you successfully attempt a steal action.

  8. #8
    Join Date
    Mar 2013
    Location
    Shaolin
    Posts
    863
    Mentioned
    24 Post(s)
    Quoted
    519 Post(s)

    Default

    Simba Code:
    procedure lalala;
    var
    t:integer;
    begin
    t := (getSystemTime + 30000);
    dowutever;
    if (getSystemTime > t) then
    tele;
    end;

    Did it in browser but thats what I use
    You have permission to steal anything I've ever made...

  9. #9
    Join Date
    Mar 2013
    Posts
    26
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    How would i implement that?

  10. #10
    Join Date
    Jan 2012
    Location
    127.0.0.1
    Posts
    702
    Mentioned
    11 Post(s)
    Quoted
    76 Post(s)

    Default

    code atm? if its private, paste snipplets of where relevant

  11. #11
    Join Date
    Sep 2008
    Posts
    754
    Mentioned
    8 Post(s)
    Quoted
    275 Post(s)

    Default

    Quote Originally Posted by Enslaved View Post
    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.

  12. #12
    Join Date
    Mar 2013
    Posts
    26
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Code:
    program PickSilk;
    {$i SRL-OSR/SRL.simba}
    Function GreenRandom: Boolean;  //detects random
    begin
      Result := (CountcolorTolerance(1007173, 552, 4, 697, 152, 13) > 10000);
    end;
    // if we count more than 10k green pixels, we are in random.
    
    function LeftGreenRandom:Boolean;
    begin
      if (not CountcolorTolerance(1007173, 552, 4, 697, 152, 13) > 10000) then
      Result := True;
    end;
    
    
    
    
    function RandomSolver: Boolean;
    begin
       Gametab(tab_magic);
       Wait(500);
       MouseBox(658, 325, 674, 342, mouse_left);
       Wait(2000 + Random(500));
       MouseBox(230, 423, 288, 435, mouse_left);
      if  WaitFunc(@LeftGreenRandom, 100, 8000) then
      Writeln('Left the random');
    end;
    
    function StealFromStall: Boolean;
    var
      x, y: Integer;
    begin
     if FindObjCustom(x, y, ['Gem', 'stall'], [2557811], 7) then
     begin
      Writeln('Found Gems') // debug
      Mouse(x, y, 3, 3, true); // leftclicking :)
      Result := True;
      Wait(2500);
      Exit;
     end;
    end;
    
    
    begin
     SetupSRL;
     ActivateClient;
    repeat
    if (GreenRandom = True) then RandomSolver;
     StealFromStall
     until(false);
    
    end.


    Thats the code, im thinking about getting rid of the random solver, with a wait time then if it hasnt done the action in like 30-40 seconds it teleports.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •