Results 1 to 24 of 24

Thread: Bot is over eating, please help.

  1. #1
    Join Date
    Mar 2013
    Posts
    85
    Mentioned
    1 Post(s)
    Quoted
    21 Post(s)

    Default Bot is over eating, please help.

    Any script i run that involves eating will eat my food when its not nessecary.

    Like if i put HpToEat at 40, it will eat at any random number even when im full hp and my entire inventory of food gets wasted quickly.
    anyone else ever have this problem or know a fix or can suggest something?

    I have been trying to run the bloodWorm script but due to the eating problem my entire inventory gets wasted in 10-20 minutes.

  2. #2
    Join Date
    Nov 2011
    Location
    United States
    Posts
    815
    Mentioned
    6 Post(s)
    Quoted
    284 Post(s)

    Default

    How many Hitpoints is your character?

    Also, it might be a problem with the script itself. Ive never botted combat on 07, but i know if the code is correct and you set the settings correctly, there is no reason it should be eating.

    Make sure you don't set the Hptoeat to high if you are low level.

  3. #3
    Join Date
    Mar 2013
    Posts
    85
    Mentioned
    1 Post(s)
    Quoted
    21 Post(s)

    Default

    Quote Originally Posted by Itankbots View Post
    How many Hitpoints is your character?

    Also, it might be a problem with the script itself. Ive never botted combat on 07, but i know if the code is correct and you set the settings correctly, there is no reason it should be eating.

    Make sure you don't set the Hptoeat to high if you are low level.
    My Hp is 80-89, i set my HpToEat at 40-50 yet it will eat 79-85-84 any random number even if i am full hp. Do you know how i would go about getting simba completely off my computer then reinstalling it? and its not just one script, happens with every script that needs eating.

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

    Default

    Quote Originally Posted by hurricane900 View Post
    My Hp is 80-89, i set my HpToEat at 40-50 yet it will eat 79-85-84 any random number even if i am full hp. Do you know how i would go about getting simba completely off my computer then reinstalling it? and its not just one script, happens with every script that needs eating.
    It's the script that has nothing to do with simba

  5. #5
    Join Date
    Mar 2013
    Posts
    85
    Mentioned
    1 Post(s)
    Quoted
    21 Post(s)

    Default

    This is a popular script lot of others user, no one else seems to be having this problem just me. i could link you to script if you'd like.

  6. #6
    Join Date
    Mar 2013
    Posts
    85
    Mentioned
    1 Post(s)
    Quoted
    21 Post(s)

    Default

    Quote Originally Posted by Officer Barbrady View Post
    It's the script that has nothing to do with simba
    After looking at other posts people seem to be having this problem and the writer of script suggested re-installing simba fully, it seems to have worked for some people, I don't even remember how i downloaded simba in the first place.

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

    Default

    Quote Originally Posted by hurricane900 View Post
    After looking at other posts people seem to be having this problem and the writer of script suggested re-installing simba fully, it seems to have worked for some people, I don't even remember how i downloaded simba in the first place.
    Simba has NOTHING to do with the script over eating. It's a issue with the script. It has NO connection to Simba.

  8. #8
    Join Date
    Mar 2013
    Posts
    85
    Mentioned
    1 Post(s)
    Quoted
    21 Post(s)

    Default

    Quote Originally Posted by Officer Barbrady View Post
    Simba has NOTHING to do with the script over eating. It's a issue with the script. It has NO connection to Simba.
    I understand that bro but isn't it SRL-OSR that does the HP detection and eating? and it probably uses a bunch of other files within the simba folder maybe its one of those, I was told that the script calls the eat procedure when not on stats tab which results in a -1 value and thus the bot eats.

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

    Default

    Quote Originally Posted by hurricane900 View Post
    I understand that bro but isn't it SRL-OSR that does the HP detection and eating? and it probably uses a bunch of other files within the simba folder maybe its one of those, I was told that the script calls the eat procedure when not on stats tab which results in a -1 value and thus the bot eats.
    That's the include not Simba..

  10. #10
    Join Date
    Nov 2011
    Location
    United States
    Posts
    815
    Mentioned
    6 Post(s)
    Quoted
    284 Post(s)

    Default

    Quote Originally Posted by Officer Barbrady View Post
    That's the include not Simba..
    No need to be rude, he asked a question. If you don't want to answer it, then don't. I believe he heard you the first time you said its not simba's fault.

    But yes, to uninstall simba, go to c:/Simba, In the file next to the installer, there will also be an un-installer, Just do that, then delete the Simba folder. Make sure to Save any scripts you wish to keep in a separate folder before you do so though.

  11. #11
    Join Date
    Mar 2013
    Posts
    85
    Mentioned
    1 Post(s)
    Quoted
    21 Post(s)

    Default

    Quote Originally Posted by Officer Barbrady View Post
    That's the include not Simba..
    http://villavu.com/forum/showthread.php?t=103209&page=6

    thats the script link, so should i re-install includes.

  12. #12
    Join Date
    Nov 2011
    Location
    United States
    Posts
    815
    Mentioned
    6 Post(s)
    Quoted
    284 Post(s)

    Default

    Quote Originally Posted by hurricane900 View Post
    http://villavu.com/forum/showthread.php?t=103209&page=6

    thats the script link, so should i re-install includes.
    Yeah, I read through a couple pages, that seemed to fix the problem for everyone, so i suggest doing that. If re-installing the includes doesn't work. Delete your whole simba folder and re-install everything. There is probably just something out dated in one of your includes or something

  13. #13
    Join Date
    Mar 2013
    Posts
    85
    Mentioned
    1 Post(s)
    Quoted
    21 Post(s)

    Default

    Quote Originally Posted by Itankbots View Post
    Yeah, I read through a couple pages, that seemed to fix the problem for everyone, so i suggest doing that. If re-installing the includes doesn't work. Delete your whole simba folder and re-install everything. There is probably just something out dated in one of your includes or something
    i remember using this one thread that had all the required stuff to download and replace includes with and a nice tutorial do you know of any if so plz link me sorry for wasting this much time

  14. #14
    Join Date
    Mar 2013
    Posts
    85
    Mentioned
    1 Post(s)
    Quoted
    21 Post(s)

    Default

    Quote Originally Posted by Itankbots View Post
    Yeah, I read through a couple pages, that seemed to fix the problem for everyone, so i suggest doing that. If re-installing the includes doesn't work. Delete your whole simba folder and re-install everything. There is probably just something out dated in one of your includes or something
    is the includes download still the unoffical includes? or is their an offical one now.

  15. #15
    Join Date
    Nov 2011
    Location
    United States
    Posts
    815
    Mentioned
    6 Post(s)
    Quoted
    284 Post(s)

    Default

    Quote Originally Posted by hurricane900 View Post
    is the includes download still the unoffical includes? or is their an offical one now.
    Im afraid I don't know anything about the 07 aspect of SRL, i only do the EOC stuff, so i don't know which include you need now :/ Id assume its the official one by now though.

    THis link is for setting up Simba: http://villavu.com/forum/showthread.php?t=47714

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

    Default

    You do NOT need to reinstall Simba. Just update the include.

  17. #17
    Join Date
    Mar 2013
    Posts
    85
    Mentioned
    1 Post(s)
    Quoted
    21 Post(s)

    Default

    Quote Originally Posted by Itankbots View Post
    Im afraid I don't know anything about the 07 aspect of SRL, i only do the EOC stuff, so i don't know which include you need now :/ Id assume its the official one by now though.

    THis link is for setting up Simba: http://villavu.com/forum/showthread.php?t=47714
    I replaced only P07Include the unofficial one i downloaded which still seems to be the only one and nothing changed the problem is it doesn't go to stats tab when checking for HP it returns a -1 value and just eats my inventory.

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

    Default

    Quote Originally Posted by hurricane900 View Post
    I replaced only P07Include the unofficial one i downloaded which still seems to be the only one and nothing changed the problem is it doesn't go to stats tab when checking for HP it returns a -1 value and just eats my inventory.
    Which script is this. Script author is using an outdated include or their script is buggy

  19. #19
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    @hurricane900; Tell the author to stop blaming Simba and blame the include or his script.. What is the name of this script and where did you get it?
    I am Ggzz..
    Hackintosher

  20. #20
    Join Date
    Mar 2013
    Posts
    85
    Mentioned
    1 Post(s)
    Quoted
    21 Post(s)

    Default

    Quote Originally Posted by Brandon View Post
    @hurricane900; Tell the author to stop blaming Simba and blame the include or his script.. What is the name of this script and where did you get it?
    http://villavu.com/forum/showthread.php?t=103209&page=6

    thats the script,on the first page he mentions re-installing the entire simba. do you know how i could fix this by any chance?

  21. #21
    Join Date
    Mar 2013
    Posts
    85
    Mentioned
    1 Post(s)
    Quoted
    21 Post(s)

    Default

    http://villavu.com/forum/showthread.php?t=103209&page=6

    thats the link to the script, after reading the posts im not the only one having this problem

  22. #22
    Join Date
    Feb 2006
    Location
    Helsinki, Finland
    Posts
    1,395
    Mentioned
    30 Post(s)
    Quoted
    107 Post(s)

    Default

    I think this problem might/could be something similar to this problem:

    Quote Originally Posted by Janilabo;
    I think this problem could be caused by the moment when the (shop) stack amount is getting updated - example below:
    Code:
    STACK
    2544 [moment 1] - now we use Choose Option, with Buy 10 for this!
    25__ [moment 2] - last 2 digits getting updated, but they will be shown as blank space (or something between 44 and 34) for a very short moment, right before new quantity is added in, so quantity would be detected as "25" now...
    2534 [moment 3] - that new quantity has been updated to screen.
    The "moment 2" is shown in screen for maybe 16 milliseconds, something that you don't really notice with human-eye... But even that is enough for SCAR to pick it up incorrectly sometimes, obviously.

    So, for version 0.30 I added in a workaround for this case, hoping it will get rid of this issue finally for good.
    (Note: This quoted post doesn't exist in SRL-forums)

    So basically, when your HP goes automatically up by 1, and when it will update only the latter digit of it (that second digit), it will pick it up as just single digit value (not empty str!), before that new second digit value is added in...
    If your Simba is scanning screen at that very same moment, while second digit from HP is getting updated, it will pick up your HP incorrectly and eat some food when its not even needed.

    Any HP change could cause this issue, like for example: It could be happening either when you lose HP (get damaged by NPC's/players) or when you gain it automatically from game system OR manually from eating some food.

    When the whole value changes, these issues wont be happening, because it will be picked up as -1, as it will be updating both HP digits and that way it will be detected as -1 (due to invalid str).

    Incase anyone wants to add similar quantity validation for Simba scripts aswell, then here are the script's source codes:

    ---0.32---
    Code:
    program ShopAndHop;
    
    {========Shop and Hop===========
    =======A universal buyer========
    Version: 0.32
    Release Date: 3.16.2013
    Version Date: 5.14.2013
    Description: Purchases stackable items from any shop and hops world to repeat.
    Instructions: Setup lines 28-36 with npc colors, name and shop items you would like to purchase.
    ===============================}
           
    {$DEFINE SMART} // Comment out to use webbrowser.
    
    var
      i, curworld, worldcount: Integer;  
      compassangle: Extended;
      npccolors, slotstobuy, buylimit, excludeworlds: TIntArray;
      npcname, npctradecommand, uname, pword: string;
      didswitch, success: Boolean;
      bmp: TSCARBitmap; 
      
    const
      NEW_QUANTITY_METHOD = True; // Use new or old way? Test which works better. True = NEW, False = OLD
      QUANTITY_VALIDATION = 3; // Amount of checkups/scans that each GetShopQuantityEx() requires to validate the result (quantity)? Recommended to keep as 3-6.
    
    procedure Setup;
    begin        
      uname := 'username';
      pword := 'password';
      npccolors := [0, 0]; // Remember to clear the 0's out and then add your own colors in.            
      npcname := 'NPC NAME';
      npctradecommand := 'Trade';      
      compassangle := 0.0; // Change if needed. ..example compass angles: http://i.imgur.com/V5kCu4Y.png
      slotstobuy := [0, 1, 2];
      buylimit := [0, 50, 100];
      excludeworlds := [301, 302, 308, 316];
      bmp := TSCARBitmap.Create('deNrjYuBi+D9DHo487IzREFCQAQYwFUBkPR1MgAjCJigLNwQuC2QASbheuDIIgkjBDUHWi2w+mhXIJiPLIjOQFeCSRRMEAN2QVj0=');
      if (High(slotstobuy) <> High(buylimit)) then
      begin
        WriteLn('Number of parameters for slots to buy and item limits do not match!');
        TerminateScript;
      end;
    end;
    
    {$DEFINE RS07}
    {$I OSI\OSI.scar}
    {$I MSSL\MSSL.scar}
    
    procedure ScriptTerminate;
    begin
      Bmp.Free;
      MSSL_Unsetup; 
      FreeOSI;
    end;
    
    {$IFNDEF MSSL_1.11(+)}
      begin                 
        ClearDebug;
        WriteLn('MSSL is OUTDATED! Please update it with Includes Manager.');
      end.
    {$ENDIF}
    
    function GetShopSlotFromID(i: Integer): TBox;
    var
      col, row: Integer;
    begin
      col := (i mod 8);
      row := Floor(i / 8);
      Result := Box((80 + col * 47), (69 + row * 47), (111 + col * 47), (100 + row * 47));
    end;
    
    function IsShopOpen: Boolean;
    var
      x, y: Integer;
      a: TBox;
    begin
      case RS07_LoggedIn of
        True:
        begin
          a := Box(68, 297, 80, 309);
          case RS07_PreventChooseOptionCollision(a) of
            True: Result := FindBitmap(x, y, bmp, a.X1, a.Y1, a.X2, a.Y2);
            False: Result := False;                                        
          end;
        end;
        False: Result := False;
      end;
    end;
    
    function GetShopQuantityFromIDEx(i: Integer; colors: TIntArray): Integer;
    var
      c, t, s, q, v: Integer;
      slotbox: TBox;          
      b: TSCARBitmap;
      tmpClient: TSCARClient;
      tmp: string;
      accept: TCharArray;
      e: Boolean;
    begin         
      if ((Length(colors) > 0) and RS07_PreventChooseOptionCollision(RS07_GameActionBx) and IsShopOpen) then
      begin        
        accept := MSSL_TIAToTCA(MSSL_TIAByRange(48, 57));
        slotbox := GetShopSlotFromID(i);
        t := GetSystemTime;
        Result := -1;
        case (QUANTITY_VALIDATION > -1) of
          True: s := QUANTITY_VALIDATION;
          False: s := 0;
        end;
        repeat 
          if not IsShopOpen then
            Exit;  
          v := -1;       
          b := GetClient.Capture;
          ReplaceColors(b, colors, 62208);
          tmpClient := MSSL_SetBitmapAsClient(b); 
          case NEW_QUANTITY_METHOD of
            True:
            begin
              tmp := GetTextAtEx((slotbox.X1 + 1), (slotbox.Y1 + 3), 0, RS07_TradeFont, False, False, 0, 0, 62208, 4, True, tr_Digits); 
              if MSSL_TCAContains(accept, tmp[1]) then
                v := StrToIntDef(GetNumbers(tmp), -1); 
              tmp := ''; 
            end;                  
            False: 
            begin 
              e := False;      
              for c := 4 downto 1 do
                if not e then
                begin     
                  tmp := GetTextAtEx((slotbox.X1 + 1), (slotbox.Y1 + 3), 0, RS07_TradeFont, False, False, 0, 0, 62208, c, True, tr_Digits);
                  if MSSL_TCAContains(accept, tmp[1]) then
                  begin
                    v := StrToIntDef(tmp, -1);           
                    e := (v > -1);
                  end;
                  tmp := '';
                end;
            end;  
          end;
          SetClient(tmpClient).Free;   
          b.Free;    
          if (v > Result) then
            Result := v;
          if (Result > -1) then
            Inc(q);
          MSSL_Wait(0);
        until (((GetSystemTime - t) > 10000) or (q > s));
      end else
        Result := -1;     
    end;
    
    function GetShopQuantityFromID(i: Integer): Integer;
    begin        
      Result := GetShopQuantityFromIDEx(i, [65535, 1679010]);  
    end;
    
    function BuyFromShop(i, lim: Integer): Boolean;
    var
      t, q, f, b: Integer;
      slot: TBox;
      u: TStrArray;
    begin
      if (InRange(i, 0, 39) and IsShopOpen) then
      begin  
        slot := GetShopSlotFromID(i);
        repeat         
          if not IsShopOpen then
            Exit;
          q := GetShopQuantityFromID(i); 
          if (q > 0) then
          begin    
            b := (q - lim);
            Result := (b < 1);
            if not Result then
            begin
              case (b > 9) of
                True: u := ['Buy 10', 'Buy 5', 'Buy 1'];
                False:
                case (b > 4) of
                  True: u := ['Buy 5', 'Buy 1'];
                  False: u := ['Buy 1'];
                end;
              end;
              case RS07_ChooseOptions(Point((slot.X1 + 5 + Random((slot.X2 - slot.X1) - 5)), (slot.Y1 + 2 + Random((slot.Y2 - slot.Y1) - 3))), u) of
                True:
                begin   
                  f := 0;
                  t := GetSystemTime;
                  repeat 
                    if not IsShopOpen then
                      Exit;
                    MSSL_Wait(0);
                  until (not RS07_ChooseOptionAvailable or ((GetSystemTime - t) > 3000)); 
                  MSSL_Wait(200 + Random(100));  
                  t := GetSystemTime;
                  repeat         
                    if not IsShopOpen then
                      Exit;
                    MSSL_Wait(0);
                    q := GetShopQuantityFromIDEx(i, [65525]);
                  until (((GetSystemTime - t) > 20000) or (q > -1));
                  Result := ((q = 0) or ((q > -1) and (q <= lim)));
                end; 
                False:
                begin
                  Result := ((q = 0) or ((q > -1) and (q <= lim)));
                  if RS07_ChooseOptionAvailable then
                  begin
                    if not RS07_ChooseOptionContains('Buy 1') then
                      Inc(f);
                    RS07_HideChooseOption;
                  end;
                end;
              end;
            end; 
          end else
            Result := (q = 0);
          if not Result then
            MSSL_Wait(0);    
        until (Result or (f > 2));
      end;
    end;
    
    function CloseShop: Boolean;
    var 
      t, m, r: Integer;
      xbox: TBox;
      p: TPoint;
    begin
      xbox := Box(477, 31, 491, 51);
      Result := not IsShopOpen;
      if (not Result and RS07_PreventChooseOptionCollision(xbox)) then
      begin  
        m := GetSystemTime;
        p := Point((xbox.X1 + Random(xbox.X2 - xbox.X1)), (xbox.Y1 + Random(xbox.Y2 - xbox.Y1))); 
        repeat        
          Result := not IsShopOpen;
          if not Result then
          begin
            case MSSL_MouseNearPt(p, 2) of
              True:
              if (((GetSystemTime - m) > 25) and ((GetSystemTime - t) > (250 + r)) and RS07_WaitUpText('Close', um_IsUpText, 30)) then
              begin
                RS07_Click(mbLeft);
                t := GetSystemTime;
                r := Random(250);
              end;            
              False:
              begin
                RS07_MoveMouse(p.X, p.Y);
                m := GetSystemTime;
              end; 
            end;
            MSSL_Wait(0);
          end; 
        until Result;  
      end;
    end;
    
    function OpenShop: Boolean;
    var
      h, i, t: Integer;
      p: TPointArray;
      c: TPoint;
      a: T2DPointArray;  
    begin
      Result := IsShopOpen;
      if not Result then
      repeat     
        if not RS07_LoggedIn then
          Exit;   
        Result := IsShopOpen;
        if (not Result and RS07_SetCompass(compassangle)) then
        case MSSL_FindColorsTolExCS(p, npccolors, RS07_GameActionBx.X1, RS07_GameActionBx.Y1, RS07_GameActionBx.X2, RS07_GameActionBx.Y2, 3, MSSL_CTS1) of 
          True:
          begin
            a := SplitTPA(p, 10);
            SortATPAByMeanEx(a, BoxCenter(RS07_GameActionBx));
            SetLength(p, 0);  
            h := High(a);
            for i := 0 to h do
            begin
              c := TPACenter(a[i]); 
              RS07_MoveMouse(c.X, c.Y); 
              MSSL_Wait(25);
              if RS07_WaitUpText(('Talk-to ' + npcname), um_IsUpText, 25) then
              begin      
                GetMousePos(c.X, c.Y);
                case (RS07_OpenChooseOption(c.X, c.Y) and RS07_ChooseOptionUse(npctradecommand)) of
                  True:
                  begin
                    t := GetSystemTime;
                    repeat       
                      if not RS07_LoggedIn then
                        Exit;
                      MSSL_Wait(0);
                      Result := IsShopOpen;
                    until (Result or ((GetSystemTime - t) > 10000));
                  end; 
                  False: RS07_HideChooseOption; 
                end;
                Break;
              end;
            end;
          end;
          False:
          begin
            RS07_MoveMouse(255, 175);
            MSSL_Wait(25);
            if RS07_WaitUpText(('Talk-to ' + npcname), um_IsUpText, 25) then
            begin          
              GetMousePos(c.X, c.Y);
              case (RS07_OpenChooseOption(c.X, c.Y) and RS07_ChooseOptionUse(npctradecommand)) of
                True:
                begin
                  t := GetSystemTime;
                  repeat       
                    if not RS07_LoggedIn then
                      Exit;
                    MSSL_Wait(0);
                    Result := IsShopOpen;
                  until (Result or ((GetSystemTime - t) > 10000));
                end; 
                False: RS07_HideChooseOption;
              end;
            end;
          end;
        end;
      until Result;
    end;
    
    begin
      SetUpOSI;
      MSSL_Setup;  
      Setup;       
      worldcount := Length(RS07_Worlds);
      curworld := Random(worldcount);
      didswitch := False; 
      repeat
        case RS07_LoggedIn of
          False:
          case RS07_AtLoginScreen of
            True:
            case didswitch of
              False:
              begin
                repeat
                  curworld := ((curworld + 1) mod worldcount);
                until not TIAContains(excludeworlds, RS07_Worlds[curworld]);
                case RS07_ValidWorld(RS07_Worlds[curworld]) of
                  True:
                  begin
                    WriteLn(MSSL_TheTime + ': Switching to ' + IntToStr(RS07_Worlds[curworld])); 
                    didswitch := RS07_SwitchWorld(RS07_Worlds[curworld]);
                  end;
                  False:
                  begin
                    WriteLn(MSSL_TheTime + ': Woah, that was weird... How did that happen?');
                    curworld := Random(worldcount);
                    WriteLn(MSSL_TheTime + ': Switching to ' + IntToStr(RS07_Worlds[curworld])); 
                  end;  
                end; 
              end;
              True:
              begin
                if RS07_LogIn(uname, pword) then
                  RS07_SetCameraAngleH;
                didswitch := False; 
              end; 
            end;
            False:
            case RS07_AtWorldSelection of
              False:
              case RS07_AtWelcomeScreen of
                False:
                begin
                  WriteLn(MSSL_TheTime + ': Not logged in and cannot access world switch.. Terminating script!');
                  TerminateScript;
                end;
                True: RS07_Play; 
              end;
              True: 
              begin
                WriteLn(MSSL_TheTime + ': Woah... That was weird. Avoided getting stuck on world selection.');
                didswitch := RS07_CancelWorldSwitch;
              end;
            end;
          end;
          True:
          begin
            for i := 0 to High(slotstobuy) do
            case RS07_LoggedIn of
              True:
              begin 
                success := False;
                repeat
                  if OpenShop then
                  begin
                    success := BuyFromShop(slotstobuy[i], buylimit[i]);
                    if not success then                      
                      MSSL_Wait(0);
                  end;
                until (success or not RS07_LoggedIn); 
              end;   
              False: i := (High(slotstobuy) + 1);    
            end;
            CloseShop;
            repeat       
              success := not RS07_LoggedIn;
              if (not success and not RS07_LogOut) then
                MSSL_Wait(0);
            until success;
          end;
        end; 
        MSSL_Wait(0);
      until False;
    end.
    ..and...

    ---0.32 [CTS]---
    Code:
    program ShopAndHop;
    
    {========Shop and Hop===========
    =======A universal buyer========
    Version: 0.32 [CTS]
    Release Date: 3.16.2013
    Version Date: 5.14.2013
    Description: Purchases stackable items from any shop and hops world to repeat.
    Instructions: Setup lines 33-41 with npc colors, name and shop items you would like to purchase.
    ===============================}
           
    {$DEFINE SMART} // Comment out to use webbrowser.
    {$DEFINE RS07}
    {$I OSI\OSI.scar}
    {$I MSSL\MSSL.scar}
    
    var
      i, curworld, worldcount: Integer;  
      compassangle: Extended;
      npccolors: MSSL_TColorDataArray;
      slotstobuy, buylimit, excludeworlds: TIntArray;
      npcname, npctradecommand, uname, pword: string;
      didswitch, success: Boolean;
      obj: RS07_TObj;
      bmp: TSCARBitmap;
                   
    const
      NEW_QUANTITY_METHOD = True; // Use new or old way? Test which works better. True = NEW, False = OLD
      QUANTITY_VALIDATION = 3; // Amount of checkups/scans that each GetShopQuantityEx() requires to validate the result (quantity)? Recommended to keep as 2-5.
      
    procedure Setup;
    begin        
      uname := 'username';
      pword := 'password';                                         // READ EVERYTHING => Remember to EDIT the MSSL_ColorSettings2() (you can add unlimited amount of these, but having only 1 of em is highly recommended, to maintain as fast speed as possible).
      npccolors := [MSSL_ColorData(MSSL_ColorSettings2(1, 0.00, 0.00), 16777215, 3)]; // Parameters: 1. CTS-mode [1], 2. Hue modifier [0.00], 3. Saturation modifier [0.00], 4. Color [16777215], 5. Tolerance [3]! - NOTE: If you use CTS0 or CTS1, then just keep the modifier parameters (hue&saturation) as 0 or 0.00.          
      npcname := 'NPC NAME'; // CASE-SENSITIVE!
      npctradecommand := 'Trade'; // CASE-SENSITIVE!    
      compassangle := 0.0; // Change if needed. ..example compass angles: http://i.imgur.com/V5kCu4Y.png
      slotstobuy := [0, 1, 2];
      buylimit := [0, 50, 100];
      excludeworlds := [301, 302, 308, 316];
      bmp := TSCARBitmap.Create('deNrjYuBi+D9DHo487IzREFCQAQYwFUBkPR1MgAjCJigLNwQuC2QASbheuDIIgkjBDUHWi2w+mhXIJiPLIjOQFeCSRRMEAN2QVj0=');
      if (High(slotstobuy) <> High(buylimit)) then
      begin
        WriteLn('Number of parameters for slots to buy and item limits do not match!');
        TerminateScript;
      end;         
      obj := RS07_ToObj(MSSL_ToObjectData(npccolors, bm_Split, 10), Point(0, 0), MSSL_IntRange(0, 0), MSSL_IntRange(0, 0), [('Talk-to ' + npcname)], um_IsUpText); 
    end;
    
    {$IFNDEF MSSL_1.11(+)}
      begin                 
        ClearDebug;
        WriteLn('MSSL is OUTDATED! Please update it with Includes Manager.');
      end.
    {$ENDIF}
    
    procedure ScriptTerminate;
    begin
      Bmp.Free;
      MSSL_Unsetup; 
      FreeOSI;
    end;
    
    function GetShopSlotFromID(i: Integer): TBox;
    var
      col, row: Integer;
    begin
      col := (i mod 8);
      row := Floor(i / 8);
      Result := Box((80 + col * 47), (69 + row * 47), (111 + col * 47), (100 + row * 47));
    end;
    
    function IsShopOpen: Boolean;
    var
      x, y: Integer;
      a: TBox;
    begin
      case RS07_LoggedIn of
        True:
        begin
          a := Box(68, 297, 80, 309);
          case RS07_PreventChooseOptionCollision(a) of
            True: Result := FindBitmap(x, y, bmp, a.X1, a.Y1, a.X2, a.Y2);
            False: Result := False;                                        
          end;
        end;
        False: Result := False;
      end;
    end;
    
    function GetShopQuantityFromIDEx(i: Integer; colors: TIntArray): Integer;
    var
      c, t, s, q, v: Integer;
      slotbox: TBox;          
      b: TSCARBitmap;
      tmpClient: TSCARClient;
      tmp: string;
      accept: TCharArray;
      e: Boolean;
    begin         
      if ((Length(colors) > 0) and RS07_PreventChooseOptionCollision(RS07_GameActionBx) and IsShopOpen) then
      begin        
        accept := MSSL_TIAToTCA(MSSL_TIAByRange(48, 57));
        slotbox := GetShopSlotFromID(i);
        t := GetSystemTime;
        Result := -1;
        case (QUANTITY_VALIDATION > -1) of
          True: s := QUANTITY_VALIDATION;
          False: s := 0;
        end;
        repeat 
          if not IsShopOpen then
            Exit;   
          v := -1;      
          b := GetClient.Capture;
          ReplaceColors(b, colors, 62208);
          tmpClient := MSSL_SetBitmapAsClient(b); 
          case NEW_QUANTITY_METHOD of
            True:
            begin
              tmp := GetTextAtEx((slotbox.X1 + 1), (slotbox.Y1 + 3), 0, RS07_TradeFont, False, False, 0, 0, 62208, 4, True, tr_Digits); 
              if MSSL_TCAContains(accept, tmp[1]) then
                v := StrToIntDef(GetNumbers(tmp), -1); 
              tmp := ''; 
            end;                  
            False: 
            begin 
              e := False;      
              for c := 4 downto 1 do
                if not e then
                begin     
                  tmp := GetTextAtEx((slotbox.X1 + 1), (slotbox.Y1 + 3), 0, RS07_TradeFont, False, False, 0, 0, 62208, c, True, tr_Digits);
                  if MSSL_TCAContains(accept, tmp[1]) then
                  begin
                    v := StrToIntDef(tmp, -1);           
                    e := (v > -1);
                  end;
                  tmp := '';
                end;
            end;  
          end;
          SetClient(tmpClient).Free;   
          b.Free;    
          if (v > Result) then
            Result := v;
          if (Result > -1) then
            Inc(q);
          MSSL_Wait(0);
        until (((GetSystemTime - t) > 10000) or (q > s));
      end else
        Result := -1;     
    end;
    
    function GetShopQuantityFromID(i: Integer): Integer;
    begin        
      Result := GetShopQuantityFromIDEx(i, [65535, 1679010]);  
    end;
    
    function BuyFromShop(i, lim: Integer): Boolean;
    var
      t, q, f, b: Integer;
      slot: TBox;
      u: TStrArray;
    begin
      if (InRange(i, 0, 39) and IsShopOpen) then
      begin  
        slot := GetShopSlotFromID(i);
        repeat         
          if not IsShopOpen then
            Exit;
          q := GetShopQuantityFromID(i); 
          if (q > 0) then
          begin    
            b := (q - lim);
            Result := (b < 1);
            if not Result then
            begin
              case (b > 9) of
                True: u := ['Buy 10', 'Buy 5', 'Buy 1'];
                False:
                case (b > 4) of
                  True: u := ['Buy 5', 'Buy 1'];
                  False: u := ['Buy 1'];
                end;
              end;
              case RS07_ChooseOptions(Point((slot.X1 + 5 + Random((slot.X2 - slot.X1) - 5)), (slot.Y1 + 2 + Random((slot.Y2 - slot.Y1) - 3))), u) of
                True:
                begin   
                  f := 0;
                  t := GetSystemTime;
                  repeat 
                    if not IsShopOpen then
                      Exit;
                    MSSL_Wait(0);
                  until (not RS07_ChooseOptionAvailable or ((GetSystemTime - t) > 3000)); 
                  MSSL_Wait(200 + Random(100));    
                  t := GetSystemTime;
                  repeat         
                    if not IsShopOpen then
                      Exit;
                    MSSL_Wait(0);
                    q := GetShopQuantityFromIDEx(i, [65525]);
                  until (((GetSystemTime - t) > 20000) or (q > -1));
                  Result := ((q = 0) or ((q > -1) and (q <= lim)));
                end; 
                False:
                begin
                  Result := ((q = 0) or ((q > -1) and (q <= lim)));
                  if RS07_ChooseOptionAvailable then
                  begin
                    if not RS07_ChooseOptionContains('Buy 1') then
                      Inc(f);
                    RS07_HideChooseOption;
                  end;
                end;
              end;
            end; 
          end else
            Result := (q = 0);
          if not Result then
            MSSL_Wait(0);    
        until (Result or (f > 2));
      end;
    end;
    
    function CloseShop: Boolean;
    var 
      t, m, r: Integer;
      xbox: TBox;
      p: TPoint;
    begin
      xbox := Box(477, 31, 491, 51);  
      Result := not IsShopOpen;
      if (not Result and RS07_PreventChooseOptionCollision(xbox)) then
      begin  
        m := GetSystemTime;
        p := Point((xbox.X1 + Random(xbox.X2 - xbox.X1)), (xbox.Y1 + Random(xbox.Y2 - xbox.Y1))); 
        repeat        
          Result := not IsShopOpen;
          if not Result then
          begin
            case MSSL_MouseNearPt(p, 2) of
              True:
              if (((GetSystemTime - m) > 25) and ((GetSystemTime - t) > (250 + r)) and RS07_WaitUpText('Close', um_IsUpText, 30)) then
              begin
                RS07_Click(mbLeft);
                t := GetSystemTime;
                r := Random(250);
              end;            
              False:
              begin
                RS07_MoveMouse(p.X, p.Y);
                m := GetSystemTime;
              end; 
            end;
            MSSL_Wait(0);
          end; 
        until Result;  
      end;
    end;
    
    function OpenShop: Boolean;
    var
      t: Integer;
      c: TPoint; 
    begin
      Result := IsShopOpen;
      if not Result then
      repeat     
        if not RS07_LoggedIn then
          Exit;   
        Result := IsShopOpen;
        if (not Result and RS07_SetCompass(compassangle)) then 
        case RS07_FindMainScreenObj(c, obj) of 
          True:
          case (RS07_OpenChooseOption(c.X, c.Y) and RS07_ChooseOptionUse(npctradecommand)) of
            True:
            begin
              t := GetSystemTime;
              repeat       
                if not RS07_LoggedIn then
                  Exit;
                MSSL_Wait(0);
                Result := IsShopOpen;
              until (Result or ((GetSystemTime - t) > 10000));
            end; 
            False: RS07_HideChooseOption; 
          end;
          False:
          begin
            RS07_MoveMouse((255 + RandomRange(-10, 11)), (175 + RandomRange(-10, 11)));
            MSSL_Wait(25);
            if RS07_WaitUpText(('Talk-to ' + npcname), um_IsUpText, 25) then
            begin          
              GetMousePos(c.X, c.Y);
              case (RS07_OpenChooseOption(c.X, c.Y) and RS07_ChooseOptionUse(npctradecommand)) of
                True:
                begin
                  t := GetSystemTime;
                  repeat       
                    if not RS07_LoggedIn then
                      Exit;
                    MSSL_Wait(0);
                    Result := IsShopOpen;
                  until (Result or ((GetSystemTime - t) > 10000));
                end; 
                False: RS07_HideChooseOption;
              end;
            end;
          end;
        end;
      until Result;
    end;
    
    begin
      SetUpOSI;
      MSSL_Setup;  
      Setup;       
      worldcount := Length(RS07_Worlds);
      curworld := Random(worldcount);
      didswitch := False; 
      repeat
        case RS07_LoggedIn of
          False:
          case RS07_AtLoginScreen of
            True:
            case didswitch of
              False:
              begin
                repeat
                  curworld := ((curworld + 1) mod worldcount);
                until not TIAContains(excludeworlds, RS07_Worlds[curworld]);
                case RS07_ValidWorld(RS07_Worlds[curworld]) of
                  True:
                  begin
                    WriteLn(MSSL_TheTime + ': Switching to ' + IntToStr(RS07_Worlds[curworld])); 
                    didswitch := RS07_SwitchWorld(RS07_Worlds[curworld]);
                  end;
                  False:
                  begin
                    WriteLn(MSSL_TheTime + ': Woah, that was weird... How did that happen?');
                    curworld := Random(worldcount);
                    WriteLn(MSSL_TheTime + ': Switching to ' + IntToStr(RS07_Worlds[curworld])); 
                  end;  
                end; 
              end;
              True:
              begin
                if RS07_LogIn(uname, pword) then
                  RS07_SetCameraAngleH;
                didswitch := False; 
              end; 
            end;
            False:
            case RS07_AtWorldSelection of
              False:
              case RS07_AtWelcomeScreen of
                False:
                begin
                  WriteLn(MSSL_TheTime + ': Not logged in and cannot access world switch.. Terminating script!');
                  TerminateScript;
                end;
                True: RS07_Play; 
              end;
              True: 
              begin
                WriteLn(MSSL_TheTime + ': Woah... That was weird. Avoided getting stuck on world selection.');
                didswitch := RS07_CancelWorldSwitch;
              end;
            end;
          end;
          True:
          begin
            for i := 0 to High(slotstobuy) do
            case RS07_LoggedIn of
              True:
              begin  
                success := False;   
                repeat
                  if OpenShop then
                  begin
                    success := BuyFromShop(slotstobuy[i], buylimit[i]);
                    if not success then                      
                      MSSL_Wait(0);
                  end;
                until (success or not RS07_LoggedIn);
              end;
              False: i := (High(slotstobuy) + 1);
            end;
            CloseShop;
            repeat    
              success := not RS07_LoggedIn;
              if (not success and not RS07_LogOut) then
                MSSL_Wait(0);
            until success;
          end;
        end; 
        MSSL_Wait(0);
      until False;
    end.
    Obviously you wont be able to compile those with Simba at all, but you could always take some ideas from it and that way possibly convert/create similar kinds of functions to Simba with it.

    Live and learn!
    Last edited by Janilabo; 06-06-2013 at 10:39 PM.

  23. #23
    Join Date
    Mar 2013
    Posts
    85
    Mentioned
    1 Post(s)
    Quoted
    21 Post(s)

    Default

    I think that would benefit more if it was posted on the script writers thread rather than mine as the only scripts i've ever made were mainly code from other writers put together to make a script and something tweaked so it works.

    But still doesn't solve my issue. Do you know if there is a guide out their that if i uninstalled everything of simba from my computer i could re-install it? I think that might fix my problem.

  24. #24
    Join Date
    Mar 2013
    Posts
    85
    Mentioned
    1 Post(s)
    Quoted
    21 Post(s)

    Default

    the problem was, when it checked for HP it wasn't going to the Stats tab and kept eating.

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
  •