Results 1 to 15 of 15

Thread: Advanced Form Problem

  1. #1
    Join Date
    Mar 2007
    Location
    Nr. Leeds, Uk
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Advanced Form Problem

    I am Making A Form For An Auto Fighter, On This Form Is A List Of Possible Enemys Already Stored In The Script (Meaning Color Selecting Isn't Needed) But I Can't Relay The Information From The Form To The Required Part Of The Script.

    Now I Know How To Use Scripts And How To Moved Certain Parts Of Details, Eg.
    Players[0].Name :=UsernameBoxAF.text;
    Players[0].Pass :=PasswordBoxAF.text;

    But I Havn't Used 'List Boxes' Before, And With List Box All The Possible Choices Are Visable And The User Simply Selects From The List, But After Selecting, How Do I Set The Selected Elsewere In The Script?

    Here Is The Part Of The Form I Wish To Take Information From

    SCAR Code:
    MonsterBoxAF := TListBox.Create(frmDesign);
    MonsterBoxAF.Parent := frmDesign;
    MonsterBoxAF.Left := 408;
    MonsterBoxAF.Top := 24;
    MonsterBoxAF.Width := 121;
    MonsterBoxAF.Height := 166;
    MonsterBoxAF.Font.Color := clBlack;
    MonsterBoxAF.Font.Height := -11;
    MonsterBoxAF.Font.Name := 'MS Sans Serif';
    MonsterBoxAF.Font.Style := [];
    MonsterBoxAF.ItemHeight := 13;
    MonsterBoxAF.Items.Add('Barbarians');
    MonsterBoxAF.Items.Add('Bears');
    MonsterBoxAF.Items.Add('Chickens');
    MonsterBoxAF.Items.Add('Cows');
    MonsterBoxAF.Items.Add('Dwarfs');
    MonsterBoxAF.Items.Add('Goblins');
    MonsterBoxAF.Items.Add('Guards');
    MonsterBoxAF.Items.Add('Hill Giants');
    MonsterBoxAF.Items.Add('Lesser Demons');
    MonsterBoxAF.Items.Add('People');
    MonsterBoxAF.Items.Add('Pirates');
    MonsterBoxAF.Items.Add('Rats');
    MonsterBoxAF.Items.Add('Scorpion');
    MonsterBoxAF.Items.Add('Skeletons');
    MonsterBoxAF.Items.Add('Theifs');
    MonsterBoxAF.Items.Add('White Knights');
    MonsterBoxAF.Items.Add('Zombies');
    MonsterBoxAF.ParentFont := False;
    MonsterBoxAF.Sorted := True;
    MonsterBoxAF.TabOrder := 17;

    Please Help.

  2. #2
    Join Date
    Feb 2006
    Posts
    433
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    MonsterBoxAF.Items[MonsterBoxAF.ItemIndex].Text

  3. #3
    Join Date
    Mar 2007
    Location
    Nr. Leeds, Uk
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Spky View Post
    SCAR Code:
    for I:= 0 to MonsterBoxAF.Items.Count - 1 do
     if MonsterBoxAF.Selected[I] then
      begin
       ...
       Writeln(MonsterBoxAF.Items[I].Text)
      end;
    That Doesn't Work, Or Maybe Im Using It Wrong, Can You Please Explain How To Use It.

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

    Default

    Simple use

    Players[CurrentPlayer].String1 := MonsterBoxAF.Text;
    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!


  5. #5
    Join Date
    Feb 2006
    Posts
    433
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Starblaster100 View Post
    Simple use
    Players[CurrentPlayer].String1 := MonsterBoxAF.Text;
    Listbox's don't have a text property.


    Anyways, yeh, mine should have been:
    Writeln(MonsterBoxAF.Items.Strings[I]);
    Heres a quick example of how to use it:

    SCAR Code:
    program New;

    var
     frmDesign : TForm;
     MonsterBoxAF : TListBox;

    procedure FormClosing(Sender: TObject; var Action: TCloseAction);
    var
      I : Integer;
    begin
     for I:= 0 to MonsterBoxAF.Items.Count - 1 do
      if MonsterBoxAF.Selected[i] then
       Writeln(MonsterBoxAF.Items.Strings[I]);
    end;

    procedure InitForm;
    begin
     frmDesign := CreateForm;
     frmDesign.Left := 250;
     frmDesign.Top := 114;
     frmDesign.Width := 696;
     frmDesign.Height := 480;
     frmDesign.Caption := 'frmDesign';
     frmDesign.Color := clBtnFace;
     frmDesign.Font.Color := clWindowText;
     frmDesign.Font.Height := -11;
     frmDesign.Font.Name := 'MS Sans Serif';
     frmDesign.Font.Style := [];
     frmDesign.Visible := False;
     frmDesign.PixelsPerInch := 96;
     frmDesign.OnClose:= @FormClosing;

     MonsterBoxAF := TListBox.Create(frmDesign);
     MonsterBoxAF.Parent := frmDesign;
     MonsterBoxAF.Left := 408;
     MonsterBoxAF.Top := 24;
     MonsterBoxAF.Width := 121;
     MonsterBoxAF.Height := 166;
     MonsterBoxAF.Font.Color := clBlack;
     MonsterBoxAF.Font.Height := -11;
     MonsterBoxAF.Font.Name := 'MS Sans Serif';
     MonsterBoxAF.Font.Style := [];
     MonsterBoxAF.ItemHeight := 13;
     MonsterBoxAF.Items.Add('Barbarians');
     MonsterBoxAF.Items.Add('Bears');
     MonsterBoxAF.Items.Add('Chickens');
     MonsterBoxAF.Items.Add('Cows');
     MonsterBoxAF.Items.Add('Dwarfs');
     MonsterBoxAF.Items.Add('Goblins');
     MonsterBoxAF.Items.Add('Guards');
     MonsterBoxAF.Items.Add('Hill Giants');
     MonsterBoxAF.Items.Add('Lesser Demons');
     MonsterBoxAF.Items.Add('People');
     MonsterBoxAF.Items.Add('Pirates');
     MonsterBoxAF.Items.Add('Rats');
     MonsterBoxAF.Items.Add('Scorpion');
     MonsterBoxAF.Items.Add('Skeletons');
     MonsterBoxAF.Items.Add('Theifs');
     MonsterBoxAF.Items.Add('White Knights');
     MonsterBoxAF.Items.Add('Zombies');
     MonsterBoxAF.ParentFont := False;
     MonsterBoxAF.Sorted := True;
     MonsterBoxAF.TabOrder := 17;
    end;

    procedure ShowForm;
    begin
     frmDesign.ShowModal;
    end;

    procedure LoadForm;
    var
     Va : TVariantArray;
    begin
     SetArrayLength(Va, 0);
     ThreadSafeCall('InitForm', Va);
     ThreadSafeCall('ShowForm', Va);
    end;

    begin
     LoadForm;
    end.

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

    Default

    oops sorry my bad, thought it was a combobox
    Nice catch
    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!


  7. #7
    Join Date
    Mar 2007
    Location
    Nr. Leeds, Uk
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks SPKY Your A legend, and may i also state it is an honour haveing starblaster reply on one of my posts, your are my scripting idol! thanks again ppl
    !

  8. #8
    Join Date
    Mar 2007
    Location
    Nr. Leeds, Uk
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Sorry People But My Script Now Encounters This Error

    [Runtime Error] : List index out of bounds (17) in line 85 in script C:\Program Files\SCAR 2.03\Scripts\ultimateAutoFighter.scar

    is this becouse im using the;

    MonsterBoxAF.Items.Strings[i]

    multiple times?
    if so how can i fix it???

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

    Default

    thanks for the compliments,

    It may help us if you post the script parts, so we can find out where the error is occurring
    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!


  10. #10
    Join Date
    Mar 2007
    Location
    Nr. Leeds, Uk
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default The Problemed Parts

    Ok Starblaster and Spky and anyone who wants to help ;p
    here is the problemed parts of the script, i'm not posting it all cos its long and messy lol.

    SCAR Code:
    /////////////////////////////////////////////////////
    ///    Heres Were The Information comes from     ///
    ////////////////////////////////////////////////////
    MonsterBoxAF := TListBox.Create(frmDesign);
    MonsterBoxAF.Parent := frmDesign;
    MonsterBoxAF.Left := 408;
    MonsterBoxAF.Top := 24;
    MonsterBoxAF.Width := 121;
    MonsterBoxAF.Height := 166;
    MonsterBoxAF.Font.Color := clBlack;
    MonsterBoxAF.Font.Height := -11;
    MonsterBoxAF.Font.Name := 'MS Sans Serif';
    MonsterBoxAF.Font.Style := [];
    MonsterBoxAF.ItemHeight := 13;
    MonsterBoxAF.Items.Add('Barbarians');
    MonsterBoxAF.Items.Add('Bears');
    MonsterBoxAF.Items.Add('Chickens');
    MonsterBoxAF.Items.Add('Cows');
    MonsterBoxAF.Items.Add('Dwarfs');
    MonsterBoxAF.Items.Add('Goblins');
    MonsterBoxAF.Items.Add('Guards');
    MonsterBoxAF.Items.Add('Hill Giants');
    MonsterBoxAF.Items.Add('Lesser Demons');
    MonsterBoxAF.Items.Add('People');
    MonsterBoxAF.Items.Add('Pirates');
    MonsterBoxAF.Items.Add('Rats');
    MonsterBoxAF.Items.Add('Scorpion');
    MonsterBoxAF.Items.Add('Skeletons');
    MonsterBoxAF.Items.Add('Theifs');
    MonsterBoxAF.Items.Add('White Knights');
    MonsterBoxAF.Items.Add('Zombies');
    MonsterBoxAF.ParentFont := False;
    MonsterBoxAF.Sorted := True;
    MonsterBoxAF.TabOrder := 17;

    SCAR Code:
    ///////////////////////////////////////////
    ///   heres were the information goes   ///
    ///////////////////////////////////////////

    for I:= 0 to MonsterBoxAF.Items.Count - 1 do

      If(MonsterBoxAF.Items.Strings[i] = 'Barbarians') then
       MColor1AF:=0 MColor2AF:=0 MColor3AF:=0 MNameAF:='' BigBones:=False;
       If(MonsterBoxAF.Items.Strings[i] = 'Bears') then
       MColor1AF:=0 MColor2AF:=0 MColor3AF:=0 MNameAF:=''BigBones:=False;
       If(MonsterBoxAF.Items.Strings[i] = 'Chickens') then
       MColor1AF:=0 MColor2AF:=0 MColor3AF:=0 MNameAF:=''BigBones:=False;
       If(MonsterBoxAF.Items.Strings[i] = 'Cows') then
       MColor1AF:=0 MColor2AF:=0 MColor3AF:=0 MNameAF:=''BigBones:=False;
       If(MonsterBoxAF.Items.Strings[i] = 'Dwarfs') then
       MColor1AF:=0 MColor2AF:=0 MColor3AF:=0 MNameAF:=''BigBones:=False;
       If(MonsterBoxAF.Items.Strings[i] = 'Goblins') then
       MColor1AF:=0 MColor2AF:=0 MColor3AF:=0 MNameAF:=''BigBones:=False;
       If(MonsterBoxAF.Items.Strings[i] = 'Guards') then
       MColor1AF:=527686 MColor2AF:=1055881 MColor3AF:=1353126 MNameAF:='Guard' BigBones:=False;
      If(MonsterBoxAF.Items.Strings[i] = 'Hill Giants') then
       MColor1AF:=9417177 MColor2AF:=5987442 MColor3AF:=3557470 MNameAF:='Hill Giant' BigBones:=True;
       If(MonsterBoxAF.Items.Strings[i] = 'Lesser Demons') then
       MColor1AF:=0 MColor2AF:=0 MColor3AF:=0 MNameAF:='';
       If(MonsterBoxAF.Items.Strings[i] = 'People') then
       MColor1AF:=16192 MColor2AF:=858494 MColor3AF:=2100 MNameAF:='' BigBones:=False;
       If(MonsterBoxAF.Items.Strings[i] = 'Pirates') then
       MColor1AF:=0 MColor2AF:=0 MColor3AF:=0 MNameAF:='' BigBones:=False;
       If(MonsterBoxAF.Items.Strings[i] = 'Rats') then
       MColor1AF:=0 MColor2AF:=0 MColor3AF:=0 MNameAF:='' BigBones:=False;
       If(MonsterBoxAF.Items.Strings[i] = 'Scorpion') then
       MColor1AF:=0 MColor2AF:=0 MColor3AF:=0 MNameAF:='' BigBones:=False;
       If(MonsterBoxAF.Items.Strings[i] = 'Skeletons') then
       MColor1AF:=0 MColor2AF:=0 MColor3AF:=0 MNameAF:='' BigBones:=False;
       If(MonsterBoxAF.Items.Strings[i] = 'Theifs') then
       MColor1AF:=15065829 MColor2AF:=8082274 MColor3AF:=2106 MNameAF:='Thief' BigBones:=False;
       If(MonsterBoxAF.Items.Strings[i] = 'White Knights') then
       MColor1AF:=0 MColor2AF:=0 MColor3AF:=0 MNameAF:='' BigBones:=False;
       If(MonsterBoxAF.Items.Strings[i] = 'Zombies') then
       MColor1AF:=0 MColor2AF:=0 MColor3AF:=0 MNameAF:='' BigBones:=False;

    and the error which accurs is

    [Runtime Error] : List index out of bounds (17) in line 85 in script C:\Program Files\SCAR 2.03\Scripts\ultimateAutoFighter.scar


    thanks for any help.

  11. #11
    Join Date
    Feb 2007
    Location
    USA
    Posts
    667
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Wow, first of all, you need to add a begin after 'do' and an end wherever you want the loop to stop. Secondly, if you want more than one action to happen as a result of an if statement, you need to enclose it in a begin-end block.

    So you have this:
    SCAR Code:
    If(MonsterBoxAF.Items.Strings[i] = 'Chickens') then
       MColor1AF:=0 MColor2AF:=0 MColor3AF:=0 MNameAF:=''BigBones:=False;
    Even if the string does not = 'chickens', all the stuff after MColor1AF:=0 will happen anyway. You probably want this.

    SCAR Code:
    If(MonsterBoxAF.Items.Strings[i] = 'Chickens') then
    begin
       MColor1AF:=0 MColor2AF:=0 MColor3AF:=0 MNameAF:=''BigBones:=False;
    end;

    Fix that stuff first, and then we'll worry about the out of bounds.

  12. #12
    Join Date
    Mar 2007
    Location
    Nr. Leeds, Uk
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Cant find varibles

    I have changed my script like you said so it now looks like this...

    SCAR Code:
    begin
    for I:= 0 to MonsterBoxAF.Items.Count - 1 do
     begin
       If(MonsterBoxAF.Items.Strings[i] = 'Barbarians') then
      Begin
       MColor1AF:=0 MColor2AF:=0 MColor3AF:=0 MNameAF:='' BigBones:=False;
      end;
      If(MonsterBoxAF.Items.Strings[i] = 'Bears') then
      Begin
       MColor1AF:=0 MColor2AF:=0 MColor3AF:=0 MNameAF:=''BigBones:=False;
      end;
       If(MonsterBoxAF.Items.Strings[i] = 'Chickens') then
      Begin
       MColor1AF:=0 MColor2AF:=0 MColor3AF:=0 MNameAF:=''BigBones:=False;
      end;
       If(MonsterBoxAF.Items.Strings[i] = 'Cows') then
      Begin
       MColor1AF:=0 MColor2AF:=0 MColor3AF:=0 MNameAF:=''BigBones:=False;
      end;
       If(MonsterBoxAF.Items.Strings[i] = 'Dwarfs') then
      Begin
       MColor1AF:=0 MColor2AF:=0 MColor3AF:=0 MNameAF:=''BigBones:=False;
      end;
       If(MonsterBoxAF.Items.Strings[i] = 'Goblins') then
      Begin
       MColor1AF:=0 MColor2AF:=0 MColor3AF:=0 MNameAF:=''BigBones:=False;
      end;
       If(MonsterBoxAF.Items.Strings[i] = 'Guards') then
      Begin
       MColor1AF:=527686 MColor2AF:=1055881 MColor3AF:=1353126 MNameAF:='Guard' BigBones:=False;
      end;
       If(MonsterBoxAF.Items.Strings[i] = 'Hill Giants') then
      Begin
       MColor1AF:=9417177 MColor2AF:=5987442 MColor3AF:=3557470 MNameAF:='Hill Giant' BigBones:=True;
      end;
       If(MonsterBoxAF.Items.Strings[i] = 'Lesser Demons') then
      Begin
       MColor1AF:=0 MColor2AF:=0 MColor3AF:=0 MNameAF:='';
      end;
       If(MonsterBoxAF.Items.Strings[i] = 'People') then
      Begin
       MColor1AF:=16192 MColor2AF:=858494 MColor3AF:=2100 MNameAF:='' BigBones:=False;
      end;
       If(MonsterBoxAF.Items.Strings[i] = 'Pirates') then
      Begin
       MColor1AF:=0 MColor2AF:=0 MColor3AF:=0 MNameAF:='' BigBones:=False;
      end;
       If(MonsterBoxAF.Items.Strings[i] = 'Rats') then
      Begin
       MColor1AF:=0 MColor2AF:=0 MColor3AF:=0 MNameAF:='' BigBones:=False;
      end;
       If(MonsterBoxAF.Items.Strings[i] = 'Scorpion') then
      Begin
       MColor1AF:=0 MColor2AF:=0 MColor3AF:=0 MNameAF:='' BigBones:=False;
      end;
       If(MonsterBoxAF.Items.Strings[i] = 'Skeletons') then
      Begin
       MColor1AF:=0 MColor2AF:=0 MColor3AF:=0 MNameAF:='' BigBones:=False;
      end;
       If(MonsterBoxAF.Items.Strings[i] = 'Theifs') then
      Begin
       MColor1AF:=15065829 MColor2AF:=8082274 MColor3AF:=2106 MNameAF:='Thief' BigBones:=False;
      end;
       If(MonsterBoxAF.Items.Strings[i] = 'White Knights') then
      Begin
       MColor1AF:=0 MColor2AF:=0 MColor3AF:=0 MNameAF:='' BigBones:=False;
      end;
       If(MonsterBoxAF.Items.Strings[i] = 'Zombies') then
      Begin
       MColor1AF:=0 MColor2AF:=0 MColor3AF:=0 MNameAF:='' BigBones:=False;
       end;
     end;
    End;


    but now (although it runs) it can't find the enemy of anything, even the report doesn't give the MNameAF. Please Help.

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

    Default

    PHP Code:
    for I:= 0 to MonsterBoxAF.Items.Count do
    begin
      
    If(MonsterBoxAF.Items.Strings[i] = 'Barbarians'then
        MColor1AF
    :=0 MColor2AF:=0 MColor3AF:=0 MNameAF:='' BigBones:=False;
      If(
    MonsterBoxAF.Items.Strings[i] = 'Bears'then
        MColor1AF
    :=0 MColor2AF:=0 MColor3AF:=0 MNameAF:=''BigBones:=False;
      If(
    MonsterBoxAF.Items.Strings[i] = 'Chickens'then
        MColor1AF
    :=0 MColor2AF:=0 MColor3AF:=0 MNameAF:=''BigBones:=False;
      If(
    MonsterBoxAF.Items.Strings[i] = 'Cows'then
        MColor1AF
    :=0 MColor2AF:=0 MColor3AF:=0 MNameAF:=''BigBones:=False;
      If(
    MonsterBoxAF.Items.Strings[i] = 'Dwarfs'then
        MColor1AF
    :=0 MColor2AF:=0 MColor3AF:=0 MNameAF:=''BigBones:=False;
      If(
    MonsterBoxAF.Items.Strings[i] = 'Goblins'then
        MColor1AF
    :=0 MColor2AF:=0 MColor3AF:=0 MNameAF:=''BigBones:=False;
      If(
    MonsterBoxAF.Items.Strings[i] = 'Guards'then
        MColor1AF
    :=527686 MColor2AF:=1055881 MColor3AF:=1353126 MNameAF:='Guard' BigBones:=False;
      If(
    MonsterBoxAF.Items.Strings[i] = 'Hill Giants'then
        MColor1AF
    :=9417177 MColor2AF:=5987442 MColor3AF:=3557470 MNameAF:='Hill Giant' BigBones:=True;
      If(
    MonsterBoxAF.Items.Strings[i] = 'Lesser Demons'then
        MColor1AF
    :=0 MColor2AF:=0 MColor3AF:=0 MNameAF:='';
      If(
    MonsterBoxAF.Items.Strings[i] = 'People'then
        MColor1AF
    :=16192 MColor2AF:=858494 MColor3AF:=2100 MNameAF:='' BigBones:=False;
      If(
    MonsterBoxAF.Items.Strings[i] = 'Pirates'then
        MColor1AF
    :=0 MColor2AF:=0 MColor3AF:=0 MNameAF:='' BigBones:=False;
      If(
    MonsterBoxAF.Items.Strings[i] = 'Rats'then
        MColor1AF
    :=0 MColor2AF:=0 MColor3AF:=0 MNameAF:='' BigBones:=False;
      If(
    MonsterBoxAF.Items.Strings[i] = 'Scorpion'then
        MColor1AF
    :=0 MColor2AF:=0 MColor3AF:=0 MNameAF:='' BigBones:=False;
      If(
    MonsterBoxAF.Items.Strings[i] = 'Skeletons'then
        MColor1AF
    :=0 MColor2AF:=0 MColor3AF:=0 MNameAF:='' BigBones:=False;
      If(
    MonsterBoxAF.Items.Strings[i] = 'Theifs'then
        MColor1AF
    :=15065829 MColor2AF:=8082274 MColor3AF:=2106 MNameAF:='Thief' BigBones:=False;
      If(
    MonsterBoxAF.Items.Strings[i] = 'White Knights'then
        MColor1AF
    :=0 MColor2AF:=0 MColor3AF:=0 MNameAF:='' BigBones:=False;
      If(
    MonsterBoxAF.Items.Strings[i] = 'Zombies'then
        MColor1AF
    :=0 MColor2AF:=0 MColor3AF:=0 MNameAF:='' BigBones:=False;
    end
    You need to wrap everything in 1 big begin end;
    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!


  14. #14
    Join Date
    May 2006
    Posts
    1,230
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    u could have arrays to make it neater.. which u probally dont know how to do.. but to confuse u more.. i made a sample project

    SCAR Code:
    program Test;
    const
      MonsterName = 'Hill Giant';

    var
      i : integer;
      MonsterNames : Array Of String;
      MonsterColors1, MonsterColors2, MonsterColors3 : Array Of Integer;
      MonsterBones : Array Of Boolean;

      MonsterColor1, MonsterColor2, MonsterColor3 : Integer;
      RealMonster, BigBones : Boolean;

    begin

      MonsterNames   := ['Cow', 'Goblin', 'Hill Giant'];
      MonsterColors1 := [1234, 23432, 3];
      MonsterColors2 := [345834, 12321, 34];
      MonsterColors3 := [12312, 2343, 54];
      MonsterBones   := [False, False, True];
      for i := 0 to 2 do
      begin
        if MonsterNames[i] = MonsterName then
        begin
          MonsterColor1 := MonsterColors1[i];
          MonsterColor2 := MonsterColors2[i];
          MonsterColor3 := MonsterColors3[i];
          BigBones := MonsterBones[i];
          RealMonster := True;
        end;
      end;

      //Just to see if it works
      if RealMonster then
      begin
        Writeln('MonsterName := ' + MonsterName + ';');
        Writeln('MonsterColor1 := ' + Inttostr(MonsterColor1) + ';');
        Writeln('MonsterColor2 := ' + Inttostr(MonsterColor2) + ';');
        Writeln('MonsterColor3 := ' + Inttostr(MonsterColor3) + ';');
        if BigBones then
          Writeln('MonsterBones := True;')
        else
          Writeln('MonsterBones := False;');
      end else
      begin
        Writeln('Incorrect MonserName!!!');
        Writeln('Valid Arguments Are: Cow, Goblin, Hill Giant!');
      end;
    end.

  15. #15
    Join Date
    Mar 2007
    Location
    Nr. Leeds, Uk
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I've Tried Wrapping It In One Big Begining and End; But it still wont work!!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. c# advanced form collection
    By mpd in forum C/C++ Help and Tutorials
    Replies: 2
    Last Post: 05-06-2008, 09:45 PM
  2. Form Problem
    By Rulerofall in forum OSR Help
    Replies: 1
    Last Post: 12-27-2007, 01:14 AM

Posting Permissions

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