Results 1 to 3 of 3

Thread: DoorOpener;

  1. #1
    Join Date
    Dec 2006
    Location
    Third rock from the sun.
    Posts
    2,510
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default DoorOpener;

    Hello

    I used to hate doors, but in the past few days I seem to have past a milestone in SCAR scripting

    Anyways, this procedure is really easy to use.

    All you have to do is put in the color of the door, and SCAR will open it for it.

    If it doesn't find the door (open/closed), it'll turn the camera after five tries.

    This is the procedure:

    SCAR Code:
    procedure DoorOpener(Color:Integer);
     var
     Tries : Integer;
      begin
       repeat
        Wait(500 + Random(100));
       if(FindColorSpiralTolerance(x, y, Color, MSX1, MSY1, MSX2, MSY2, 5))then
        MMouse(x, y, 1, 1);
        Tries := Tries + 1;
        if(Tries >= 5)then
         begin
          KeyDown(37);
          Wait(1000 + Random(500));
          KeyUp(37);
          Tries := 0;
         end;
       until(IsUpText('Door') or IsUpText('Gate'));
        if(IsUpText('pen'))then
         begin
          Mouse(x, y, 0, 0, False);
          ChooseOption(x, y, 'pen');
          Writeln('Found closed door.');
          Writeln('Opened door.');
         end;
        if(IsUpText('Close'))then
         begin
          Writeln('Door was already open.');
          Exit;
         end;
      end;

    This is the short procedure, the part you need:

    SCAR Code:
    DoorOpener(ColorHere);

    Have fun with it

    Tell me if you find any bugs.

    BTW:

    Is this the right board to post stuff like this?

  2. #2
    Join Date
    Sep 2006
    Location
    New Jersey, USA
    Posts
    5,347
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Nice, but a two-color version would be nice; search for the main color, then search for a secondary color within a 50-100 radius circle around it

    could be pretty useful with a little bit of tweaking
    Interested in C# and Electrical Engineering? This might interest you.

  3. #3
    Join Date
    Dec 2006
    Location
    Third rock from the sun.
    Posts
    2,510
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    You can do that? I had no idea...

    Mind giving me an example?

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
  •