Results 1 to 8 of 8

Thread: Bot For Guitar Hero Like Game

  1. #1
    Join Date
    Jun 2009
    Posts
    23
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Bot For Guitar Hero Like Game

    I created a basic bot for a guitar hero like game, http://jamlegend.com but it was broken up into 3 scripts, 1 for each note.. At that point it did pretty good, scoring like 98-100% on easy songs. However I needed to make it get 100% most of the time on an easy song. I tried putting it all into script to make it a little nicer, but then it works a little worse, I'm guessing because it's not processing it fast enough?

    Here's my script:

    Code:
    program New;
    const
    KEY_ENTER = 13;
    KEY_1 = 49;
    KEY_2 = 50;
    KEY_3 = 51;
    KEY_4 = 52;
    KEY_5 = 53;
    
    var colorvar, xfound, yfound : Integer;
    
    begin
      wait(5000);
      repeat
          colorvar := GetColor(671, 462);
          if (FindColorTolerance(xfound, yfound, 8978376, 655, 450, 689, 470, 70)) or (SimilarColors(colorvar, 15791091, 60)) then
          begin
            KeyDown(KEY_3);
            KeyDown(KEY_ENTER);
            wait(5);
            repeat
              wait(55);
            until(not(SimilarColors(GetColor(671, 446), 3866588, 50)));
            KeyUp(KEY_ENTER);
            KeyUp(KEY_3);
          end;
          colorvar := GetColor(590, 462);
          if (FindColorTolerance(xfound, yfound, 8973055, 571, 450, 604, 470, 70)) or (SimilarColors(colorvar, 15791091, 60)) then
          begin
            KeyDown(KEY_1);
            KeyDown(KEY_ENTER);
            wait(5);
            repeat
              wait(55);
            until(not(SimilarColors(GetColor(590, 447), 4521983, 50)));
            KeyUp(KEY_ENTER);
            KeyUp(KEY_1);
          end;
          colorvar := GetColor(631, 460);
          if (FindColorTolerance(xfound, yfound, 16750060, 614, 450, 648, 4701
          , 70)) or (SimilarColors(colorvar, 15791091, 60)) then
          begin
            KeyDown(KEY_2);
            KeyDown(KEY_ENTER);
            wait(5);
            repeat
              wait(55);
            until(not(SimilarColors(GetColor(631, 449), 16743679, 50)));
            KeyUp(KEY_ENTER);
            KeyUp(KEY_2);
          end;
      until 1=2;
    end.
    It most likely won't work on other computers unless you have the same resolution as me because it uses specific coordinates. I'm kinda looking for other ideas, or another approach to this bot so I can make it work better. Any ideas?

  2. #2
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You could select the target window and then get the coords ;]

  3. #3
    Join Date
    Jun 2009
    Posts
    23
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by 99_ View Post
    You could select the target window and then get the coords ;]
    It will then work on all computers? I thought it would still be different since it's a browser game..

  4. #4
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yes, it would still work because the game is located within an applet (most likely).

  5. #5
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

  6. #6
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    What?

  7. #7
    Join Date
    Jun 2009
    Posts
    23
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Oic. I wasn't aware that you could select apps, I thought it only worked with windows. Shows my newby understanding of SCAR. Anyway, it seems like previous possible speed issues are fixed when I select the app and changed the coords, strange (probably just because of some unknown factor). There still seems to be a little bit of a problem. I've got to mess with it some more.. but I'd appreciate the help if anyone is willing. Things that have to be messed around with are the waits when a note is pressed, and possibly the tolerance of the colors being found.

    Current source:

    Code:
    program New;
    const
    KEY_ENTER = 13;
    KEY_1 = 49;
    KEY_2 = 50;
    KEY_3 = 51;
    KEY_4 = 52;
    KEY_5 = 53;
    
    var colorvar, xfound, yfound : Integer;
    
    begin
      wait(2000);
      repeat
          colorvar := GetColor(489, 286);
          if (FindColorTolerance(xfound, yfound, 8978376, 472, 295, 506, 305, 70)) or (SimilarColors(colorvar, 15791091, 60)) then
          begin
            KeyDown(KEY_3);
            KeyDown(KEY_ENTER);
            wait(160);
            repeat
              wait(55);
            until(not(SimilarColors(GetColor(490, 269), 3866588, 50)));
            KeyUp(KEY_ENTER);
            KeyUp(KEY_3);
          end;
          colorvar := GetColor(410, 286);
          if (FindColorTolerance(xfound, yfound, 8973055, 390, 295, 428, 305, 70)) or (SimilarColors(colorvar, 15791091, 60)) then
          begin
            KeyDown(KEY_1);
            KeyDown(KEY_ENTER);
            wait(160);
            repeat
              wait(55);
            until(not(SimilarColors(GetColor(410, 271), 4521983, 50)));
            KeyUp(KEY_ENTER);
            KeyUp(KEY_1);
          end;
          colorvar := GetColor(450, 288);
          if (FindColorTolerance(xfound, yfound, 16750060, 432, 295, 467, 305, 70)) or (SimilarColors(colorvar, 15791091, 60)) then
          begin
            KeyDown(KEY_2);
            KeyDown(KEY_ENTER);
            wait(160);
            repeat
              wait(55);
            until(not(SimilarColors(GetColor(449, 270), 16743679, 50)));
            KeyUp(KEY_ENTER);
            KeyUp(KEY_2);
          end;
      until 1=2;
    end.

  8. #8
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Shuttle, I still don't see what that has to do with anything at all.. >.>

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
  •