Results 1 to 18 of 18

Thread: Help with forms

  1. #1
    Join Date
    Jun 2007
    Location
    I'm not sure...
    Posts
    581
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Help with forms

    I have 2 questions about forms:

    1)I have a form, and some of the stuff I want in it. I've got my
    SCAR Code:
    Button1.OnClick := @DevineVars;
    procedure, but I want to know how I can make it save the settings, so the user doesn't have to rewrite it every time

    2)Does anyone know where the Multiplayer form is? The one that saves settings?
    ---------------------------------------------------------


    Pm me if you need any math functions made. Me = l0ving t3h mathz

    ---------------------------------------------------------

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

    Default

    There's...

    SCAR Code:
    procedure SaveSetting(Section, Setting, Value: String);
    procedure LoadSetting(Section, Setting: String);

    But I'm pretty sure that just saves it into the computer's memory. I think it goes away when you restart the computer.

    There's also two nice commands that saves it to a file. But... Makes it easier to retrieve...

    SCAR Code:
    procedure WriteINI(Section, KeyName, NewString, FileName: String);
    function ReadINI(Section, KeyNAme, FileName: String): String;

    Edit: I think Star's PowerSkills has a multiplayer form. Try that out.

  3. #3
    Join Date
    Feb 2006
    Location
    London, England
    Posts
    2,045
    Mentioned
    2 Post(s)
    Quoted
    0 Post(s)

    Default

    SaveSetting saves to the registry, so the values are not removed when the computer is turned off.

    I would highly recommend INI files. I use them myself, and found they are great to work with
    SRL Wiki | SRL Rules | SRL Stats
    Ultimate SCAR Scripting Tutorial | Starblaster100's Auth System | Join the official SRL IRC now!


    Help Keep SRL Alive! Please disable Advert Blockers on SRL! Help Keep SRL Alive!


  4. #4
    Join Date
    Mar 2007
    Posts
    3,681
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Starblaster100 View Post
    SaveSetting saves to the registry, so the values are not removed when the computer is turned off.

    I would highly recommend INI files. I use them myself, and found they are great to work with
    You use em in your Stress miner too eh?

    what are they?

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

    Default

    Quote Originally Posted by hugolord View Post
    You use em in your Stress miner too eh?

    what are they?
    Initialization Files. They just store information in an easy-to-get-to way. (You don't have to parse it. Just put it the section and keyname you need the value for.)

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

    Default

    Initialization?

    I find it a pain making player databases using ini's, but until someone finds something else that works better, I guess we're stuck with them.
    Interested in C# and Electrical Engineering? This might interest you.

  7. #7
    Join Date
    Jun 2007
    Location
    I'm not sure...
    Posts
    581
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I found out how to get multiplayer in my form, but SaveSettings seems like a great idea. How would I use it?
    ---------------------------------------------------------


    Pm me if you need any math functions made. Me = l0ving t3h mathz

    ---------------------------------------------------------

  8. #8
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    SaveSetting('ChrisEssMiner','Mined',inttostr(mined));

    I'm pretty sure the first string needs to be the name of your program.. But dont quote me on that, im not positive about that.

    The second string can be anything you want to name that "variable", but it's not TECHNICALLY a variable.

    And the third string is the value, so i have my integer variable "Mined" in there.

    Hope this helps!

  9. #9
    Join Date
    Jun 2007
    Location
    I'm not sure...
    Posts
    581
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It does. A lot. Thank you very much!

    Also, I'm putting multiplayer in my form, but there is no LoadUs or SaveUs procedure in SRL anymore, so If anyone could help, that'd be great!
    ---------------------------------------------------------


    Pm me if you need any math functions made. Me = l0ving t3h mathz

    ---------------------------------------------------------

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

    Default

    Quote Originally Posted by Smartzkid View Post
    Initialization?
    http://en.wikipedia.org/wiki/INI_file

    <3 Teh Wikipedia

  11. #11
    Join Date
    Aug 2007
    Posts
    282
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    just curious.. with savesetting.. what does it save it to?

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

    Default

    Quote Originally Posted by Starblaster100 View Post
    SaveSetting saves to the registry, so the values are not removed when the computer is turned off.

    I would highly recommend INI files. I use them myself, and found they are great to work with
    Dvdcrayola, Read.
    Interested in C# and Electrical Engineering? This might interest you.

  13. #13
    Join Date
    Aug 2007
    Posts
    282
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    sorry.. im not good with files and stuff like that.. ill google what a registry is

  14. #14
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by rotflmfwao View Post
    It does. A lot. Thank you very much!

    Also, I'm putting multiplayer in my form, but there is no LoadUs or SaveUs procedure in SRL anymore, so If anyone could help, that'd be great!
    SCAR Code:
    {*******************************************************************************
    Procedure LoadUs;
    By: Yakman
    Description: Loads players from the char file into the player array.
    *******************************************************************************}


    procedure LoadUs;
    var
      f, CharsFile: Integer;
      CharsFileString: string;
    begin
      if (FileName = '') then filename := 'chars';
      CharsFile := OpenFile(AppPath + filename + '.dat', False);
      if (CharsFile < 0) then
      begin
        SaveUs;
        CharsFile := OpenFile(AppPath + filename + '.dat', False);
        if (CharsFile < 0) then
        begin
          WriteLn('Error Loading Chars');
          Exit;
        end
      end
        ReadFileString(CharsFile, CharsFileString, FileSize(CharsFile));
      CloseFile(CharsFile);
      SetArrayLength(Players, CountPlayers(CharsFileString));
      HowManyPlayers := GetArrayLength(players);
      for f := 0 to GetArrayLength(players) - 1 do
      begin
        players[f].Name := Between('name' + IntToStr(f) + '=', chr(13), CharsFileString);
        players[f].Pass := Between('pass' + IntToStr(f) + '=', chr(13), CharsFileString);
        players[f].Nick := Between('nick' + IntToStr(f) + '=', chr(13), CharsFileString);
        players[f].Active := StrToBool(Between('active' + IntToStr(f) + '=', chr(13), CharsFileString));
        players[f].Loc := Between('loc' + IntToStr(f) + '=', chr(13), CharsFileString);
        players[f].Skill := Between('skill' + IntToStr(f) + '=', chr(13), CharsFileString);
        try
          players[f].WaitTime := StrToInt(Between('waittime' + IntToStr(f) + '=', chr(13), CharsFileString));
        except
        end
        try
          players[f].Fight := StrToBool(Between('fight' + IntToStr(f) + '=', chr(13), CharsFileString));
        except
        end
        try
          players[f].Boolean1 := StrToBool(Between('boolean1' + IntToStr(f) + '=', chr(13), CharsFileString));
        except
        end
        try
          players[f].Boolean2 := StrToBool(Between('boolean2' + IntToStr(f) + '=', chr(13), CharsFileString));
        except
        end
        try
          players[f].Boolean3 := StrToBool(Between('boolean3' + IntToStr(f) + '=', chr(13), CharsFileString));
        except
        end
        try
          players[f].Integer1 := StrToInt(Between('integer1' + IntToStr(f) + '=', chr(13), CharsFileString));
        except
        end
        try
          players[f].Integer2 := StrToInt(Between('integer2' + IntToStr(f) + '=', chr(13), CharsFileString));
        except
        end
        try
          players[f].Integer3 := StrToInt(Between('integer3' + IntToStr(f) + '=', chr(13), CharsFileString));
        except
        end
        try
          players[f].Integer4 := StrToInt(Between('integer4' + IntToStr(f) + '=', chr(13), CharsFileString));
        except
        end
        players[f].String1 := Between('string1' + IntToStr(f) + '=', chr(13), CharsFileString);
        players[f].String2 := Between('string2' + IntToStr(f) + '=', chr(13), CharsFileString);
        players[f].String3 := Between('string3' + IntToStr(f) + '=', chr(13), CharsFileString);
        try
          players[f].Extended1 := StrToFloat(Between('extended1' + IntToStr(f) + '=', chr(13), CharsFileString));
        except
        end
        try
          players[f].Extended2 := StrToFloat(Between('extended2' + IntToStr(f) + '=', chr(13), CharsFileString));
        except
        end
        try
          players[f].Extended3 := StrToFloat(Between('extended3' + IntToStr(f) + '=', chr(13), CharsFileString));
        except
        end
      end
        CloseFile(CharsFile);
    end;

    {*******************************************************************************
    procedure SaveUs;
    By: Yakman
    Description: Saves users from the player array into the chars file
    *******************************************************************************}


    procedure SaveUs;
    var
      f, CharsFile: Integer;
    begin
      if (FileName = '') then FileName := 'Chars';
      CharsFile := RewriteFile(AppPath + FileName + '.dat', False);
      for f := 0 to GetArrayLength(players) - 1 do
      begin
        WriteFileString(charsfile, 'name' + IntToStr(f) + '=' + players[f].name +
          Chr(13));
        WriteFileString(charsfile, 'pass' + IntToStr(f) + '=' + players[f].pass
          + Chr(13));
        WriteFileString(charsfile, 'nick' + IntToStr(f) + '=' + players[f].nick
          + Chr(13));
        WriteFileString(charsfile, 'active' + IntToStr(f) + '=' +
          BoolToStr(players[f].active) + Chr(13));
        if (FormOption[0]) then
          WriteFileString(charsfile, 'loc' + IntToStr(f) + '=' +
            players[currentplayer].loc + Chr(13));
        if (FormOption[1]) then
          WriteFileString(charsfile, 'skill' + IntToStr(f) + '=' +
            players[currentplayer].skill + Chr(13));
        if (FormOption[2]) then
          WriteFileString(charsfile, 'waittime' + IntToStr(f) + '=' +
            IntToStr(players[currentplayer].waittime) + Chr(13));
        if (FormOption[3]) then
          WriteFileString(charsfile, 'fight' + IntToStr(f) + '=' +
            BoolToStr(players[currentplayer].fight) + Chr(13));
        if (FormOption[4]) then
          WriteFileString(charsfile, 'boolean1' + IntToStr(f) + '=' +
            BoolToStr(players[currentplayer].boolean1) + Chr(13));
        if (FormOption[5]) then
          WriteFileString(charsfile, 'boolean2' + IntToStr(f) + '=' +
            BoolToStr(players[currentplayer].boolean2) + Chr(13));
        if (FormOption[6]) then
          WriteFileString(charsfile, 'boolean3' + IntToStr(f) + '=' +
            BoolToStr(players[currentplayer].boolean3) + Chr(13));
        if (FormOption[7]) then
          WriteFileString(charsfile, 'integer1' + IntToStr(f) + '='
            + IntToStr(players[currentplayer].integer1) + Chr(13));
        if (FormOption[8]) then
          WriteFileString(charsfile, 'integer2' + IntToStr(f) + '='
            + IntToStr(players[currentplayer].integer2) + Chr(13));
        if (FormOption[9]) then
          WriteFileString(charsfile, 'integer3' + IntToStr(f) +
            '=' + IntToStr(players[currentplayer].integer3) +
            Chr(13));
        if (FormOption[10]) then
          WriteFileString(charsfile, 'integer4' + IntToStr(f)
            +
            '=' + IntToStr(players[currentplayer].integer4) +
            Chr(13));
        if (FormOption[11]) then
          WriteFileString(charsfile, 'string1' + IntToStr(f)
            + '=' + players[currentplayer].string1 + Chr(13));
        if (FormOption[12]) then
          WriteFileString(charsfile, 'string2' +
            IntToStr(f) + '=' +
            players[currentplayer].string2 + Chr(13));
        if (FormOption[13]) then
          WriteFileString(charsfile, 'string3' +
            IntToStr(f) + '=' +
            players[currentplayer].string3 + Chr(13));
        if (FormOption[14]) then
          WriteFileString(charsfile, 'extended1' +
            IntToStr(f) + '=' +
            FloatToStr(players[currentplayer].extended1)
            + Chr(13));
        if (FormOption[15]) then
          WriteFileString(charsfile, 'extended2' +
            IntToStr(f) + '=' +
            FloatToStr(players[currentplayer].extended2) + Chr(13));
        if (FormOption[16]) then
          WriteFileString(charsfile, 'extended3' +
            IntToStr(f) + '=' +
            FloatToStr(players[currentplayer].extended3) + Chr(13))
            WriteFileString(charsfile, Chr(13));
      end;
      CloseFile(CharsFile);
    end;

    You might need a few variables that were in Users.scar that i didnt post here, but you should be able to figure it out.. If not, post your errors here, and i'll help you out.

  15. #15
    Join Date
    Jun 2007
    Location
    I'm not sure...
    Posts
    581
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    AAAHHHHHH!!!!!!!!!
    I made my own.... Lol it sucks.... I'm gonna post it here anyways, because
    a)It works, all except for the loadplayers and saveplayers...
    b)I'm hoping that you all can help me with that.
    ---------------------------------------------------------


    Pm me if you need any math functions made. Me = l0ving t3h mathz

    ---------------------------------------------------------

  16. #16
    Join Date
    Jun 2007
    Location
    I'm not sure...
    Posts
    581
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Sorry for the doublepost, but its a diff subject, and I thought it deserved its own post.

    I keep getting an out of range error when I use the loadus procedure... I know what that error means, but I can't seem to find what's wrong... Here is my script:
    SCAR Code:
    Program BananasForm;
    {.Include SRL/SRL.scar}
    Var
      SearchTime, HowManyQuests, HowLongToRun, cUser:Integer;//Form Stuff
      KillUIDs, ProggieAtEnd, LogoutFast, UseEffQuest:Boolean;//Form Stuff

    var
      frmDesign : TForm;
      Updates : TButton;
      GroupBox1 : TGroupBox;
      KUID : TCheckBox;
      PAE : TCheckBox;
      LF : TCheckBox;
      UEQ : TCheckBox;
      ST : TEdit;
      HMQ : TEdit;
      HLTR : TEdit;
      SS : TButton;
      GroupBox2 : TGroupBox;
      lblUser : TLabel;
      edUser : TEdit;
      edPass : TEdit;
      edNick : TEdit;
      GroupBox4 : TGroupBox;
      BackPlayer : TButton;
      ForwardPlayer : TButton;
      DeletePlayer : TButton;
      CreatePlayer : TButton;
      edActive : TEdit;
      SP : TButton;
      LP : TButton;
      LS : TButton;
      Letsgo : TButton;

    procedure WriteUpdates;
      Begin
        Writeln('Version 1.0: First one');
        Writeln('Version 1.1: Some minor bugfixes, looks better');
        Writeln('Version 2.0: Proggie, more efficient');
        Writeln('Version 2.1: Optional EfficientQuesting');
        Writeln('Version 3.0: SRL Stats!!! Yay! But they don''t work...');
        Writeln('Version 3.5: Fixed SRL Stats, big update, so it went up .5 instead of .1');
        Writeln('             Some minor bugfixes and other minor updates');
        Writeln('Version 3.7: More SRL Stats!');
        Writeln('Version 4.0: Updated for SRL 4.0 Beta!!! Yay!');
        Writeln('Version 4.3: Forms!!!!!!!!!!');
        Writeln('Coming in later versions:');
        Writeln('   Cleaner code, ''cause I''m applying 4 members');
        Writeln('   Failsafes');
      End;

    Procedure SaveSettings;
      Begin
        SearchTime:=StrToInt(ST.Text);
        HowManyQuests:=StrToInt(HMQ.Text);
        HowLongToRun:=StrToInt(HLTR.Text);
        KillUIDs:=KUID.Checked;
        ProggieAtEnd:=PAE.Checked;
        LogoutFast:=LF.Checked;
        UseEffQuest:=UEQ.Checked;
        SaveSetting('BananaSettings','ST',IntToStr(SearchTime));
        SaveSetting('BananaSettings','HMQ',IntToStr(HowManyQuests));
        SaveSetting('BananaSettings','HLTR',IntToStr(HowLongToRun));
        SaveSetting('BananaSettings','KUID',BoolToStr(KillUIDs));
        SaveSetting('BananaSettings','PAE',BoolToStr(ProggieAtEnd));
        SaveSetting('BananaSettings','LF',BoolToStr(LogoutFast));
        SaveSetting('BananaSettings','UEQ',BoolToStr(UseEffQuest));
      End;



    Procedure LoadSettings;
      Begin
        SearchTime:=StrToInt(LoadSetting('BananaSettings','ST'));
        HowManyQuests:=StrToInt(LoadSetting('BananaSettings','HMQ'));
        HowLongToRun:=StrToInt(LoadSetting('BananaSettings','HLTR'));
        KillUIDs:=StrToBool(LoadSetting('BananaSettings','KUID'));
        ProggieAtEnd:=StrToBool(LoadSetting('BananaSettings','PAE'));
        LogoutFast:=StrToBool(LoadSetting('BananaSettings','LF'));
        UseEffQuest:=StrToBool(LoadSetting('BananaSettings','UEQ'));
        ST.Text := IntToStr(SearchTime);
        HMQ.Text := IntToStr(HowManyQuests);
        HLTR.Text := IntToStr(HowLongToRun);
        KUID.Checked := KillUIDs;
        PAE.Checked := ProggieAtEnd;
        LF.Checked := LogoutFast;
        UEQ.Checked := UseEffQuest;
      End;
    //--------------Above is Settings Procs, below is Players Procs------\\

    procedure AddUser;
    begin
      SetArrayLength(Players, GetArrayLength(Players) + 1);
      Players[GetArrayLength(Players) - 1].Name := 'New Name';
      Players[GetArrayLength(Players) - 1].Pass := 'New Pass';
      Players[GetArrayLength(Players) - 1].Nick := 'New Nick';
      Players[GetArrayLength(Players) - 1].Active := True;
      Players[GetArrayLength(Players) - 1].Loc := 'Luthas''s House';
      Inc(HowManyPlayers);
    end;

    procedure CreateUser;
    begin
      Players[cUser].Nick := edNick.Text;
      Players[cUser].Name := edUser.Text;
      Players[cUser].Pass := edPass.Text;
      if ((edActive.Text = 'True') or (edActive.Text = 'Active')) then
        Players[cUser].Active := True
      else
        Players[cUser].Active := False;
      AddUser;
      cUser := GetArrayLength(Players) - 1;
      lblUser.Caption := IntToStr(cUser);
      edNick.Text := Players[cUser].Nick;
      edUser.Text := Players[cUser].Name;
      edPass.Text := Players[cUser].Pass;
      if (Players[cUser].Active) then
        edActive.Text := 'True'
      else
        edActive.Text := 'False';
    end;

    procedure ForwardUser;
    begin
      Players[cUser].Nick := edNick.Text;
      Players[cUser].Name := edUser.Text;
      Players[cUser].Pass := edPass.Text;
      if ((edActive.Text = 'True') or (edActive.Text = 'Active')) then
        Players[cUser].Active := True
      else
        Players[cUser].Active := False;
      if (cUser + 1 > GetArrayLength(Players) - 1) then
        cUser := 0
      else
        cUser := cUser + 1;
      lblUser.Caption := IntToStr(cUser);
      edNick.Text := Players[cUser].Nick;
      edUser.Text := Players[cUser].Name;
      edPass.Text := Players[cUser].Pass;
      if ((edActive.Text = 'True') or (edActive.Text = 'Active')) then
        edActive.Text := 'True'
      else
        edActive.Text := 'False';
    end;

    procedure BackUser;
    begin
      Players[cUser].Nick := edNick.Text;
      Players[cUser].Name := edUser.Text;
      Players[cUser].Pass := edPass.Text;
      if ((edActive.Text = 'True') or (edActive.Text = 'Active')) then
        Players[cUser].Active := True
      else
        Players[cUser].Active := False;
      if (cUser - 1 < 0) then
        cUser := GetArrayLength(Players) - 1
      else
        cUser := cUser - 1;
      lblUser.Caption := IntToStr(cUser);
      edNick.Text := Players[cUser].Nick;
      edUser.Text := Players[cUser].Name;
      edPass.Text := Players[cUser].Pass;
      if (Players[cUser].Active) then
        edActive.Text := 'True'
      else
        edActive.Text := 'False';
    end;

    procedure DeleteUser;
    var
      na, ni: string;
      ac: Boolean;
    begin
      na := Players[GetArrayLength(Players) - 1].Name;
      ni := Players[GetArrayLength(Players) - 1].Nick;
      ac := Players[GetArrayLength(Players) - 1].Active;
      Players[cUser].Name := na;
      Players[cUser].Nick := ni;
      Players[cUser].Active := ac;
      SetArrayLength(Players, GetArrayLength(Players) - 1);
      if (cUser + 1 > GetArrayLength(Players) - 1) then
        cUser := 0
      else
        cUser := cUser + 1;
      lblUser.Caption := IntToStr(cUser);
      edNick.Text := Players[cUser].Nick;
      edUser.Text := Players[cUser].Name;
      edPass.Text := Players[cUser].Pass;
      if (Players[cUser].Active) then
        edActive.Text := 'True'
      else
        edActive.Text := 'False';
    end;

    procedure Start(Sender: TObject);
    begin
      lblUser.Caption := IntToStr(cUser);
      edNick.Text := Players[cUser].Nick;
      edUser.Text := Players[cUser].Name;
      edPass.Text := Players[cUser].Pass;
      if (Players[cUser].Active) then
        edActive.Text := 'True'
      else
        edActive.Text := 'False';
    end;

    procedure SaveUs;
    var
      f: Integer;
    begin
      WriteINI('HMP','Number',IntToStr(HowManyPlayers),AppPath +'BananaPlayers.ini');
      for f := 0 to GetArrayLength(players) - 1 do
      begin
        WriteINI('P' +IntToStr(f),'Name',Players[f].Name,AppPath +'BananaPlayers.ini');
        WriteINI('P' +IntToStr(f),'Pass',Players[f].Pass,AppPath +'BananaPlayers.ini');
        WriteINI('P' +IntToStr(f),'Nick',Players[f].Nick,AppPath +'BananaPlayers.ini');
        WriteINI('P' +IntToStr(f),'Active',BoolToStr(Players[f].Active),AppPath +'BananaPlayers.ini');
      end;
    end;

    procedure LoadUs;
    var
      f: Integer;
    begin
      SetArrayLength(Players, StrToInt(ReadINI('HMP','Number',AppPath +'BananaPlayers.ini')));
      HowManyPlayers := GetArrayLength(players);
      HowManyBooleans:=0;
      CurrentPlayer:=0;
      for f := 0 to GetArrayLength(players) - 1 do
        begin
          Players[f].Name := ReadINI('P' +IntToStr(f),'Name',AppPath +'BananaPlayers.ini');
          Players[f].Pass := ReadINI('P' +IntToStr(f),'Pass',AppPath +'BananaPlayers.ini');
          Players[f].Nick := ReadINI('P' +IntToStr(f),'Nick',AppPath +'BananaPlayers.ini');
          Players[f].Active := StrToBool(ReadINI('P' +IntToStr(f),'Active',AppPath +'BananaPlayers.ini'));
          Players[f].Integers[0] := 0;
          Players[f].Integers[1] := 0;
        end
        LoadPlayerArray;
        NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
    end;

    Procedure HandleButtons(Sender:TObject);
      Begin
        Case Sender Of
          SP:SaveUs;
          LP:LoadUs;
          Updates:WriteUpdates;
          SS:SaveSettings;
          LS:LoadSettings;
          CreatePlayer:CreateUser;
          DeletePlayer:DeleteUser;
          ForwardPlayer:ForwardUser;
          BackPlayer:BackUser;
          Letsgo:Begin
                   Writeln('Starting script!!!');
                   frmDesign.ModalResult := mrOk;
                 End;
        End;
      End;

    //-------------Form Creator Below-------------------------------\\
    Procedure InitForm;
    Begin
    frmDesign := CreateForm;
    frmDesign.Left := 335;
    frmDesign.Top := 168;
    frmDesign.Width := 434;
    frmDesign.Height := 373;
    frmDesign.Caption := 'Bananas Version4.3';
    frmDesign.Color := clYellow;
    frmDesign.Font.Color := clWindowText;
    frmDesign.Font.Height := -11;
    frmDesign.Font.Name := 'MS Sans Serif';
    frmDesign.Font.Style := [];
    frmDesign.Visible := False;
    frmDesign.PixelsPerInch := 96;
    frmDesign.OnShow := @Start;
    Updates := TButton.Create(frmDesign);//Write the updates
    Updates.OnClick := @HandleButtons;
    Updates.Parent := frmDesign;
    Updates.Left := 1;
    Updates.Top := 1;
    Updates.Width := 424;
    Updates.Height := 25;
    Updates.Cursor := crHandPoint;
    Updates.Hint := 'Writes the updates to the debug';
    Updates.Caption := 'See Updates';
    Updates.DragCursor := crDefault;
    Updates.Font.Color := clWindowText;
    Updates.Font.Height := -11;
    Updates.Font.Name := 'Fixedsys';
    Updates.Font.Style := [];
    Updates.ParentFont := False;
    Updates.TabOrder := 0;
    GroupBox1 := TGroupBox.Create(frmDesign);
    GroupBox1.Parent := frmDesign;
    GroupBox1.Left := 4;
    GroupBox1.Top := 32;
    GroupBox1.Width := 243;
    GroupBox1.Height := 94;
    GroupBox1.Caption := 'Options';
    GroupBox1.TabOrder := 1;
    KUID := TCheckBox.Create(GroupBox1);//Kill UIDs
    KUID.Parent := GroupBox1;
    KUID.Left := 6;
    KUID.Top := 13;
    KUID.Width := 97;
    KUID.Height := 17;
    KUID.Cursor := crHandPoint;
    KUID.Hint := 'Do you want my script to destroy the UIDs?';
    KUID.Caption := 'KillUIDs?';
    KUID.Checked := True;
    KUID.Font.Color := clBlack;
    KUID.Font.Height := -11;
    KUID.Font.Name := 'Microsoft Sans Serif';
    KUID.Font.Style := [];
    KUID.ParentFont := False;
    KUID.ParentShowHint := False;
    KUID.ShowHint := True;
    KUID.State := cbChecked;
    KUID.TabOrder := 0;
    PAE := TCheckBox.Create(GroupBox1);//ProggieAtEnd
    PAE.Parent := GroupBox1;
    PAE.Left := 6;
    PAE.Top := 33;
    PAE.Width := 97;
    PAE.Height := 17;
    PAE.Cursor := crHandPoint;
    PAE.Hint := 'Do you want a Proggie at the end?';
    PAE.Caption := 'Full Proggie?';
    PAE.Checked := True;
    PAE.ParentShowHint := False;
    PAE.ShowHint := True;
    PAE.State := cbChecked;
    PAE.TabOrder := 1;
    LF := TCheckBox.Create(GroupBox1); //LogoutFast
    LF.Parent := GroupBox1;
    LF.Left := 6;
    LF.Top := 53;
    LF.Width := 97;
    LF.Height := 17;
    LF.Cursor := crHandPoint;
    LF.Hint := 'Do you want to logout fast?';
    LF.Caption := 'Logout Fast?';
    LF.Checked := True;
    LF.ParentShowHint := True;
    LF.ShowHint := True;
    LF.State := cbChecked;
    LF.TabOrder := 2;
    UEQ := TCheckBox.Create(GroupBox1);//UseEffQuest
    UEQ.Parent := GroupBox1;
    UEQ.Left := 6;
    UEQ.Top := 73;
    UEQ.Width := 97;
    UEQ.Height := 17;
    UEQ.Cursor := crHandPoint;
    UEQ.Hint := 'Do you want to use Efficient Quest?';
    UEQ.Caption := 'Efficient Quest';
    UEQ.Checked := True;
    UEQ.ParentShowHint := False;
    UEQ.ShowHint := True;
    UEQ.State := cbChecked;
    UEQ.TabOrder := 3;
    ST := TEdit.Create(GroupBox1);//SearchTime
    ST.Parent := GroupBox1;
    ST.Left := 110;
    ST.Top := 13;
    ST.Width := 121;
    ST.Height := 21;
    ST.Hint := 'How long do you want to look for luthas (in ms) Rec:60000';
    ST.MaxLength := 5;
    ST.ParentShowHint := False;
    ST.ShowHint := True;
    ST.TabOrder := 4;
    ST.Text := '60000';
    HMQ := TEdit.Create(GroupBox1);//HowManyQuests
    HMQ.Parent := GroupBox1;
    HMQ.Left := 110;
    HMQ.Top := 38;
    HMQ.Width := 121;
    HMQ.Height := 21;
    HMQ.Hint := 'How hamy times do you want each player to do the quest?';
    HMQ.MaxLength := 1;
    HMQ.ParentShowHint := False;
    HMQ.ShowHint := True;
    HMQ.TabOrder := 5;
    HMQ.Text := '3';
    HLTR := TEdit.Create(GroupBox1);//HowLongToRun
    HLTR.Parent := GroupBox1;
    HLTR.Left := 110;
    HLTR.Top := 64;
    HLTR.Width := 121;
    HLTR.Height := 21;
    HLTR.Hint := 'How long do you want the script to run, in minutes.';
    HLTR.ParentShowHint := False;
    HLTR.ShowHint := True;
    HLTR.TabOrder := 6;
    HLTR.Text := '600';
    //Above is settings---------------- no onclick controlls needed
    //Below is savesettings and loadsettings
    SS := TButton.Create(frmDesign);//SaveSettings
    SS.OnClick := @HandleButtons;
    SS.Parent := frmDesign;
    SS.Left := 1;
    SS.Top := 130;
    SS.Width := 194;
    SS.Height := 25;
    SS.Cursor := crHandPoint;
    SS.Hint := 'Click this to save your settings';
    SS.Caption := 'Save Settings';
    SS.Font.Color := clWindowText;
    SS.Font.Height := -11;
    SS.Font.Name := 'Impact';
    SS.Font.Style := [];
    SS.ParentFont := False;
    SS.ParentShowHint := False;
    SS.ShowHint := True;
    SS.TabOrder := 2;
    GroupBox2 := TGroupBox.Create(frmDesign);
    GroupBox2.Parent := frmDesign;
    GroupBox2.Left := 9;
    GroupBox2.Top := 165;
    GroupBox2.Width := 404;
    GroupBox2.Height := 166;
    GroupBox2.Caption := 'Players';
    GroupBox2.TabOrder := 3;
    lblUser := TLabel.Create(GroupBox2);
    lblUser.Parent := GroupBox2;
    lblUser.Left := 221;
    lblUser.Top := 11;
    lblUser.Width := 32;
    lblUser.Height := 13;
    lblUser.Caption := '';
    edUser := TEdit.Create(GroupBox2);
    edUser.Parent := GroupBox2;
    edUser.Left := 7;
    edUser.Top := 13;
    edUser.Width := 121;
    edUser.Height := 21;
    edUser.TabOrder := 0;
    edUser.Text := 'Username';
    edPass := TEdit.Create(GroupBox2);
    edPass.PasswordChar := 'ยง';
    edPass.Parent := GroupBox2;
    edPass.Left := 7;
    edPass.Top := 37;
    edPass.Width := 121;
    edPass.Height := 21;
    edPass.TabOrder := 1;
    edPass.Text := 'Password';
    edNick := TEdit.Create(GroupBox2);
    edNick.Parent := GroupBox2;
    edNick.Left := 7;
    edNick.Top := 61;
    edNick.Width := 121;
    edNick.Height := 21;
    edNick.TabOrder := 2;
    edNick.Text := 'Nick';
    GroupBox4 := TGroupBox.Create(GroupBox2);
    GroupBox4.Parent := GroupBox2;
    GroupBox4.Left := 133;
    GroupBox4.Top := 28;
    GroupBox4.Width := 254;
    GroupBox4.Height := 103;
    GroupBox4.Caption := 'Controll';
    GroupBox4.TabOrder := 3;
    BackPlayer := TButton.Create(GroupBox4);
    BackPlayer.OnClick := @HandleButtons;
    BackPlayer.Parent := GroupBox4;
    BackPlayer.Left := 7;
    BackPlayer.Top := 43;
    BackPlayer.Width := 37;
    BackPlayer.Height := 25;
    BackPlayer.Hint := 'Go back one player';
    BackPlayer.Caption := '<--';
    BackPlayer.ParentShowHint := False;
    BackPlayer.ShowHint := True;
    BackPlayer.TabOrder := 0;
    ForwardPlayer := TButton.Create(GroupBox4);
    ForwardPlayer.OnClick := @HandleButtons;
    ForwardPlayer.Parent := GroupBox4;
    ForwardPlayer.Left := 210;
    ForwardPlayer.Top := 43;
    ForwardPlayer.Width := 37;
    ForwardPlayer.Height := 25;
    ForwardPlayer.Hint := 'Go forward one player';
    ForwardPlayer.Caption := '-->';
    ForwardPlayer.ParentShowHint := False;
    ForwardPlayer.ShowHint := True;
    ForwardPlayer.TabOrder := 1;
    DeletePlayer := TButton.Create(GroupBox4);
    DeletePlayer.OnClick := @HandleButtons;
    DeletePlayer.Parent := GroupBox4;
    DeletePlayer.Left := 53;
    DeletePlayer.Top := 43;
    DeletePlayer.Width := 71;
    DeletePlayer.Height := 25;
    DeletePlayer.Hint := 'Delete the current player';
    DeletePlayer.Caption := 'Delete Player';
    DeletePlayer.ParentShowHint := False;
    DeletePlayer.ShowHint := True;
    DeletePlayer.TabOrder := 2;
    CreatePlayer := TButton.Create(GroupBox4);
    CreatePlayer.OnClick := @HandleButtons;
    CreatePlayer.Parent := GroupBox4;
    CreatePlayer.Left := 130;
    CreatePlayer.Top := 43;
    CreatePlayer.Width := 71;
    CreatePlayer.Height := 25;
    CreatePlayer.Hint := 'Create player with the current stats';
    CreatePlayer.Caption := 'Create Player';
    CreatePlayer.ParentShowHint := False;
    CreatePlayer.ShowHint := True;
    CreatePlayer.TabOrder := 3;
    edActive := TEdit.Create(GroupBox2);
    edActive.Parent := GroupBox2;
    edActive.Left := 7;
    edActive.Top := 85;
    edActive.Width := 121;
    edActive.Height := 21;
    edActive.TabOrder := 4;
    edActive.Text := 'Active';
    SP := TButton.Create(GroupBox2);
    SP.OnClick := @HandleButtons;
    SP.Parent := GroupBox2;
    SP.Left := 8;
    SP.Top := 137;
    SP.Width := 180;
    SP.Height := 25;
    SP.Cursor := crHandPoint;
    SP.Caption := 'Save Players';
    SP.Font.Color := clWindowText;
    SP.Font.Height := -15;
    SP.Font.Name := 'Palatino Linotype';
    SP.Font.Style := [];
    SP.ParentFont := False;
    SP.TabOrder := 5;
    LP := TButton.Create(GroupBox2);
    LP.OnClick := @HandleButtons;
    LP.Parent := GroupBox2;
    LP.Left := 212;
    LP.Top := 137;
    LP.Width := 180;
    LP.Height := 25;
    LP.Cursor := crHandPoint;
    LP.Caption := 'Load Players';
    LP.Font.Color := clWindowText;
    LP.Font.Height := -15;
    LP.Font.Name := 'Palatino Linotype';
    LP.Font.Style := [];
    LP.ParentFont := False;
    LP.TabOrder := 6;
    LS := TButton.Create(frmDesign);
    LS.OnClick := @HandleButtons;
    LS.Parent := frmDesign;
    LS.Left := 218;
    LS.Top := 131;
    LS.Width := 194;
    LS.Height := 25;
    LS.Cursor := crHandPoint;
    LS.Hint := 'Click this to load your settings';
    LS.Caption := 'Load Settings';
    LS.Font.Color := clWindowText;
    LS.Font.Height := -11;
    LS.Font.Name := 'Impact';
    LS.Font.Style := [];
    LS.ParentFont := False;
    LS.ParentShowHint := False;
    LS.ShowHint := True;
    LS.TabOrder := 4;
    Letsgo := TButton.Create(frmDesign);
    Letsgo.OnClick := @HandleButtons;
    Letsgo.Parent := frmDesign;
    Letsgo.Left := 254;
    Letsgo.Top := 34;
    Letsgo.Width := 156;
    Letsgo.Height := 93;
    Letsgo.Cursor := crHandPoint;
    Letsgo.Hint := 'Start The Script!!!! Make sure that runescape is the client and you have all the info filled in.';
    Letsgo.Caption := 'GO!!!';
    Letsgo.Font.Color := clYellow;
    Letsgo.Font.Height := -48;
    Letsgo.Font.Name := 'Roman';
    Letsgo.Font.Style := [];
    Letsgo.ParentFont := False;
    Letsgo.ParentShowHint := False;
    Letsgo.ShowHint := True;
    Letsgo.TabOrder := 13;

    End;


    procedure SafeInitForm;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('InitForm', v);
    end;

    procedure ShowFormModal;
    begin
      frmDesign.ShowModal;
    end;

    procedure SafeShowFormModal;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('ShowFormModal', v);
    end;

    Procedure StartTheShow;
      Begin
        cUser := 0;
        HowManyPlayers:=0
        HowManyBooleans := 0;
        CurrentPlayer := 0;
        if (GetArrayLength(Players) = 0) then
          AddUser;
        Safeinitform;
        SafeShowFormModal;
        FreeForm(frmDesign);
        Writeln('Using '+IntToStr(HowManyPlayers)+' Players');
        LoadPlayerArray;
        NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
      End;

    Begin
      StartTheShow;
    End.
    ---------------------------------------------------------


    Pm me if you need any math functions made. Me = l0ving t3h mathz

    ---------------------------------------------------------

  17. #17
    Join Date
    Aug 2007
    Posts
    429
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    what line is it in?

  18. #18
    Join Date
    Jun 2007
    Location
    I'm not sure...
    Posts
    581
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    At the end of my ShowFormModal procedure.. lemme get the text...
    SCAR Code:
    procedure ShowFormModal;
    begin
      frmDesign.ShowModal;
    end;//Here is where I get the error, so it could be anywhere. It is more than like
    //-ly in the loadus proc.
    ---------------------------------------------------------


    Pm me if you need any math functions made. Me = l0ving t3h mathz

    ---------------------------------------------------------

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Forms
    By marre in forum OSR Help
    Replies: 2
    Last Post: 12-19-2007, 07:53 PM
  2. Need help with forms!
    By Da Der Der in forum OSR Help
    Replies: 2
    Last Post: 01-14-2007, 07:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •