Results 1 to 11 of 11

Thread: ChooseOption not working

  1. #1
    Join Date
    Aug 2010
    Posts
    21
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default ChooseOption not working

    ChooseOption() Was working fine for the past few days as I was working on the script, I don't remember making any changes to the code but maybe I did. Basically I need to right-click and choose deposit all. Some fixes I have tried are using an if... then statement involving the color of item and uptext, and checking if bank screen is open. I just extracted the part of the script not working:

    Simba Code:
    program ChooseOption;

    {$i SRL/srl.simba}

    begin
      SetupSRL;
      MMouse(267, 129, 3, 3);
      Wait(1500);
      Clickmouse2(mouse_right);
      wait(1500);
      ChooseOption('osit-All');
    end.
    Last edited by risingtide13; 04-21-2013 at 12:18 AM.

  2. #2
    Join Date
    Sep 2012
    Location
    Australia.
    Posts
    839
    Mentioned
    16 Post(s)
    Quoted
    225 Post(s)

    Default

    Why don't you try SRL's DepositAll; procedure?

    Simba Code:
    (*
    DepositAll
    ~~~~~~~~~~

    .. code-block:: pascal

        function DepositAll: Boolean;

    Deposits all items in your inventory.

    .. note::

        Author: Shuttleu
        Last Modified: January 08, 2012 by Coh3n

    Example:

    .. code-block:: pascal

        DepositAll();
    *)

    function DepositAll: Boolean;
    begin
      if (InvEmpty) then
      begin
        Result := True;
        Exit;
      end;

      QuickDeposit(SRL_DEPOSIT_ALL);
      Result := WaitFunc(@InvEmpty, 50, 3000);
    end;

  3. #3
    Join Date
    Aug 2010
    Posts
    21
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    I'm not depositing all, i'm depositing all of a certain item but not my entire inventory. I have also tried

    Simba Code:
    Deposit(SlotFrom, SlotTo: Integer; vType: Variant)


    This procedure only works if I want to deposit each one by one. When I use Deposit() to deposit all, it only right clicks on the item, but does not choose all, as mentioned in my original post.

  4. #4
    Join Date
    Sep 2012
    Location
    Australia.
    Posts
    839
    Mentioned
    16 Post(s)
    Quoted
    225 Post(s)

    Default

    This is one of my banking procedures for my willow chopper:

    Simba Code:
    procedure DepositStuff;
    begin
      if BankScreen then
      begin
        repeat
          if not (LoggedIn) then
            LoginPlayer;
          if (ExistsItem(28) or (InvCount > 1)) then
          begin
            if Skiller then
              DepositOther(2, 28, True)  //I placed DepositOther (from bud_wis_er) at the top of my script so people don't have to update there banking.simba file to run the script.
            else
              DepositAll;
            Wait(RandomRange(500, 75));
            Writeln('Depositing inventory.')
          end;
        until (InvCount = 1) or (InvCount = 0)
      end;
      Inc(Loads);
      if Random(2) = 1 then
        CloseBank;
    end;

    Here is DepositOther:

    Simba Code:
    procedure Deposit(SlotFrom, SlotTo: Integer; vType: Variant);
    var
       DepositX, BScreen, DScreen, f: Boolean;
       All: Variant;
       I, T, x, y, c, j: Integer;
       B: TBox;
       Options: array of TOptions;
    begin
      BScreen := BankScreen;
      if (not(BScreen)) then
        DScreen := DepositScreen;
      if not (BScreen or DScreen) then
        Exit;
      if vType = 2 then
        srl_Warn('Deposit', '2 now means store per 2, not ''All''', 15);
      DepositX := False;
      if VariantIsInteger(vType) then
      begin
        DepositX := not InIntArray([1, 5, 10], vType);
        All := vType <> 1;
      end
      else if VariantIsBoolean(vType) then
        All := vType;
      if (SlotFrom = 1) and (SlotTo = 28) and (All = true) then
        if DepositAll then
          exit;
      for I := SlotFrom to SlotTo do
      begin
        if (BScreen) then
        begin
          If Not ExistsItem(I) Then
            Continue;
          if (not All) then
            MouseItem(I, mouse_left)
          else
            MouseItem(I, mouse_right);
        end else
        begin
          B := DepositItemBox(I);
          if (not(FindColor(X, Y, srl_outline_black, B.X1, B.Y1, B.X2, B.Y2))) then
            Continue;
          if (not All) then
            Mouse((B.X1 + B.X2) shr 1, (B.Y1 + B.Y2) shr 1, 0, 0, mouse_left)
          else
            Mouse((B.X1 + B.X2) shr 1, (B.Y1 + B.Y2) shr 1, 0, 0, mouse_right);
        end;
        if DepositX then
        begin
          WaitOptionMulti(['Deposit-X', 'Deposit'], 200);
          T := GetSystemTime;
          while (not FindColor(x, y, 8388608, MCX1, MCY1, MCX2, MCY2)) and (GetSystemTime - T < 3000) do
            Wait(100);
          TypeSend(vType);
        end else if VariantIsInteger(vType) then
          WaitOptionMulti(['Deposit-' + IntToStr(Integer(vType)), 'Deposit'], 200)
        else
        begin
          // Starting my code
          wait(2000);
          Options := GetChooseOptions('All');
          if (Length(Options) < 1) then
            Break;
          c := High(Options); ;
          f := False;
          for j := 0 To c do
          begin
            if ArrInStr(['All'], Options[j].Str) then
            begin
              writeln('Option all found, clicking');
              ChooseOptionMulti(['Deposit-All', 'All']);
              f := True;
              Break;
            end;
          end;
          if (f = False) then
            ChooseOptionMulti(['Depo' , 'osit']);
        end;
          // Ending my code
        T := GetSystemTime;
        Wait(RandomRange(200, 300));
        repeat
          if (BScreen) then
            if (not(ExistsItem(I))) then Break;
          if (DScreen) then
            if (not(FindColor(X, Y, srl_outline_black, B.X1, B.Y1, B.X2, B.Y2))) then Break;
          Wait(50);
        until(GetSystemTime - T > 2000);
      end;
    end;

    You can find the post about it here: http://villavu.com/forum/project.php?issueid=50

  5. #5
    Join Date
    Jun 2012
    Location
    Howell, Michigan
    Posts
    1,585
    Mentioned
    34 Post(s)
    Quoted
    553 Post(s)

    Default

    Quote Originally Posted by Chris! View Post
    This is one of my banking procedures for my willow chopper:

    Simba Code:
    procedure DepositStuff;
    begin
      if BankScreen then
      begin
        repeat
          if not (LoggedIn) then
            LoginPlayer;
          if (ExistsItem(28) or (InvCount > 1)) then
          begin
            if Skiller then
              DepositOther(2, 28, True)  //I placed DepositOther (from bud_wis_er) at the top of my script so people don't have to update there banking.simba file to run the script.
            else
              DepositAll;
            Wait(RandomRange(500, 75));
            Writeln('Depositing inventory.')
          end;
        until (InvCount = 1) or (InvCount = 0)
      end;
      Inc(Loads);
      if Random(2) = 1 then
        CloseBank;
    end;

    Here is DepositOther:

    Simba Code:
    procedure Deposit(SlotFrom, SlotTo: Integer; vType: Variant);
    var
       DepositX, BScreen, DScreen, f: Boolean;
       All: Variant;
       I, T, x, y, c, j: Integer;
       B: TBox;
       Options: array of TOptions;
    begin
      BScreen := BankScreen;
      if (not(BScreen)) then
        DScreen := DepositScreen;
      if not (BScreen or DScreen) then
        Exit;
      if vType = 2 then
        srl_Warn('Deposit', '2 now means store per 2, not ''All''', 15);
      DepositX := False;
      if VariantIsInteger(vType) then
      begin
        DepositX := not InIntArray([1, 5, 10], vType);
        All := vType <> 1;
      end
      else if VariantIsBoolean(vType) then
        All := vType;
      if (SlotFrom = 1) and (SlotTo = 28) and (All = true) then
        if DepositAll then
          exit;
      for I := SlotFrom to SlotTo do
      begin
        if (BScreen) then
        begin
          If Not ExistsItem(I) Then
            Continue;
          if (not All) then
            MouseItem(I, mouse_left)
          else
            MouseItem(I, mouse_right);
        end else
        begin
          B := DepositItemBox(I);
          if (not(FindColor(X, Y, srl_outline_black, B.X1, B.Y1, B.X2, B.Y2))) then
            Continue;
          if (not All) then
            Mouse((B.X1 + B.X2) shr 1, (B.Y1 + B.Y2) shr 1, 0, 0, mouse_left)
          else
            Mouse((B.X1 + B.X2) shr 1, (B.Y1 + B.Y2) shr 1, 0, 0, mouse_right);
        end;
        if DepositX then
        begin
          WaitOptionMulti(['Deposit-X', 'Deposit'], 200);
          T := GetSystemTime;
          while (not FindColor(x, y, 8388608, MCX1, MCY1, MCX2, MCY2)) and (GetSystemTime - T < 3000) do
            Wait(100);
          TypeSend(vType);
        end else if VariantIsInteger(vType) then
          WaitOptionMulti(['Deposit-' + IntToStr(Integer(vType)), 'Deposit'], 200)
        else
        begin
          // Starting my code
          wait(2000);
          Options := GetChooseOptions('All');
          if (Length(Options) < 1) then
            Break;
          c := High(Options); ;
          f := False;
          for j := 0 To c do
          begin
            if ArrInStr(['All'], Options[j].Str) then
            begin
              writeln('Option all found, clicking');
              ChooseOptionMulti(['Deposit-All', 'All']);
              f := True;
              Break;
            end;
          end;
          if (f = False) then
            ChooseOptionMulti(['Depo' , 'osit']);
        end;
          // Ending my code
        T := GetSystemTime;
        Wait(RandomRange(200, 300));
        repeat
          if (BScreen) then
            if (not(ExistsItem(I))) then Break;
          if (DScreen) then
            if (not(FindColor(X, Y, srl_outline_black, B.X1, B.Y1, B.X2, B.Y2))) then Break;
          Wait(50);
        until(GetSystemTime - T > 2000);
      end;
    end;

    You can find the post about it here: http://villavu.com/forum/project.php?issueid=50
    'd me to it chris :P

  6. #6
    Join Date
    Aug 2010
    Posts
    21
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Looked into it and tried bud_wis_er's function, same problem... it opens up the ChooseOptions menu but doesn't end up clicking all. Three different functions and same result, could it be that it isn't recognizing the font or something like that?

  7. #7
    Join Date
    Sep 2012
    Location
    Australia.
    Posts
    839
    Mentioned
    16 Post(s)
    Quoted
    225 Post(s)

    Default

    If your script is for OSR (2007), then you need to install the 07 fonts! You can find them here: http://villavu.com/forum/showthread.php?t=99992 down in the Quick Guide on OSR installation section.

    If your script is for EoC - I have no idea.

  8. #8
    Join Date
    Aug 2010
    Posts
    21
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    It's for EoC, meh getting frustrated I'll take a look at it later. Thanks though Chris!

  9. #9
    Join Date
    Jun 2012
    Location
    Howell, Michigan
    Posts
    1,585
    Mentioned
    34 Post(s)
    Quoted
    553 Post(s)

    Default

    Quote Originally Posted by risingtide13 View Post
    It's for EoC, meh getting frustrated I'll take a look at it later. Thanks though Chris!

    Did you change the CTS in your script?

    Try calling a procedure like this

    Simba Code:
    Writeln(getuptext);

    To see the uptext, also make sure you reset your CTS settings to normal.

  10. #10
    Join Date
    Aug 2010
    Posts
    21
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Issue was resolved kinda, sorta... it works if I run it through SMART, but not if i run it on a webpage, which really isn't that big of a deal.

    Thanks for the help.
    Last edited by risingtide13; 04-21-2013 at 04:00 AM.

  11. #11
    Join Date
    Mar 2007
    Posts
    393
    Mentioned
    1 Post(s)
    Quoted
    98 Post(s)

    Default

    You can try:
    Simba Code:
    WaitOption('option',1000);

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
  •