Results 1 to 9 of 9

Thread: little memory blank for case =p

  1. #1
    Join Date
    Feb 2012
    Posts
    224
    Mentioned
    1 Post(s)
    Quoted
    8 Post(s)

    Default little memory blank for case =p

    what i want to do is to mak is do 0,1,2,3 in order. to what do i write?
    ex:

    case random(3) of -> execute randomly 0 to 3
    case (3) of -> execute 3

    what do i write there to make it do 0,1,2,3 in order?

    (sorry for the noob question)

  2. #2
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)

    Default

    Quote Originally Posted by ogustuce View Post
    what i want to do is to mak is do 0,1,2,3 in order. to what do i write?
    ex:

    case random(3) of -> execute randomly 0 to 3
    case (3) of -> execute 3

    what do i write there to make it do 0,1,2,3 in order?

    (sorry for the noob question)
    sorry, I cannot comprehend what you're asking. Could you try re-phrasing and giving more detail? Using complete sentences usually helps. "to what do i write" isn't possibly understandable. I'd love to help

  3. #3
    Join Date
    Feb 2012
    Posts
    224
    Mentioned
    1 Post(s)
    Quoted
    8 Post(s)

    Default

    hmm okay, ill try. lets take this procedure :
    Simba Code:
    Procedure BankMap;
    Var
    x,y,InBank: integer;
    aFound:extended;
    Begin
      if (LoggedIn) then
     begin
      writeln('Dont see bank, trying again');
      case random(3) of  //what should i write there to make the script do 0,1,2,3  in order instead of random
        0: begin
        writeln('try1');
        ToPot := [Point(2300, 3323)];
          SPS_WalkPath(ToPot);
          Wait(RandomRange(2000,3000));
            end;
              1: begin
              writeln('try2');
              ToPot := [Point(2313, 3323)];
            SPS_WalkPath(ToPot);
            Wait(RandomRange(2000,3000));
              end;
                2: begin
                writeln('try3');
                  ToPot :=  [Point(2290, 3322)];
                SPS_WalkPath(ToPot);
                Wait(RandomRange(2000,3000));
                end;
                    3: begin
                writeln('try4');
                InBank := DTMFromString('mQwAAAHicY2ZgYHgIxJ+B+DwQWzAyMCQDcRIQtzWWMCQK8zLMkhdlMALK8UMxIxIGAgA1mQbE');
                if FindDTMRotated(InBank, x, y, MSX1, MSY1, MSX2, MSY2, -Pi/4, Pi/4, Pi/60, aFound) then
                begin
                mouse(5,5,x,y,Mouse_left);
                wait(randomrange(1000,2000));
                end;
                FreeDtm(InBank);
                end;

      end;    
    end;
    end;
    Last edited by ogustuce; 12-10-2012 at 07:32 PM.

  4. #4
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)

    Default

    use a for loop


    Simba Code:
    procedure BankMap;
    var
      x,y,InBank: integer;
      aFound: extended;
    begin
      if (LoggedIn) then
     begin
      writeln('Dont see bank, trying again');
      for i := 0 to 3 do
      begin
        case i of  //what should i write there to make the script do 0,1,2,3  in order instead of random
          0: begin
              writeln('try1');
              ToPot := [Point(2300, 3323)];
              SPS_WalkPath(ToPot);
              Wait(RandomRange(2000,3000));
             end;
          1: begin
               writeln('try2');
               ToPot := [Point(2313, 3323)];
               SPS_WalkPath(ToPot);
               Wait(RandomRange(2000,3000));
             end;
          2: begin
               writeln('try3');
               ToPot :=  [Point(2290, 3322)];
               SPS_WalkPath(ToPot);
               Wait(RandomRange(2000,3000));
             end;
          3: begin
               writeln('try4');
               InBank := DTMFromString('mQwAAAHicY2ZgYHgIxJ+B+DwQWzAyMCQDcRIQtzWWMCQK8zLMkhdlMALK8UMxIxIGAgA1mQbE');
               if FindDTMRotated(InBank, x, y, MSX1, MSY1, MSX2, MSY2, -Pi/4, Pi/4, Pi/60, aFound) then
               begin
                 mouse(5,5,x,y,Mouse_left);
                 wait(randomrange(1000,2000));
               end;
               FreeDtm(InBank);
             end;
          end;
        end;
      end;
    end;

    it'd be even better to create an array of points and then loop through the array to walk to them. However the above uses the logic you requested
    Last edited by footballjds; 12-10-2012 at 07:39 PM.

  5. #5
    Join Date
    Feb 2012
    Posts
    224
    Mentioned
    1 Post(s)
    Quoted
    8 Post(s)

    Default

    kk thanks!

  6. #6
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    As what footballjds said you could also do something like this

    Simba Code:
    procedure this;
    var
      Points: TPointArray;
      i: integer;
    begin
      Points := [Point(150,150), Point(200,200), Point(350,350)];

      For i := 0 to high(Points) do
      begin
        writeln('Attempting to SPS walk to bank attempt number '+tostr(i));
        sps_walktopos(points[i]);
        while ismoving do
          wait(100 + Random(100));
        end;
    end;

  7. #7
    Join Date
    Feb 2012
    Posts
    224
    Mentioned
    1 Post(s)
    Quoted
    8 Post(s)

    Default

    doesnt really fit in my script but thanks =)

  8. #8
    Join Date
    Jul 2012
    Posts
    279
    Mentioned
    5 Post(s)
    Quoted
    46 Post(s)

    Default

    I'm not use what your procedure is about. Are you trying to walk to bank and the script is coded to try to go from different locations? If so, I would add a Break; to the loop to avoid any possible issue/save memory.

    I would write something like:

    Simba Code:
    procedure BankMap;
    var
      i, x, y, InBank: integer;
      aFound: extended;
      TPA : TPointArray;
    begin
      if not (LoggedIn) then
        Exit;
      TPA := [Point(2300, 3323), Point(2313, 3323), Point(2290, 3322)];
      writeln('Can''t see the bank, trying again');
      for i := 0 to high(TPA) do
        begin
          writeln('Attempt ' + IntToStr(i + 1));
          ToPot := TPA[i];
          SPS_WalkPath(ToPot);
          Wait(RandomRange(2000,3000));
          InBank := DTMFromString('mQwAAAHicY2ZgYHgIxJ+B+DwQWzAyMCQDcRIQtzWWMCQK8zLMkhdlMALK8UMxIxIGAgA1mQbE');
          if FindDTMRotated(InBank, x, y, MSX1, MSY1, MSX2, MSY2, -Pi/4, Pi/4, Pi/60, aFound) then
            begin
              mouse(5, 5, x, y, Mouse_left);
              wait(randomrange(1000,2000));     //Is this waiting for the bank to bank? You might prefer something like WaitFunc(@BankScreen, 10, 3000);
              FreeDTM(InBank);
              Break;
            end;
        end;
    end;

    I'll repeat a tip that I read on another thread that helped me a great deal. Don't just copy the procedure (anyway I probably made it typo somewhere). Try to understand it.
    Last edited by Wardancer; 12-10-2012 at 08:37 PM.

  9. #9
    Join Date
    Feb 2012
    Posts
    224
    Mentioned
    1 Post(s)
    Quoted
    8 Post(s)

    Default

    its a failsafe actually. the SPS(point) at the bank is inaccurate. sometimes it clicks right and lead inside the bank but sometimes its off and click outside the bank. my idea was: if cant find bankbooth dtm then begin the failsafe procedure to lead inside the bank.

    the dtm 'inbank' was DTM to find on the mainscreen that is inside the bank in case that the sps failsafes fails

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
  •