Results 1 to 4 of 4

Thread: Script problems.

  1. #1
    Join Date
    Jan 2010
    Location
    U.S.
    Posts
    72
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Exclamation Script problems.

    The script (it's for a flash game) I'm also using Scar Divi 3.22

    Code:
    program Test;
    
    var i, x, y, accept, fire, bandage, divi, tefl, spher  : Integer;
    
    procedure LoadBitmaps; //All the bitmaps for the procedures.
    begin
      accept := BitmapFromString(49, 10, 'beNrNkeFKAlEQhZ/KCCMUQw' +
           'xhHySWTWQzn8VyN1d7mEzXtbfpT9EHB4bp3vX/DofhzJlv7oImyVW' +
           'v1zVdd69u+v1YP9+/69XaxvQhZSQMcvzxoyakw+jQC8AO/XmAIf/1' +
           '26iKl0KYxizN8PW+JqfjScjlCcUzEiqJX5PXSevK13AwCARWvpb0W' +
           'fbIKE+PMRSH9f4ELPGCzrX1Ph5Nd6OR16bYnD4bDB2vhMMAQ4QCgt' +
           'ALQOde/lutL4//V3No/DlJVVaYfJ4HJCFwHML7ROd0FDyi1Tiq+8n' +
           'EtMifYLZvW0me3IwBeAE6bA5neduaPBbo0mrq6nz8QvH4vFhi9Lt5' +
           'YFe92+8JQxL8RwBipm11aZV0rf4AiCeBcg==');
      fire := BitmapFromString(13, 7, 'beNoNzU8oQwEcwPHvZo1s5s3wj' +
           'NnB/HtiU8oSJSInRZHLbs5ODi6KUm6ztMOmN8ommyUbipFwpHal5G' +
           'AuQo7KhX7e/fPta2XbyW4FOZXfkO9vuuajjxsolHHsRnbmJDYWtqM' +
           '72ADdwuskstj25OHWxJWLCw1Ja5IP5v3oNhJmMs1c9yKrnaUg9+W8' +
           '+KwHtUhYlctWyXXHFeJmnkfsR4ZJDct8XbGKz4CaNSHLlaJXy8lAV' +
           'CVm53HUqAblbFw2m96GKHWQha+ZellxyGkw0UhM4TxgmJ7vBbfs+Y' +
           '38J+TO2HiYQNb87yGloJFUOGxBoh6JeNPtyJKzNEWqgaJhIl0SDuy' +
           'rbFlIuoy7VzL9d7Os/wMNXWmN');
      bandage := BitmapFromString(17, 9, 'beNoBywE0/p5kpIBXsoxep4' +
           'FTn3xNu5tr07SB3b6H47+G37h616xw265y4LF25bN5365x26hs4q5' +
           'w4apswKJ7uJdtu5pwtJdqrpFkoIBQrYxWyaRp2a9w4bV216pw1Kdt' +
           '2qty361z2aZq3alr3qdpuZx3vqJ6vKJ6u6F3up5ywqJ0vZlkpn1Dt' +
           'YlKz6Fh5bh+3K921aZu3atz3Khv2qZq3qVps5p2r5ZyrpdytJt1uq' +
           'B2s5NntI9d3rV79MaIv45Ry55l4rR+2qtz26lx3alw2aVp3qVpspt' +
           '3tp97taF8uaJ9rZNruZlt6sWT5buEzZ5j6LZ8ilwmz6Nv2qx21aZu' +
           '3Khx2aRr3KNptp15r5h0r5t2s5x3tpt25MOZ+tWk+c+a67yD7L2E5' +
           'bmFmGw61adz0KBr1aFq1J9m155ksZZxuaB8tZ55sJdz6s6m89Ko99' +
           'Gj06p5/9Sg+MqWzaJy4baGroJQ4bF+16Vu3Kdu3KNptZdur5Nrtpl' +
           '06c2l8dOsyah+/9ux98+i+M6h/+Gx/9eq/9mszqFyuIpY1aJuy5Zf' +
           '0plfsZBkuplv68qg99as8c+n/9609tKp/920/dmwxp938sqh982i0' +
           'qd4xJZkv4xY0Jtk15VpKPo=');
      divi := BitmapFromString(19, 8, 'beNodkd1LWnEYx/+zsYsuqkE3hW' +
           'ITc2AwX4Ye3YEI0y4iGGOXG0HSRbQ20VHQmgvKrVMnW5qTFW3rzcq' +
           'U+VJHz4vneM7v9N1Pb56LB76fD9/n2Ue9g+saWV/b0UTMTp85R3nb' +
           '0Adr39zTR+/sjxftgxsuO8cy6ZaElbXyTQ0iQUmAP/i1okEFbkt16' +
           'IjFBK/7p20kbhmYd/QtPOuPjw2n3eOZ5aV/korTIiSCmozjIvzM5h' +
           '3QBgzjoaPg4gr+UMblSo1Zko6B984nCYd1g2UPzi4hamiqXZ2o4+A' +
           'XgqHdawXVtmkCsgJBxeu3eY930zmaGrd8eW5bZxju1ZtDWYdiQjah' +
           'AJKOT5+V6PRRoQyJSglIT11sIDTB+by5gDsX8HL+lyuVVhdI60gm7' +
           'jUUTrCclIKh/e1j/K1CNCATIkKkzK09sJNHHl92MpJPcXWKpSm5N8' +
           'sC+CwWPwoBZjeRVn9XcU+6+zYkKr1t4VsW4dk/Wz9Q66Chm2ovRXX' +
           'nFXzPaFMzfP0OgyMvHO6Ij42y4WgHEAz6FhRKWOWRu0IT3V5t6OKD' +
           'UWqQ3IkcW8rT2/L/AeoDaG4=');
      tefl := BitmapFromString(14, 10, 'beNorb4kpbjhy+9nTP//f/f8f' +
           'V9qQUN4UU9YUXdpoHhgrYWSnZOkmrmctZWgnbWRf1DntzX+Qstf//' +
           '0cX1UbkVwVklXkm58uaO8uYOcmaOIrpWskYOwDR41//l+45nt3U2z' +
           'xrKRDFlzUCDTTyiVCx8xIzsBHVsQQqljSwBZpc1juretLczIZuoL0' +
           'F7ZPyWifElje7JeQAzQSqBCoDmiasZQ5UmdnQm982MaW6DehIoIFA' +
           'MrK4HuhU/8xSbddAEW0LoDItR7+Q7IrkqnagsrTaDqCy2JJ6oMqoE' +
           'hBKrG73SSvySS7wiM/xTsr3TSlMr+tOrmrNqO9KrGgGMoAqgbaH5F' +
           'UBEdDBUYV1kQW1QGXBWeUZ9T1AZUBjQeFTXBeSXQa0HagmrKAGqBi' +
           'oAGhgeF61a0ymoa2zib0rxPbQnPKowprA7PKgnAqgeiAZllsFUeYQ' +
           'nvL/zEwGMADaHp5XCVQPDE+gMqCZwbmVngm5Xol5QZllCQADjqpZ');
      spher := BitmapFromString(15, 11, 'beNodzklvEgEAhuGpLUUhTXo' +
           'yMdGD/8Bf4EHjwVPTxJsHE6819WRtrNsBbRQ3iNKQitW0JMVaU4o2' +
           'YsGC7TSIrAVmWIayw8AMnYFhCXXks/G9P8l70Xv5of/GE3bzIxLr+' +
           'GUG50bS3GGdyEeQSYHy9bg4ij+7ohd8AI5V7Czg+fnsVYVxeTJUt6' +
           'OydCh+hZhAOo5CBnSgw0chRMAF8eBM2HCu8ng0MnuWdGqrogdpQx0' +
           'bOPiGIolCCoUc0uEWG+vngrJeybxWZ18pmVvHN2QPYqtCYU5sv0fP' +
           'BtmP+j7y+y0+f1impCotG5VV0+jBLJHSnPTKP7D3rlzW1+UPaCwCu' +
           'xDopljkBIaVGJ4L1cwn+LeK0jMiPaPe6a2jtNwv6qS2qf/XCskuS5' +
           'G2xAh8jBUooUl1LUTcRIRN6tL04Jb5ShIuVOaRfMEJq52aTSx+l1o' +
           'xtBk0khBisA0nrKrMm2O0RuW7OWKxXsvjC/Lz/dxSnV7MtUnQn7s5' +
           'ErUoUtvQEa6XxLaW+K0Z8NxXOm6PrK2MZeBH5dPRfzGz0uC2kD0ib' +
           'ohxXBq4PqaafDoUeDQUuEvsTg06751ymcczIFGx4M8mGnaAQnQNDr' +
           '0En5H43xThmVbszaipiWH3ndPk3IUQa0BzASktamYYxoO6f853aZ0' +
           '=');
    end;
    
    procedure FireProc; 
    //Executes an infinite amount of times after the DivinityProc procedure which is my problem.
    //As a note, it does not go back to the DivinityProc procedure after executing the second time, it just repeats itself.
    begin
    repeat
      If (FindBitmap(accept, x, y)) Then
      MoveMouseSmooth(x, y);
      wait(2 * 500+random(50));
      ClickMouse(x, y, True);
      Wait(2 * 100+random(50));
      If (FindBitmap(fire, x, y)) Then
      MoveMouseSmooth(x, y);
      HoldMouse(x, y, True);
      Wait(2 * 500+random(50));
      ReleaseMouse(x, y, True);
      Wait(6 * 1500+random(50))
      If (FindBitmap(bandage, x, y)) Then
      MoveMouseSmooth(x, y);
      Wait(2 * 150+random(50));
      ClickMouse(x, y, True);
      Wait(2 * 2000+random(50));
      Inc(i);
      until(i = 1); //Will change this value later.
    end;
    
    procedure DivinityProc; //Executes perfectly.
    begin
      Wait(2 * 500+random(50));
      If (FindBitmap(divi, x, y)) Then
      MoveMouseSmooth(x, y);
      HoldMouse(x, y, True);
      Wait(2 * 1000+random(50));
      ReleaseMouse(x, y, True);
      Wait(2 * 2500+random(50));
    end;
    
    procedure TeflonProc; //Does not execute.
    begin
      Wait(2 * 250+random(50));
      If (FindBitmap(tefl, x, y)) Then
      MoveMouseSmooth(x, y);
      HoldMouse(x, y, True);
      Wait(2 * 1000+random(50));
      ReleaseMouse(x, y, True);
      Wait(2 * 1000+random(50));
    end;
    
    procedure SphereProc; //Does not execute.
    begin
      Wait(2 * 250+random(50));
      If (FindBitmap(spher, x, y)) Then
      MoveMouseSmooth(x, y);
      HoldMouse(x, y, True);
      Wait(2 * 1000+random(50))
      ReleaseMouse(x, y, True);
      Wait(2 * 1000+random(50));
    end;
    
    begin
      LoadBitmaps;
      repeat
       FireProc; //Executes fine.
       DivinityProc; //Executes fine.
       FireProc; //Executes but repeats without stopping.
       SphereProc; //Does not execute.
       FireProc; //Does not execute.
       TeflonProc; //Does not execute.
      until(false)
    end.
    My intentions for this script would be the FireProc procedure going through then using the DivinityProc procedure once returning to the FireProc, then once the second FireProc command is executed a second time to move to SphereProc and so forth. My issue is it will do the first FireProc just fine, then it will do the DivinityProc just fine as well, goes back to FireProc and it repeats FireProc an infinite amount of times apposed from going to Sphereproc/Teflonproc/etc.

    What am I doing wrong here? I'm not sure what it is but I was wondering if somebody could tell me. Thanks in advance. (Sorry for making 2 threads, though it was for 2 separate questions)

    I've also tried making a FireProc1, FireProc2, and FireProc3 to see if that might make a difference if it's an interference but that didn't help either. Any assistance please?

  2. #2
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    Your problem is in the following var, i. It's zero in the beginning of the script. But you don't reset it to when you recall a function. So starting FireProc with i :=0; will solve your problem.

    Simba Code:
    procedure FireProc;
    begin
      i := 0;
      repeat
    Working on: Tithe Farmer

  3. #3
    Join Date
    Jan 2010
    Location
    U.S.
    Posts
    72
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by masterBB View Post
    Your problem is in the following var, i. It's zero in the beginning of the script. But you don't reset it to when you recall a function. So starting FireProc with i :=0; will solve your problem.

    Simba Code:
    procedure FireProc;
    begin
      i := 0;
      repeat
    Ah that's what I was missing! Thank you so much, maybe I should stop trying to script at night. Usually I do just fine making such scripts but I miss fine detail and mess something up and become confused over time.

    Once again thank you and I hope this thread can help others as well in the future.

  4. #4
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    Isn't this closer to what you want anyway?

    Simba Code:
    procedure FireProc;
    begin
      i := 0;
      repeat
        If (FindBitmap(accept, x, y)) Then
        begin
          MoveMouseSmooth(x, y);
          wait(2 * 500+random(50));
          ClickMouse(x, y, True);
          Wait(2 * 100+random(50));
          If (FindBitmap(fire, x, y)) Then
          begin
            MoveMouseSmooth(x, y);
            HoldMouse(x, y, True);
            Wait(2 * 500+random(50));
            ReleaseMouse(x, y, True);
            Wait(6 * 1500+random(50))
            If (FindBitmap(bandage, x, y)) Then
            begin
              MoveMouseSmooth(x, y);
              Wait(2 * 150+random(50));
              ClickMouse(x, y, True);
              Wait(2 * 2000+random(50));
            end;
          end;
        end;
        Inc(i);
      until(i>1);
    end;
    Working on: Tithe Farmer

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
  •