Results 1 to 15 of 15

Thread: Can't figure this out

  1. #1
    Join Date
    Mar 2009
    Location
    Illinois
    Posts
    292
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Can't figure this out

    Ok so i'm trying to get use to forms and I made this:
    SCAR Code:
    program Form;
    {.include srl/srl/misc/smart.scar}
    {.include srl/srl.scar}
    var
      Form: TForm;
      UsernameLb, PasswordLb: TLabel;
      UsernameE, PasswordE: TEdit;
      LoginBtn, ResetBtn: TButton;
      SmartTrb: TRadioButton;
     
    procedure ButtonClick(tob: TObject);
    begin
      case tob of
        LoginBtn: begin
                    Form.ModalResult:= mrOk;
                    NumberOfPlayers(1);
                    Players[0].Name := UsernameE.text;
                    Players[0].Pass := PasswordE.text;
                    Players[0].Nick := 'null';
                    Players[0].active := true;
                    LoginPlayer;
                  end;
        ResetBtn: begin
                    UsernameE.Text := '';
                    PasswordE.Text := '';
                  end;
      end;
    end;

    procedure InitForm;
    begin
      Form := CreateForm;
      UsernameLb := TLabel.create(form);
      PasswordLb := TLabel.create(form);
      UsernameE := TEdit.create(form);
      PasswordE := TEdit.create(form);
      LoginBtn := TButton.create(form);
      ResetBtn := TButton.create(form);
      SmartTrb := TRadioButton.create(form);
     
      with Form do
      begin
        Left := 500;
        Top := 250;
        Height := 140;
        Width := 200;
        Caption := 'Auto Login';
        Color := clGreen;
      end;
      //LABELS
      with UsernameLb do
      begin
        Parent := Form;
        Left := 10;
        Top := 10;
        Caption := 'Username:';
        Font.Size := 10;
        Font.Name := 'New times roman';
      end;
      with PasswordLb do
      begin
        Parent := Form;
        Left := 10;
        Top := 50;
        Caption := 'Password:';
        Font.Size := 10;
        Font.Name := 'New times roman';
      end;
      //EDITBOXS
      with UsernameE do
      begin
        Parent := Form;
        Left := 75;
        Top := 10;
        Width := 100;
      end;
      with PasswordE do
      begin
        Parent := Form;
        Left := 75;
        Top := 50;
        Width := 100;
        PasswordChar := '*';
      end;
      //BUTTONS
      with LoginBtn do
      begin
        Parent := Form;
        Left := 10;
        Top := 80;
        Width := 75;
        Height := 20;
        Caption := 'Login';
        OnClick := @ButtonClick;
      end;
      with ResetBtn do
      begin
        Parent := Form;
        Left := 100;
        Top := 80;
        Width := 75;
        Height := 20;
        Caption := 'Reset';
        OnClick := @ButtonClick;
      end;
      //RADIOBUTTONS
      with SmartTrb do
      begin
        Parent := Form;
        Left := 10;
        Top := 32;
        Caption := 'Smart?';
      end;
    end;
    procedure SafeInitForm;
    var
      V: Tvariantarray;
    begin
      setarraylength(v, 0);
      ThreadSafeCall('InitForm', v);
    end;
    procedure ShowFModal;
    begin
      Form.ShowModal;
    end;
    procedure SafeShowFModal;
    var
      V: Tvariantarray;
    begin
      setarraylength(v, 0);
      ThreadSafeCall('ShowFModal', v);
    end;
    begin
      SetUpsrl;
      SafeInitForm;
      SafeShowFModal;
    end.
    And if you glanced at it you'll see that I have a radiobutton which I want if that checked it will load up smart
    I tried
    SCAR Code:
    if(smarttrb.checked)then
        {.include srl/srl/misc/smart.scar}
    I've tried other things to just can't seem to get it working any ideas?

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

    Default

    the only way that that will work(if the player wants SMART or not) is to have it on top, just like normal, and the user will have to comment/ un-comment them selves =\ but having it your way would be epic

    edit: unless theres a boolean variable in SRl.Scar that you can use
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

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

    Default

    The way including works is, before SCAR starts running the script, it copies and pastes the whole file you're including into the script itself. So when running the script, SCAR has no idea that {.include ...} was ever there.

  4. #4
    Join Date
    Mar 2009
    Location
    Illinois
    Posts
    292
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Oh okay I see i'll take it out lol but thanks guys =D

  5. #5
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Does SRL automatically use SMART now? If so, I think that's stupid.

    Anyways, if it doesn't, just do an if radio.checked the loadsmart();, although I don't think you couldn't have figured that out♠, so I'll assume that SRL automatically uses it.

    ~Sandstorm

  6. #6
    Join Date
    Mar 2009
    Location
    Illinois
    Posts
    292
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Sandstorm View Post
    Does SRL automatically use SMART now? If so, I think that's stupid.

    Anyways, if it doesn't, just do an if radio.checked the loadsmart();, although I don't think you couldn't have figured that out♠, so I'll assume that SRL automatically uses it.

    ~Sandstorm
    It automatically loads it if you have
    SCAR Code:
    {.include srl/srl/misc/smart.scar}
    Or else that should work thanks though I really appreciate it!

  7. #7
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ah.

    Hmm...

    You could use IFDEF's, but that's just the same as commenting it. Can't think of anything else.

    Well, that's stupid that it automatically does that.

    ~Sandstorm

  8. #8
    Join Date
    Mar 2009
    Location
    Illinois
    Posts
    292
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yeah, thank you very much for your attempt, I'll just have to stick with the regular script. Just trying to make it a little better lol, I having fun with forms.

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

    Default

    Quote Originally Posted by All that is man View Post
    Yeah, thank you very much for your attempt, I'll just have to stick with the regular script. Just trying to make it a little better lol, I having fun with forms.
    why dont you try this out, then have

    SCAR Code:
    if radiobutton1.checked then SMART_Use = true;
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  10. #10
    Join Date
    Mar 2009
    Location
    Illinois
    Posts
    292
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    Line 18: [Error] (20463:1): Unknown identifier 'SMART_Use' in script
    My SMART outdated?

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

    Default

    Quote Originally Posted by All that is man View Post
    SCAR Code:
    Line 18: [Error] (20463:1): Unknown identifier 'SMART_Use' in script
    My SMART outdated?
    no, you didnt add the variables to Globals.Scar

    read the thread, it has every thing i think
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  12. #12
    Join Date
    Mar 2009
    Location
    Illinois
    Posts
    292
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Wow, I need to go to bed :P didn't even see that link, thanks and uhh wheres
    Quote Originally Posted by Awkwardsaw View Post

    and SMART Setup in SRL.Scar:

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

    Default

    Quote Originally Posted by All that is man View Post
    Wow, I need to go to bed :P didn't even see that link, thanks and uhh wheres
    heres the whole file

    SCAR Code:
    //----------------------------------------------------------------------------//
    //--                    Scar Standard Resource Library                      --//
    //----------------------------------------------------------------------------//
    //-- by: Azeroth, Bebe, BenLand100, benleegt, Boreas, c0de,                 --//
    //--   Cheesehunk, dakota, Dankness, driger1592, EvilChicken!, Flyboy,      --//
    //--   Freddy1990, Hobbit, inferno, Kernel Klink, Knightstreak,             --//
    //--   Krazy_Meerkat, Krichevskoy, Liquid, Lorax, lordsaturn, Mad Cow,      --//
    //--   Markus, masquerader, mastaraymond, moparisthebest, Mutant Squirrle,  --//
    //--   n3ss3s, N1ke, Nava2, nielsie95, phantombmx, pups, Pyro, RAM,         --//
    //--   Rasta Magician, realrune, Renax, Ron, RsN, SKy Scripter,             --//
    //--   solemn wishes, Spky, SRL, Starblaster100, Stupid3ooo, Sumilion,      --//
    //--   tarajunky, The Claw, The_Rs_Monkey, Wizzup?, WT-Fakawi, XxKanexX,    --//
    //--   Yakman, YoHoJo, ZephyrsFury, _ChArMz,                                --//
    //--                                                                        --//
    //--                                ....... and the SRL Community.          --//
    //----------------------------------------------------------------------------//

    //----------------------------------------------------------------------------//
    //--                         SRL Level 1 Includes                           --//
    //--                                                                        --//
    //--        Low Level SCAR Math, Mouse Movement and Color 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 and OCR routines.                        --//
    //----------------------------------------------------------------------------//

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

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

    {.include SRL/SRL/Core/Flag.scar}
    {.include SRL/SRL/Core/Login.scar}
    {.include SRL/SRL/Core/Mapwalk.scar}
    {.include SRL/SRL/Core/Object.scar}
    {.include SRL/SRL/Core/Bitmaps.scar}
    {.include SRL/SRL/Core/Amount.scar}
    {.include SRL/SRL/Core/Inventory.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/Globalstats.scar}
    {.include SRL/SRL/Core/CAutoRespond.scar}
    {.include SRL/SRL/Core/WorldSwitcher.scar}
    {.include SRL/SRL/Core/AntiBan.scar}
    {.include SRL/SRL/Core/AntiRandoms/Common.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/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/CapnArnav.scar}
    {.include SRL/SRL/Core/Antirandoms/BeeKeeper.scar}
    {.include SRL/SRL/Core/AntiRandoms/Abyss.scar}
    {.include SRL/SRL/Core/AntiRandoms/Mordaut.scar}
    {.include SRL/SRL/Core/AntiRandoms/PrisonPete.scar}
    {.include SRL/SRL/Core/AntiRandoms/Mime.scar}
    {.include SRL/SRL/Core/AntiRandoms/AntiRandoms.scar}
    {.include SRL/SRL/Core/AntiRandoms/RandomTool.scar}
    {$IFNDEF SCAR321_UP}
    {.include SRL/SRL/Misc/FontUpdater.scar}
    {$ENDIF}

    {$DEFINE SRL_OPENDEV}

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


    procedure SetupSRL;
    var
      t: Integer;
      {$IFDEF SRL_SMART}{s: TStringArray;
      vv: TVariantArray;
      i: Integer;
      ReLoad: Boolean;}
    {$ENDIF}
    begin
      t := GetTimeRunning;
      MouseSpeed := 15;
      {$IFDEF UseLaptopMouse}LMouse_MissChance := 75;{$ENDIF}
      CheckHPFirst := True;
      Reincarnate := False;
      TalkAfterRandoms := False;
      RoadColor := 0;
      WaterColor := 0;
      BankColor := 0;
      LampSkill := 'mining';
      SetUpSRLReport;
      LoadCosineArrays;
      SymbolAccuracy:= 0.8;
      LoadSRLBitMaps;
      LoadSRLFonts;
      LoadTeleRandoms;
      SolveSRLRandoms := True;
      SetupSRLAutoResponder;
      UseFindMod := True;
      LogoutOnMod := True;
      UseFindTrade := True;
      UseAutoResponder := True;
      Screenshots := False;
      GraphicsSet := False;
      AllowPVP    := False;
      WarnSensitivity := -2;
    {$IFNDEF SCAR321_UP}
      srl_UpdateFonts(srl_FontsUp2date);
    {$ENDIF}
      InitializeSRLLogFile;
      Writeln ('SRL Compiled in '+  IntToStr(GetTimeRunning - t) + ' msec');

      Smart_Server := Smart_Server;
      Smart_Members:= Smart_Members;
      Smart_Signed := Smart_Signed;
      Smart_SuperDetail := Smart_SuperDetail;
      Smart_Use := true;
      {$IFDEF SRL_SMART}
      if Smart_Use then begin
     { ReLoad := False;
      s := SmartLastSettings;
      if High(s) <> 4 then SetLength(s, 5);
      try
        SmartGetColor(0, 0);
        Reload := False;
      except
        Reload := True;
      end;
      if Reload then
      begin
        writeln('unopened');
        if (Smart_Server = 0) then
        begin
          Smart_Server := RandomWorld(Smart_Members, False);
          Smart_Signed := True;
          Smart_SuperDetail := False;
        end;
      end else
      begin
        vv := [Smart_Server, Smart_Members, Smart_Signed, Smart_SuperDetail];
        for i := 0 to 3 do
          if not (s[i] = vv[i]) then
          begin
            ReLoad := True;
            Break;
          end;
      end;
      if ReLoad then
      begin
        Writeln('SMART Initialized.' + #10 + 'Loaded: Server ' + IntToStr(Smart_Server) + ', Members: ' + BoolToStr(Smart_Members)
                       + ', Signed: ' + BoolToStr(Smart_Signed) + ', Super Detail: ' + BoolToStr(Smart_SuperDetail) + '.');
        SmartSetupEx(Smart_Server, Smart_Members, Smart_Signed, Smart_SuperDetail);
      end; }

      if (Smart_Server = 0) then
      begin
        Smart_Server := RandomWorld(Smart_Members, False);
        Smart_Signed := True;
        Smart_SuperDetail := False;
      end;
      Writeln('SMART Initialized.' + #10 + 'Loaded: Server ' + IntToStr(Smart_Server) + ', Members: ' + BoolToStr(Smart_Members)
                     + ', Signed: ' + BoolToStr(Smart_Signed) + ', Super Detail: ' + BoolToStr(Smart_SuperDetail) + '.');
      SmartSetupEx(Smart_Server, Smart_Members, Smart_Signed, Smart_SuperDetail);
      SetTargetDC(SmartGetDC);
      repeat
        Wait(100);
        if (GetTimeRunning - t) > 120000 then
          Break;
      until(RSReady);
      end;
      {$ENDIF}
    end;
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  14. #14
    Join Date
    Mar 2009
    Location
    Illinois
    Posts
    292
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Cool thanks, lemme try it out, make it look a little neater and then show you the final product if you like

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

    Default

    Quote Originally Posted by All that is man View Post
    Cool thanks, lemme try it out, make it look a little neater and then show you the final product if you like
    sure thing
    <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
  •