Results 1 to 3 of 3

Thread: DTM Tester

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

    Default DTM Tester

    This is just a simple DTM Tester. It will check your inventory for the DTM that you specify. If found it will disguise SCAR's name to be "X DTM's Found!" as well as WriteLn "X DTM's Found!". If the script does not find any DTM's it will respond with "0 DTM`s found!".

    This is just a general and basic utility for new people joining this community learning how to script.

    SetUp
    1. Change YourDTM (line 27) with your actual DTM
    2. start logged in with the DTM in your inventory.
    3. push play

    Credits
    1. Zeph for his CountItemsDTM and ItemCoordsDTM functions. I believe there used to be something of that sort built into SRL itself, but now it doesn't seem to be there, thus I used a user-made-function that does the same thing.
    2. Yakman for Minimize and Maximize + the 2 related functions.

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

    Default

    SCAR Code:
    program New;
    {.include srl/srl.scar}

    var
      YourDTM : Integer;

    procedure LoadDTMs;
    begin
      YourDTM := DTMFromString('78DA63FCC4C0C010CB8002EAE7EE04D38C503' +
           'EA33C90351155CDFFFFFF51D5CC00B2AA09A80906B23C51D5E4E6' +
           'E6A2AA390B24AC50D55CB9FD1655CD5E205183AA86A18101450D0' +
           '08CE31230');
    end;
     
    procedure CheckForDTM;
    var
      AmountOfDTM : Integer;
    begin
      AmountOfDTM:= CountItemsIn('inv', 'dtm', YourDTM, []);
      Writeln(IntToStr(AmountOfDTM)+' DTM`s found!');
      Disguise(IntToStr(AmountOfDTM)+' DTM`s found!');
    end;

    procedure SetSelfWindowState(State:TWindowState);   //Yakman
    begin
      GetSelf.WindowState :=State;
    end;

    procedure SafeSetSelfWindowState(State:TWindowState);   //Yakman
    var
      t: TVariantArray;
    begin
      t := [state];
      ThreadSafeCall('SetSelfWindowState', t);
    end;

    procedure Minimize;  //Yakman
    begin
      SafeSetSelfWindowState(wsMinimized);
    end;

    procedure Maximize;  //Yakman
    begin
      SafeSetSelfWindowState(wsNormal);
    end;

    begin
      SetupSrl;
      LoadDTMs;
      Minimize;
      CheckForDTM;
      Maximize;
    end.


    ~shut

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

    Default

    You do not free the DTM. Also, you can just do GetSelf.WindowState := wsMinimized or something like that instead of Yakman's thing.

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
  •