Results 1 to 7 of 7

Thread: Add $define SMART in Smart.scar

  1. #1
    Join Date
    Feb 2009
    Location
    Nebraska
    Posts
    68
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Add $define SMART in Smart.scar

    A suggestion for Smart.scar. At the top of the include, add a define for SMART:

    {$define SMART}

    This makes it much easier to write code that needs to know whether SMART is enabled, while having zero impact on existing code (completely backward compatible with existing scripts).
    Grippy has approximately 30,000 hours of Delphi coding experience. srsly.

  2. #2
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Erm, probably won't be used as that would take some effort from leechers.

    o.O
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  3. #3
    Join Date
    Mar 2007
    Posts
    3,042
    Mentioned
    1 Post(s)
    Quoted
    14 Post(s)

    Default

    What sort of code would need to know if SMART was enabled or not, besides the lines that open SMART and set the window handle? Or are those what you're looking to account for?
    :-)

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

    Default

    Maybe he means this. Replace SRL.scar with:
    SCAR Code:
    //----------------------------------------------------------------------------//
    //--                    Scar Standard Resource Library                      --//
    //----------------------------------------------------------------------------//
    //-- by: Azeroth, Bebe, BenLand100, benleegt, Boreas, c0de,                 --//
    //--   Cheesehunk, dakota, Dankness, driger1592, Flyboy, Freddy1990,        --//
    //--   Hobbit, inferno, Kernel Klink, Knightstreak, Krazy_Meerkat,          --//
    //--   Krichevskoy, Liquid, Lorax, Mad Cow, Markus, masquerader,            --//
    //--   mastaraymond, moparisthebest, Mutant Squirrle, n3ss3s nielsie95,     --//
    //--   phantombmx, pups, Pyro, RAM, realrune, Renax, Ron, RsN,              --//
    //--   SKy Scripter, solemn wishes, Spky, SRL, Starblaster100, S            --//
    //--   tupid3ooo, Sumilion, tarajunky, The Claw, The_Rs_Monkey, Zephyrsfury --//
    //--   Wizzup?, WT-Fakawi, XxKanexX, Yakman, YoHoJo, _ChArMz,               --//
    //--                                                                        --//
    //--                                ....... and the SRL Community.          --//
    //----------------------------------------------------------------------------//

    {$IFDEF EnableSmart}
    {.include SRL/SRL/Misc/Smart.scar}
    {$ENDIF}

    //----------------------------------------------------------------------------//
    // --                        SRL Level 1 Includes                           --//
    // --                                                                       --//
    // --   Low Level SCAR Math, Mouse Movement and Color Clicking routines.    --//
    //----------------------------------------------------------------------------//

    {.include SRL/SRL/Core/Globals.scar}
    {.include SRL/SRL/Core/Math.scar}
    {.include SRL/SRL/Core/Mouse.scar}
    {.include SRL/SRL/Core/Color.scar}
    {.include SRL/SRL/Core/Players.scar}
    {.include SRL/SRL/Core/Overwrite.scar}

    //----------------------------------------------------------------------------//
    // --                        SRL Level 2 Includes                           --//
    // --                                                                       --//
    // --                 Interface, Object and OCR routines.                   --//
    //----------------------------------------------------------------------------//

    {.include SRL/SRL/Core/Timing.scar}
    {.include SRL/SRL/Core/GameTab.scar}
    {.include SRL/SRL/Core/SRLLog.scar}
    {.include SRL/SRL/Core/Text.scar}
    {.include SRL/SRL/Core/Inventory.scar}
    {.include SRL/SRL/Core/Object.scar}

    //----------------------------------------------------------------------------//
    // --                        SRL Level 3 Includes                           --//
    // --                                                                       --//
    // --      MapWalking, AntiRandoms, Bank, Symbol and many more...           --//
    //----------------------------------------------------------------------------//

    {.include SRL/SRL/Misc/Bitmaps.scar}
    {.include SRL/SRL/Core/FlagChat.scar}
    {.include SRL/SRL/Core/Login.scar}
    {.include SRL/SRL/Core/Mapwalk.scar}
    {.include SRL/SRL/Core/Bank.scar}
    {.include SRL/SRL/Core/Symbol.scar}
    {.include SRL/SRL/Core/RC.scar}
    {.include SRL/SRL/Core/AutoColor.scar}
    {.include SRL/SRL/Core/AntiRandoms/Common.scar}
    {.include SRL/SRL/Core/Globalstats.scar}
    {.include SRL/SRL/Core/CAutoRespond.scar}
    {.include SRL/SRL/Core/AntiRandoms/Box.scar}
    {.include SRL/SRL/Core/AntiRandoms/Certer.scar}
    {.include SRL/SRL/Core/AntiRandoms/Demon.scar}
    {.include SRL/SRL/Core/AntiRandoms/Forester.scar}
    {.include SRL/SRL/Core/AntiRandoms/Quiz.scar}
    {.include SRL/SRL/Core/AntiRandoms/Sandwich.scar}
    {.include SRL/SRL/Core/AntiRandoms/EvilBob.scar}
    {.include SRL/SRL/Core/AntiRandoms/Leo.scar}
    {.include SRL/SRL/Core/AntiRandoms/Frog.scar}
    {.include SRL/SRL/Core/AntiRandoms/ChatRandoms.scar}
    {.include SRL/SRL/Core/AntiRandoms/Molly.scar}
    {.include SRL/SRL/Core/AntiRandoms/Pillory.scar}
    {.include SRL/SRL/Core/Antirandoms/Pinball.scar}
    {.include SRL/SRL/Core/Antirandoms/Maze.scar}
    {.include SRL/SRL/Core/AntiRandoms/AntiRandoms.scar}
    {.include SRL/SRL/Core/AntiBan.scar}
    {.include SRL/SRL/Core/Amount.scar}

    {*******************************************************************************
    procedure  SetupSRL;
    by: SRL Dev Team
    Description: Sets up all variables needed to run SRL.
    *******************************************************************************}


    procedure SetupSRL;
    begin
      MouseSpeed := 15;
      CheckHPFirst := True;
      Reincarnate := False;
      TalkAfterRandoms := False;
      RoadColor := 0;
      WaterColor := 0;
      BankColor := 0;
      LampSkill := 'mining';
      SetUpSRLReport;
      LoadCosineArrays;
      SymbolAccuracy:= 0.8;
      LoadNPCArray;
      LoadSRLBitMaps;
      SolveChatRandoms := True;
      SetupSRLAutoResponder;
      UseFindMod := True;
      LogoutOnMod := True;
      UseFindTrade := True;
      Screenshots := False;
      InitializeSRLLogFile;
      Writeln ('SRL Compiled in '+  IntToStr(GetTimeRunning) + ' msec');
    end;

    And when making scripts you would do:
    SCAR Code:
    program New;
    {$Define EnableSmart}
    {.include SRL/SRL.scar}

    begin
      {$IFDEF EnableSmart}
        SmartSetupEx(43, true, true, false);
        SetTargetDC(SmartGetDC);
        //etc...
      {$ENDIF}
    end.

  5. #5
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    ... What he's saying is pretty straight forward. Just define SMART at the top of SMART.scar.

  6. #6
    Join Date
    Feb 2009
    Location
    Nebraska
    Posts
    68
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Nava2 View Post
    Erm, probably won't be used as that would take some effort from leechers.
    I don't expect leechers to be able to read code, much less understand conditional compilation.

    I, however, do know what to do with it, and I'd prefer not to modify library code any more than necessary, as it makes merging vendor changes into my local SVN repository a pain.

    Quote Originally Posted by Method View Post
    What sort of code would need to know if SMART was enabled or not, besides the lines that open SMART and set the window handle? Or are those what you're looking to account for?
    Those are the main concern. I tend to use conditional compilation in scripts to make putting features together and debugging easier. A 'SMART' def lets me set up scripts to automatically use Smart without any reconfiguration for the user:
    SCAR Code:
    procedure Setup;
    begin
      {$ifdef GripTrace}
      Trace( 'Setup', ttEnter );
      {$endif}
      try
        {$ifdef SMART}
        SMARTSetUpEx(21, False, True, False);
        SetTargetDC(SMARTGetDC);
        {$endif}

        SetupSRL;
      //  ScriptID := '';

        DeclarePlayers;
      finally
        {$ifdef GripTrace}
        Trace( 'Setup', ttExit );
        {$endif}
      end;
    end;

    Admittedly, copious use of ifdef/endif can make the code a bit uglier than it otherwise might be, but it is confined mostly to core routines that a regular user won't see much of.

    But there are other cases where Smart makes a difference. For example, if Smart is enabled, GetClientDimensions() returns the desktop dimensions (unless the user happened to set a target window).

    This is probably a bug that should be addressed, but until it is it can be handled with the define.

    That's part of the point, you don't always know what it'll be useful for, but it's free and has no adverse impacts.
    Grippy has approximately 30,000 hours of Delphi coding experience. srsly.

  7. #7
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    This was actually the idea at the beginning, but SRL decided to keep SMART separated. Now SMART comes with SRL, I guess it's a good idea to reintroduce it.
    Hup Holland Hup!

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
  •