Results 1 to 18 of 18

Thread: construction.scar

  1. #1
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default construction.scar

    hobbit told me to post these

    yes i know most of these are simple, and any one that knows how to script can do 'em, but no one has so far(that im aware of)

    SCAR Code:
    {*******************************************************************************
    function inhouseoptions: boolean;
    By: akwardsaw
    Description: It simply checks if your in the house options.
    *******************************************************************************}

    function inhouseoptions: boolean;
    begin
      result:= (getcolor(653, 280) = 2070783)
    end;

    {*******************************************************************************
    procedure Houseoptions(onoroff: boolean);
    By: akwardsaw
    Description: It either turns house options on, or off. true = on.
    *******************************************************************************}

    procedure Houseoptions(onoroff: string);
    begin
      gametab(11);
      case onoroff of
        true: begin
                case random(3) of
                  0..1: mousebox(685, 417, 711, 442, 1);
                  2: begin
                       mousebox(685, 417, 711, 442, 2);
                       chooseoption('Open House Options');
                     end;
                 end;
                 while not getcolor(657, 283) = 2070783 do wait(10 + random(30));
              end;
        false: case random(3) of
                 0..1: mousebox(714, 226, 728, 240, 1);
                 2: begin
                      mousebox(714, 226, 728, 240, 2);
                      chooseoption('Close');
                    end;
               end;
      end;
    end;

    {*******************************************************************************
    procedure buildingmode(onoroff: boolean);
    By: akwardsaw
    Description: It either turns building mode on, or off. must be in house options
    *******************************************************************************}

    procedure buildingmode(onoroff: string);
    begin
      if not inhouseoptions then Houseoptions('on');
      case onoroff of
        true: mousebox(657, 283, 602, 298, 1);
        false: mousebox(655, 300, 682, 325, 1);
      end;
    end;

    {*******************************************************************************
    procedure leavehouse;
    By: akwardsaw
    Description: It leaves the house. must be in house options
    *******************************************************************************}

    procedure leavehouse;
    begin
      if not inhouseoptions then Houseoptions('on');
      mousebox(563, 384, 718, 408, 1);
    end;

    {*******************************************************************************
    procedure almostleavehouse;
    By: akwardsaw
    Description: It almost leaves the house, just like almostlogout, almost logs out. must be in house options
    *******************************************************************************}

    procedure almostleavehouse;
    var a, b: integer;
    begin
      if not inhouseoptions then Houseoptions('on');
      getmousepos(a, b);
      mousebox(563, 384, 718, 408, 3);
      wait(100 + random(4000));
      mmouse(a, b, 20, 20);
    end;

    {*******************************************************************************
    function Findpohportal(var x, y: integer): boolean;
    By: akwardsaw
    Description: It *hopefully* finds the poh portal. it returns the x and y coords.
    a better way to do this would be nice :)
    *******************************************************************************}

    function Findpohportal(var x, y: integer): boolean;
    var
      CTS, I: Integer;
      TPA: TPointArray;
      ATPA: Array of TPointArray;
    begin
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.94, 33.16);
      FindColorsSpiralTolerance(mscx, mscy, TPA, 7478100, msx1, msy1, msx2, msy2, 15);
      ColorToleranceSpeed(CTS);
      ATPA := TPAToATPAEx(TPA, 15, 15);
      For I := 0 to High(ATPA) do
      begin
        MiddleTPAEx(ATPA[i], x, y);
        MMouse(x, y, 2, 2);
        wait(10 + random(30));
        if IsUpTextMultiCustom(['Enter', 'Portal', 'nter', 'ortal', 'ter', 'ort']) then
        begin
          Result := True;
          GetMousePos(x, y);
          Break;
        end;
      end;
    end;

    {*******************************************************************************
    Function FindPlank(var x, y: integer; plank: string; cx, cy, cx2, cy2: integer):Boolean;
    By: akwardsaw
    Description: it finds a dtm of the planks, and returns the x and y coords.
    *******************************************************************************}

    Function FindPlank(var x, y: integer; plank: string; cx, cy, cx2, cy2: integer):Boolean;
    var plank: integer;
    begin
      case plank of
        'plank': plankdtm := DTMFromString('78DA63CC63606010634001595136609A11CA6' +
           '72CC654039385ABA90012BC04D41402092E026AB28084280135C9' +
           '404281809A1C20A1825F0D00F2AD04B4');
        'oak':  plankdtm := DTMFromString('78DA639CCEC0C020CE80021A333DC1342394C' +
           'F380B487031A0014654357381841801357D404289809A29404295' +
           '809A49986E46570300EC66055C');
        'teak': plankdtm := DTMFromString('78DA6394606060B0664001996106609A11CA6' +
           '79401127A0C688011558D32903026A0461648D81150230A243C09' +
           'A8E107122E04D40803095BFC6A0023B50353');
        'mahogany': plankdtm := DTMFromString('78DA6374616060B0664001C10EFA609A11CA6' +
           '77403127A0C688011558D1F903024A0C60348D81250E308243C09' +
           'A8B10212CE04D4D861FA0B5D0D00A14D044E');
      end;
       Result := finddtm(plankdtm, x, y, cx, cy, cx2, cy2);
      If not(Result) then
        writeln('Plank not found');
      freedtm(plankDTM);
    end;

    also if your wondering, the only "hard" part about making a construction script is making sure the room is where you need it to be. this can easily be done by making sure that the specified room is next to the entrance, or use reflection, go into building mode(where there aren't any doors) and have the use put in they're own path.
    Last edited by Awkwardsaw; 07-04-2009 at 04:07 AM.
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  2. #2
    Join Date
    Jun 2006
    Posts
    1,492
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I don't do construction, but I must say, good job!

    A good way to failsafe the procedures that require to be in house options is, well, to check whether you are already in house options!

  3. #3
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    im adding that right now ;P should get it in a few moments

    edit: i finished. simplicity ftw (as long as it works good)
    Last edited by Awkwardsaw; 07-03-2009 at 12:57 PM.
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  4. #4
    Join Date
    May 2007
    Location
    Sydney, Australia (Faggot Region)
    Posts
    1,465
    Mentioned
    0 Post(s)
    Quoted
    11 Post(s)

    Default

    It's good to see people add scripts or make scripts for the SRL SVN


  5. #5
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    yeah, but what about the procedures? what all can i do to make them better/ make more usefull ones
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  6. #6
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    I am thinking that it might be faster to use bitmaps instead of DTMs, but good job! Very nice!

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

    Default

    Indeed it is, in 3.20d bitmaps are MUCH faster than DTMs now.

  8. #8
    Join Date
    Oct 2008
    Location
    behind you!
    Posts
    1,688
    Mentioned
    2 Post(s)
    Quoted
    40 Post(s)

    Default

    Did you even try the last function.... it doesn't work

    here i made this very quick don't know if it works tho.

    SCAR Code:
    {*******************************************************************************
    Function FindPlank(var x, y: integer; plank: string; cx, cy, cx2, cy2: integer):Boolean;
    By: akwardsaw
    Description: it finds a dtm of the planks, and returns the x and y coords.
    *******************************************************************************}

    Function FindPlank(var x, y: integer; plank: string; cx, cy, cx2, cy2: integer):Boolean;
    var
      i : integer;
      Plankdtm : array of integer;
    begin
      Result := False;
      case plank of
        'plank': plankdtm[1] := DTMFromString('78DA63CC63606010634001595136609A11CA6' +
           '72CC654039385ABA90012BC04D41402092E026AB28084280135C9' +
           '404281809A1C20A1825F0D00F2AD04B4');
        'oak':  plankdtm[2] := DTMFromString('78DA639CCEC0C020CE80021A333DC1342394C' +
           'F380B487031A0014654357381841801357D404289809A29404295' +
           '809A49986E46570300EC66055C');
        'teak': plankdtm[3] := DTMFromString('78DA6394606060B0664001996106609A11CA6' +
           '79401127A0C688011558D32903026A0461648D81150230A243C09' +
           'A8E107122E04D40803095BFC6A0023B50353');
        'mahogany': plankdtm[4] := DTMFromString('78DA6374616060B0664001C10EFA609A11CA6' +
           '77403127A0C688011558D1F903024A0C60348D81250E308243C09' +
           'A8B10212CE04D4D861FA0B5D0D00A14D044E');
      end;
      for i := 1 to 4 do
      if finddtm(plankdtm[i], x, y, cx, cy, cx2, cy2) then
      begin
        GetMousePos(x, y);
        Mouse(x, y, 5, 5, True);
        Result := True;
      end else
      Writeln('Plank Not Found');
    end;
    Hi

  9. #9
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    hmm, no i havn't tried bitmaps yet, i'll fool around with them today.

    and what do you mean that findplank doesn't work? like, does it not find a plank, or does it find the wrong ones
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

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

    Default

    It seems like it would work to me.

  11. #11
    Join Date
    Mar 2007
    Location
    <3
    Posts
    2,683
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ain't all the planks the exact same shape?

  12. #12
    Join Date
    Jun 2006
    Posts
    1,492
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Wait, bitmaps are faster than DTMs?

    Since when?!?

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

    Default

    Since SCAR 3.20.

  14. #14
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    You should try learning custom TPA's, so you can edit the Machine made ones. Like your FindpohPortal()
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

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

  16. #16
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    Quote Originally Posted by N1ke! View Post
    Ain't all the planks the exact same shape?
    yes, but the colors arent also they never change

    Quote Originally Posted by noidea
    You should try learning custom TPA's, so you can edit the Machine made ones. Like your FindpohPortal()
    i'm just now learning the basics of cts i'll lurk more in teh advanced tuts

    also, bitmaps dont work either. here are the ones that i have:

    SCAR Code:
    plankbmp := BitmapFromString(20, 16, 'beNpjYMALGCvTXYuTnHJj' +
           '7bKibJNDLWP9TSN9jIPc9IFS+DXWZLqXpbgUxDsA9aaHW0P0hnkaW' +
           'uqKEtQLtBSiF2gpUG9CkDnQUqBeYizF6mBjTWFSHQy0FOJgQhoZ6n' +
           'I8kR0MtBTiYF0VAfIc7GklTVAj0FKsDiboWoheiKXIDrYzEidoaWO' +
           'eF7KD4dFKjEbkUII7mJjEAPcpcigB9ZLkWuS0BE4M+DS2FPiguZZC' +
           'S4F6CQUvShDBfQpxMD6NAL6ciOM=');
      oakbmp := BitmapFromString(15, 10, 'beNpjYEAGU8qD+4oDO/P9Wr' +
           'K969M8KpNcimMdC6Lts8JsStP9GRgYkRVPLA3qKfRvz/VpzPSEK86' +
           'NsEsPtkJTCTEWrrgmxa0swRmHsYxY3YDNWMZplaHIboAbC1RcnOpL' +
           '0Fi4G9Bci2YsshvQjJ1RHQY3FtNrmMbi8lp9QRh+N0CMhShGU8kAA' +
           'I/Rcj8=');
      teakbmp := BitmapFromString(13, 15, 'beNpjYEADxXGmuZFGmWEGa' +
           'cH6SQG60d5a4e4aIS5qaGoKok0gyoBq4v108CiDGwVRBlQT4KgKU8' +
           'JYlmgGNwrNxgg/G7gyuI3IRgGVgY1ihBuF5nigMiSjGNGMgihDdTy' +
           'KUZg2AtWEeltClFUmW+BxPMwoBmSj0IIrKcwJUxlmcMHVQJRhdXxW' +
           'nAeyMlzBhawGM64hwVWc6oumDKuNaGoYABPBeag=');
      mahbmp := BitmapFromString(16, 19, 'beNpjYMADEr3MYz1Mo1yNw5' +
           '0Ngx30fay0Pcw1cCtnRFbsb6uLVz0jmuEQ9S4magTVIxuOQz12w3G' +
           'pT/G1wOpToGIgA9NwoHpKDIerx2U4RD0RhjOSbTgR0cSY7m+Fy6cY' +
           '6qGKSTUcq3ogg0TDGYlXD+Siqc8KssGjHsNwBjyKgYIkqcdUzAAAK' +
           'yiJ0g==');
    Last edited by Awkwardsaw; 07-04-2009 at 05:21 AM.
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  17. #17
    Join Date
    Oct 2008
    Location
    behind you!
    Posts
    1,688
    Mentioned
    2 Post(s)
    Quoted
    40 Post(s)

    Default

    Quote Originally Posted by akwardsaw View Post
    hmm, no i havn't tried bitmaps yet, i'll fool around with them today.

    and what do you mean that findplank doesn't work? like, does it not find a plank, or does it find the wrong ones
    duplicate error....
    Hi

  18. #18
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    Quote Originally Posted by Tickyy View Post
    duplicate error....
    oh. yeah, change the plank parameter to name
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

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
  •