Results 1 to 11 of 11

Thread: Script will not fully run... How come?

  1. #1
    Join Date
    May 2008
    Location
    Canada
    Posts
    665
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default Script will not fully run... How come?

    This is a script i'm working on. Auto player for a FPS. right now it just runs the first 3 procedures, ignoring the other two. then stop. Can't find where my problem is.

    It runs up to:
    Procedure ClickingCombatArms;
    begin
    If (FindBitmap(CAicon,x,y)) then
    begin
    MoveMouseSmooth(x,y);
    clickmouse(x,y,true);
    wait(10+random(5));
    clickmouse(x,y,true);

    then just ends.
    Code:
    // Set computer to 32 Bit true colour and set game to 800 x 600 pixels.
    
    program CombatArmsAutoPlayer;
    {.Include SRL/SRL.Scar}
    
    const
    PlayerUser = ('');
    PlayerPass = ('');
    QuickJoin = 1721714;
    Full = 4670900;
    Busy = 1927334;
    Moderate = 1605737;
    Low = 8344347;
    Start = 2117255;
    
    var x,y,Timer1,Timer2,CAicon,CAstart,NexonLogoSmall: integer;
    
    //By: Da 0wner
    procedure iType(Text : string; WaitTime : integer; Return : boolean);
    var
      i: integer;
      s : string;
    begin
      s := '~!@#$%^&*()_+ABCDEFGHIJKLMNOPQRSTUVWXYZ{}|:"<>?';
      for i := 1 to Length(Text) do
      begin
        if  pos(Text[i], s) > 0 then
        begin
          KeyDown(VK_SHIFT);
          Wait(WaitTime + Random(15) + Random(50));
        end;
        KeyDown(GetKeyCode(Text[i]));
        Wait(WaitTime + Random(30));
        KeyUp(GetKeyCode(Text[i]));
        Wait(WaitTime + Random(30));
        if  pos(Text[i], s) > 0 then KeyUp(VK_SHIFT);
      end;
      if Return then
      begin
        Wait(10 + Random(30));
        KeyDown(VK_RETURN);
        Wait(10 + Random(30));
        KeyUp(VK_RETURN);
      end;
    end;
    
    Procedure BitMapSetUp;
    begin
    CAicon := BitmapFromString(18, 15, 'beNodjktTGgcAgMdjrUbDa4' +
           'Fl2WXZB+wuC6yLPFYMolEeAgHEB0UgJvKQSABBEpOmroPQ4lSpmrb' +
           'TxnaaTDJJppNLnY7ttDM5pD11Mp0e2mvrqf0XTfudvsN3+KzcGIdP' +
           'OaiAQEe95nrm8s2k99ZK8Egsb60t3s7HC4mJxuqV6wvT86HJSYHnz' +
           'aRarQI1UMDNZiPj8377ejrYvXX1Rsp3bz356KC5U0neeMdfSQfWkj' +
           'OtxtX3KqnF8KR7lDWzJlSPeR2mZHjibmnpwV7z2f3t7tb1+rVIORu' +
           'dnbDbLQxLG1EYJFFohMHHbWbOYl1IJOyciecdglOYmZ4OBYKzPn80' +
           'NMtbWQLWvAly+dKYMM4YDDYzSxOYEgAGBy/QRiOBqGmGM9Im1my1W' +
           'Ed43u50jjldbgwnM+mVzc0tweUSbDxrIPJL8d1mdSkeQxAdTlB6zA' +
           'hB2jdupJgR3mZ3CDTDwoheFHdXc0WvZyLs8/vHx8rL87t3ml8d9w4' +
           '6LYIgOAajcJhAQOnwkFImQWBEq0UwjMzlitVao3Kz2qzVNktrrUat' +
           '12l/fHh0/+DD4/09qwEeZVBYLZdeGEQBqUIByGQyVKeHdXrB7RHFn' +
           'efPv+58sLex0RTF1upyMhMLfbLfoTBIp1YMD/QDQwMqmVSpAkkQsG' +
           'MaHP5vHMWIaHSuUqmvFUq3c5mzTvHvnx4/+eyQ0ypw+ZBWOkio5Qp' +
           'AqVKqYyN4xmlIO6kFl0lgKQdLhx2WavjS6y93zr85/OflyZ+/vgxa' +
           'cB+LujAQhUBEp2cZU9bD7cSE/dTUw9KV0+2V79vFF1vpH7rrn+fDd' +
           '8NCd9l/eKfMaYGYzWAlMTWoAUGIMXGJuWQj4jnJz3737vLr49rvD7' +
           'fPv+2dn/bO2oV60BnnyGw6jcoluEp+8aJEC0JuEjKgKKLDrLimGbK' +
           '/2Ij//H7ul6Pqqbhyei/9tBJvL3oT0x6MpPrf6h94ewCUDPlIsHaJ' +
           'StkwRCEBgGEcVVSD/LNS8FUr81uv8Men5b/OvjipX2MJnDTS4v/09' +
           'fXNmXVzDJgb1edc5AwDQSoJoQeLkakHxcirbuHHdv6j7OV2KgBpNN' +
           'y/RpPwEw==');
    CAstart := BitmapFromString(9, 5, 'beNqr562tl6yqEa+oEgGisxf' +
           'Z4Ki9U/z8ZQ5kESA6d4nt/GV2IOPCFQ4g+8wFljMXWIEIWQ1EF1wK' +
           'zICyq2rEyiuFi0v5S8sFgWpOn2eB6K0FAOA2Q8A=');
    NexonLogoSmall := BitmapFromString(5, 7, 'beNq7oc/gOQEf6j3H' +
           'UHeAIXMtQ+Q8EHfuHTgyWL4GwlBZsWfiyaiDN/QllhyrPFQAZGBBA' +
           'DqvLsQ=');
    end;
    
    Procedure ClickingCombatArms;
    begin
      If (FindBitmap(CAicon,x,y)) then
      begin
        MoveMouseSmooth(x,y);
        clickmouse(x,y,true);
        wait(10+random(5));
        clickmouse(x,y,true);
      end else
        writeln ('Combat Arms could not be found');
        terminatescript;
      end;
    
    Procedure StartingCombatArms;
      begin
        repeat
          wait(1000);
          Timer1 := Timer1 + 1
          If Timer1 > 30 then
            Writeln ('CombatArms launcher could not be started, exiting script');
            TerminateScript;
        until (FindBitmap(CAstart,x,y))
        FindBitmap(CAstart,x,y)
        Mouse(x+random(2)-random(2),y-random(2),5,5,true);
        repeat
          wait(1000);
          Timer2 := Timer2 +1
          If Timer2 > 100 then
            Writeln ('CombatArms opening screen could not be started, exiting script');
            TerminateScript;
        until (FindBitmap(NexonLogoSmall,x,y))
    end;
      
    Procedure Login;
      begin
        FindBitMap(NexonLogoSmall,x,y)
        ///////////Clear the login////////////
        Mouse(x-485+random(4)-random(4),y-227+random(4)-random(4),5,5,true);
        KeyDown(VK_SHIFT);
        HoldMouse(x-250+random(4)-random(4),y-227+random(4)-random(4),true);
        KeyUp(VK_SHIFT);
        wait(50+random(50));
        KeyDown(VK_BACK);
        wait(50+random(25));
        KeyUp(VK_BACK);
        Mouse(x-487+random(4)-random(4),y-190+random(4)-random(4),5,5,true);
        KeyDown(VK_SHIFT);
        HoldMouse(x-250+random(4)-random(4),y-190+random(4)-random(4),true);
        KeyUp(VK_SHIFT);
        wait(50+random(50));
        KeyDown(VK_BACK);
        wait(50+random(25));
        KeyUp(VK_BACK);
        //////////////The Login///////////////
        Mouse(x-485+random(4)-random(4),y-227+random(4)-random(4),5,5,true);
        Writeln('Typing your username ' + PlayerUser);
        iType(PlayerUser,7+random(3),false);
        wait(250+random(250));
        Mouse(x-487+random(4)-random(4),y-190+random(4)-random(4),5,5,true);
        Writeln('Typing your password ' + PlayerPass);
        iType(PlayerPass,7+random(3),true);
        Writeln('Pressed Enter, and we are logging in');
      end;
    
    
    
    begin
      setupsrl;
      BitMapSetUp;
      ClickingCombatArms;
      StartingCombatArms;
      Login;
    end.
    Last edited by mrpickle; 05-14-2009 at 03:45 AM.

  2. #2
    Join Date
    Feb 2007
    Location
    South East England
    Posts
    2,906
    Mentioned
    2 Post(s)
    Quoted
    8 Post(s)

    Default

    EDIT: All your script does it load it then login, thats all it is coded to do at the minute.
    Jus' Lurkin'

  3. #3
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    begin
    setupsrl;
    BitMapSetUp;
    ClickCombatArms;
    StartingCombarArms;
    Login;
    end.

    you need a repeat


    T~M
    Aww man ToF <3

  4. #4
    Join Date
    Feb 2007
    Location
    South East England
    Posts
    2,906
    Mentioned
    2 Post(s)
    Quoted
    8 Post(s)

    Default

    It doesnt even need that, all his script is programmed to do with that code is to Load the Bitmaps, Click the Client, Load the Client then Login.
    Jus' Lurkin'

  5. #5
    Join Date
    May 2008
    Location
    Canada
    Posts
    665
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    samething happens =\.

    edit: Yes, it's just supposed to find client and login. Right now it just goes and clicks the client then stops. It doesn't even login or get to the login screen.

    The coordinates i've already calculated, but none of that code runs =\.
    Last edited by mrpickle; 05-14-2009 at 03:43 AM.

  6. #6
    Join Date
    Feb 2007
    Location
    South East England
    Posts
    2,906
    Mentioned
    2 Post(s)
    Quoted
    8 Post(s)

    Default

    It doesnt even need that, all his script is programmed to do with that code is to Load the Bitmaps, Click the Client, Load the Client then Login.
    ^^^
    Jus' Lurkin'

  7. #7
    Join Date
    May 2008
    Location
    Canada
    Posts
    665
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    Quote Originally Posted by Torrent of Flame View Post
    ^^^
    Yes, but it doesn't even get to the login. it only does the first part in loading the client, then exits....

  8. #8
    Join Date
    May 2008
    Location
    Canada
    Posts
    665
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    I kinda found the problem after isolating every little code and running each of them.
    This...
    Code:
    repeat
          wait(1000);
          Timer1 := Timer1 + 1
          If Timer1 > 30 then
            Writeln ('CombatArms launcher could not be started, exiting script');
            TerminateScript;
        until (FindBitmap(CAstart,x,y))
    was my way to wait for the game launcher to load and time out if waited longer than 30 seconds. but aparently it doesn't work. I replaced that with just a wait command, and wow, scar reads the rest of the script.

    Is there another way to wait for something to comeup or time out?

  9. #9
    Join Date
    Feb 2006
    Posts
    3,044
    Mentioned
    4 Post(s)
    Quoted
    21 Post(s)

    Default

    Not sure, but in some games you would need a different keyboard driver ( Shadow driver ) To use scar in it.. Not sure about this game..

    ~Home

  10. #10
    Join Date
    Oct 2007
    Location
    Denmark
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by mrpickle View Post
    I kinda found the problem after isolating every little code and running each of them.
    This...
    Code:
    repeat
          wait(1000);
          Timer1 := Timer1 + 1
          If Timer1 > 30 then
            Writeln ('CombatArms launcher could not be started, exiting script');
            TerminateScript;
        until (FindBitmap(CAstart,x,y))
    was my way to wait for the game launcher to load and time out if waited longer than 30 seconds. but aparently it doesn't work. I replaced that with just a wait command, and wow, scar reads the rest of the script.

    Is there another way to wait for something to comeup or time out?
    You terminate nomatter what. Replace with Break/Exit.

  11. #11
    Join Date
    May 2008
    Location
    Canada
    Posts
    665
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    Lets try it =D.

    Edit: It works! xD Thanks for your help! and thanks to other who tried to help =D.
    and that made it clear to me what terminate script does.

    p.s. A normal keyboard + commands works with this game =).
    Last edited by mrpickle; 05-14-2009 at 04:39 AM.

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
  •