Results 1 to 10 of 10

Thread: Running Script however it does nothing!?!

  1. #1
    Join Date
    Jul 2007
    Posts
    18
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Running Script however it does nothing!?!

    My script is for Gunslinger http://www.mousebreaker.com/games/gunslinger/play.php

    I have written it so that (I think?) it searches for a BMP which is the man's hand next to his gun. When the image is found, I want it to press the SpaceBar. The script comiles fine, however when the man reaches for his gun (and therefore the BMP can be found) the script doesn't press the Space Bar?

    Code:
    program GunSlinger;
    
    var
    reach,x,y: integer;
    
    
    procedure LoadBmp;
    begin
      reach := BitmapFromString2(False, 'a7315E78DAED58DB92EB280C' +
           'FC251017C3E3863DFCFF27AD446347C4B18F4926A9795854A39A7' +
           '230B4A5D6058C59C7E24465621D6F41F4624567791EFF24D6BE8A' +
           '2E399592B3739FD366727C0EC93F6129947F0F9EDF669FFFF17C1' +
           'FCFADA64A35E78528A6640DD12C1ECF716CC9BC31888C37877191' +
           '4ACA3481279924700AAF78C95631FAE21C3499E06DB3588C7BEDB' +
           'D49C476B2BC36EC761D15E65F4175B4FB9176BCAEADA24D9DF5DD' +
           '4241BEE647F12C35301AB665E4578FAC41295001EBC4F1E4F5AFF' +
           '896EB78C4B6A1625FFCAF7F955D7CB1D93A139F588067DB6AA208' +
           'CF116903188013BE83DFCFF1308F93196241AC609D9E634D2093F' +
           '6B1D931B6DA386CE045C888083AD3B99DBC4D648FF088FD6D47AB' +
           'ADDDEB73B3156682F97B3CF02039113D6C9350457C14816D51DD1' +
           '0ADFBF802660EB00756601770F81C0FEF514DA622A2F1743BB7E7' +
           'B10D5B45641D9BF52E1A15AC715EA3796DFE36D84AE3419EE4F55' +
           '8DC6E9015C1FC90459CC443E70FFB846D006CEB2E6791327043D8' +
           '35783CD98597D336770783DF94C4088637886392655EF52747913' +
           '29B81F1BDD4E489959A743C4DB6DD459A07354070F8353CDD7A58' +
           '3F8A90C4731DF044918E04D94061D04CBBB37A65D76B7AC8BD4E4' +
           '4DBCA9626C0D0988658D37E54FE2A88AFF7BB8B7D9643E6814D20' +
           '3A0F4852DAA5A0ED494A52DDC14F440DB4E729D6483DB5C3DBE82' +
           '506DFB59944D6AF3973FD6AB6581C0BB954569EC92B3A6BF3713E' +
           '9C1DC070D88F497E163CD5883DB63D7C9498949DF95755CF7ACD6' +
           '23E87AC7B8F5462F6BD5A414B86F734D47A7CC5A9AF5BCD3141EA' +
           '57DFB7BDD19140BB7CAFFAB3F55DD75C706FEFB5BD7DB02FE3606' +
           'CBE08428D878ADDFAA2F37DD1831D372B679691C07E78D7376A2B' +
           '241BE9EDB3FE506BFECB14F759F47AA692DE8D2BAC975C0CE6682' +
           '4816BDD8A30D0D9B9B1D7D0A6D1CF4CC73E6F469577E14E0848C0' +
           '108D47735BDB0A9970B61F3ED7AD4F62EB4AD6669BA695CF1B5BE' +
           '2E8A9C1778A09D2D09BF23E1E8EC6AD7F00357A1CB99653E2BDA7' +
           '07668D67CF58275159833475A5254BBA9E735260B654B6881F398' +
           'C7D8F4F58F73C7B3DC6D188B69CE38ECE924BF675DCD927F233D9' +
           '15BD1FBA2C9DFDB4C6AFAA938C4FBAA6C6619D4990FD105F13787' +
           '6BDE2F940BF24D99B9E7058470D38FCCEF9DD663E3BC4903DD9A8' +
           'A31EA71527E7E843B6C7C29E5A7B06956D347BBF73BFE1BDEE11E' +
           'EFCD451D3F84ADFC1337ADFE65D45F0DFB54FBF2568B552234147' +
           '313BC01664E9D9BB146D9FBD65F0C4CE725ACE30FE1D8BF53CB3E' +
           'B2286AC38E130C927B0D2745DC0EDC169669885B3CF24D735BE82' +
           'FB10CED83E3A741012E285BD2F27F4C78EE5637CD6E768DF06CE3' +
           '2FB7BAAEFE0C1BE38376D673DF68EEE5BCEBDF95378FA4DE0BD67' +
           '84952CEE735EB30C3A8ACFDD3F3F60FEEBD0F33F8147DF655DF7D' +
           '1E7F020667F0F1E7DBF348B27F9C43CDCB41939F96A85BDDE82D9' +
           '073CB7856BD6BFB75B2AF4A717C69FAAB0978A95DC65BD96A9BE3' +
           '3FE0385B');
       end;
    
    procedure shoot;
      begin
      wait(10);
      SendKeys(' ');
      wait(10);
      end;
    
    procedure FindBmp;
    begin
     if (FindBitmap(reach,x,y))then
     begin
      shoot;
      end else
      FindBmp;
      end;
    
    begin
     LoadBmp;
     FindBmp;
    end.
    I want the script to keep searching for the BMP until it is found, that is why I have put 'and else FindBmp;'.

    Can anyone help me?
    TOTAL N00B at Scar. I once had a script that cut, strung and fletched 10,000 + yew bows, but those days are now gone, and I'm trying to re unite my knowledge of scripting again.

  2. #2
    Join Date
    Apr 2007
    Location
    Texas
    Posts
    1,668
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Your bitmap is HUGE, it will take a long time for it to search for it.

    and if the head is moving, it probly wont find it.

    You can imporive you chnaces by mabey make it only a bitmap of his eyeball, and make the rectangle it searches in allot smaller.
    Edit: yeah, use findbitmapToleranceIn
    itss a better search method.
    [IMG]http://farm3.static.flickr.com/2120/2052732965_348f3629d0_o.jpg[/IMG]

  3. #3
    Join Date
    Jul 2007
    Posts
    18
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Man it still doesn't work!

    [EDIT]
    Now I get a Runtime Error, can anyone fix this?


    SCAR Code:
    Successfully compiled
    [Runtime Error] : Exception: Access violation at address 00554898 in module 'scar.exe'. Write

    of address 01172074 in line 26 in script C:\Program Files\SCAR 3.10\Scripts\Will's Scripts\Gunslinger.scar

    Here is my modified script

    SCAR Code:
    program GunSlinger;

    var
    reach,x,y: integer;


    procedure LoadBmp;
    begin
        reach := BitmapFromString2(False, 'a459C278DAA58E4B0EC33008' +
           '44AF04838D6199A0E6FE478A891B15A94A379D919E2C3C7C886E0' +
           'D49382675EFC9C149CFBABE6C92B78B0745B8ABB64606ACEEAC88' +
           '2C8A402920E9CFEF739E850E9A8BD3459C53F83DC18C09709FD05' +
           '5914BEBBDF511F0DA6C8D0DBCE67FE7EBF6CA1DD611508E790FA7' +
           '7FE75BB0DF17563DE52BE90F9D19E');
       end;

    procedure shoot;
      begin
      wait(10);
      SendKeys(' ');
      wait(10);
      end;

    procedure FindBmp;
    begin
    if FindBitmapIn(reach,x,y,220,243,239,278) then
     begin
      shoot;
      end else
      FindBmp;
      end;

    begin
     LoadBmp;
     FindBmp;
    end.
    TOTAL N00B at Scar. I once had a script that cut, strung and fletched 10,000 + yew bows, but those days are now gone, and I'm trying to re unite my knowledge of scripting again.

  4. #4
    Join Date
    Dec 2006
    Location
    .̿̂̔͋͗̎̆ͥ̍̒ͤ͂̾̌̀̅
    Posts
    3,012
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Maybe you should search for a color.. Like check the brown color of his hand when he holds the hand up and when it disappears from the coordinate make SCAR send the space.. I think I'll make a script for this game too

  5. #5
    Join Date
    Apr 2007
    Location
    Texas
    Posts
    1,668
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Gof is right, color picking is alot faster.
    (and so is clikcMouse if you need speed)
    [IMG]http://farm3.static.flickr.com/2120/2052732965_348f3629d0_o.jpg[/IMG]

  6. #6
    Join Date
    Jul 2007
    Posts
    18
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    O.K I'll see if I can try and do FOG's method.

    Thanks people :-)

    [EDIT] Made a new script, still doesn't work;

    SCAR Code:
    program GunSlinger;

    var
    x,y: integer;

    procedure FindHand;
      begin
      if (FindColor(x,y,6724044,223,233,232,247)) then
      begin
      repeat
    FindColor(x,y,6724044,223,233,232,247);
      until (not(FindColor(x,y,6724044,223,233,232,247)));
      end else SendKeys(' ');
      end;

    procedure shoot;
    begin
    wait(5);
    SendKeys(chr(32));
    wait(5);
    end;

    begin
      FindHand;
      Shoot;
    end.
    TOTAL N00B at Scar. I once had a script that cut, strung and fletched 10,000 + yew bows, but those days are now gone, and I'm trying to re unite my knowledge of scripting again.

  7. #7
    Join Date
    Apr 2007
    Location
    Texas
    Posts
    1,668
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    even faster would be something like
    SCAR Code:
    repeat
      wait(1);
    until(getColor(223,233)=6724044)
    [IMG]http://farm3.static.flickr.com/2120/2052732965_348f3629d0_o.jpg[/IMG]

  8. #8
    Join Date
    Jul 2007
    Posts
    18
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    O.k I've done it now, thanks for your help guys! And GoF well you just make me look like a total noob (well I am) but your script is amazing.

    program GunSlinger;


    procedure FindHand;
    begin
    repeat
    wait(1);
    MoveMouse(230,252);
    until (getColor(230,252)=3757682);
    end;

    procedure shoot;
    begin
    wait(1);
    SendKeys(' ');
    wait(1);
    end;

    begin
    FindHand;
    Shoot;
    end.
    TOTAL N00B at Scar. I once had a script that cut, strung and fletched 10,000 + yew bows, but those days are now gone, and I'm trying to re unite my knowledge of scripting again.

  9. #9
    Join Date
    Apr 2007
    Location
    Texas
    Posts
    1,668
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    fix your standards :P
    then it looks good
    [IMG]http://farm3.static.flickr.com/2120/2052732965_348f3629d0_o.jpg[/IMG]

  10. #10
    Join Date
    Jul 2007
    Posts
    34
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Greg are you mad at me or something, why arn't you on gmail?

    Thanks "Lordgreggreg" For The Singnature!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. running script help
    By deh miner1 in forum OSR Help
    Replies: 2
    Last Post: 07-25-2008, 01:45 AM
  2. Help running script
    By Alco13 in forum OSR Help
    Replies: 4
    Last Post: 04-27-2008, 07:11 PM
  3. Replies: 8
    Last Post: 03-23-2008, 04:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •