Results 1 to 9 of 9

Thread: Function DefineLoopDuration

  1. #1
    Join Date
    Jun 2007
    Posts
    1,312
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Function DefineLoopDuration

    SCAR Code:
    function DefineLoopDuration: integer;
    begin                              
    for I:=0 to HowManyPlayers-1 do
    begin
    writeln(Players[I].Name + inttostr(Players[I].Integers[0]));
    Result := Result + Players[I].Integers[0];
    Definition := Result;
    end;
    Writeln('This loop shall run for '+inttostr(Result) + ' loads over ' +
    inttostr(howmanyplayers) + ' players');
    end;
    This works, except I would like to know how I could get it to say the player's name.
    Active only during the Summer...

  2. #2
    Join Date
    Nov 2006
    Location
    NSW, Australia
    Posts
    3,487
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    function DefineLoopDuration: integer;
    begin                              
    for I:=0 to HowManyPlayers-1 do
    begin
      WriteLn(Players[I].Name + IntToStr(Players[I].Integers[0]));
      Result := Result + Players[I].Name + Players[I].Integers[0];
      Definition := Result;
    end;
      Writeln('This loop shall run for '+ IntToStr(Result) + ' loads over ' + IntToStr(HowManyPlayers) + ' players');
    end;

    There.
    [CENTER][img]http://signatures.mylivesignature.com/54486/113/4539C8FAAF3EAB109A3CC1811EF0941B.png[/img][/CENTER]
    [CENTER][BANANA]TSN ~ Vacation! ~ says :I Love Santy[/BANANA][/CENTER]

    [CENTER][BANANA]Raymond - Oh rilie? says :Your smart[/BANANA][/CENTER]

  3. #3
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    Not trying to attack your function, but whats the usage except for telling the user how many loads in total there will be?

  4. #4
    Join Date
    Jun 2007
    Posts
    1,312
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    If you put in 'Until x = Definition' then it will go through the loop until x =...well, definition. The writeln tells the person how long the loop will run, and how many per character, just so they feel safe and my function looks bigger.

    Yours doesn't compile for me Santa. "Type mismatch"

    And the thing that I want to change is in writeln anyway.
    (Oh yes, and you have to put this in declareplayers.)
    SCAR Code:
    procedure DeclarePlayers;
    begin
      HowManyPlayers := 5;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      Players[0].Name := '';
      Players[0].Pass := '';
      Players[0].Nick := '';
      Players[0].Active := True;
      Players[0].Loc := 'Bank'
      Players[0].Integers[0] := 5      //Loads for this character to do

      Players[1].Name := '';
      Players[1].Pass := '';
      Players[1].Nick := '';
      Players[1].Active := False;
      Players[1].Loc := 'Bank'
      Players[1].Integers[0] := 5      //Loads for this character to do

      Players[2].Name := '';
      Players[2].Pass := '';
      Players[2].Nick := '';
      Players[2].Active := False;
      Players[2].Loc := 'Bank'
      Players[2].Integers[0] := 5      //Loads for this character to do

      Players[3].Name := '';
      Players[3].Pass := '';
      Players[3].Nick := '';
      Players[3].Active := False;
      Players[3].Loc := 'Bank'
      Players[3].Integers[0] := 5      //Loads for this character to do

      Players[4].Name := '';
      Players[4].Pass := '';
      Players[4].Nick := '';
      Players[4].Active := False;
      Players[4].Loc := 'Bank'
      Players[4].Integers[0] := 5      //Loads for this character to do

      DefineLoopDuration;
      NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
    Right now the debug box gives me
    5
    5
    5
    5
    5
    This loop shall run for 25 loads over 5 players
    0
    Error detecting Compass Angle.
    Successfully executed
    Which I want to say
    SCAR Code:
    (Name) 5
    (Name) 5
    (Name) 5
    (Name) 5
    (Name) 5
    This loop shall run for 25 loads over 5 players
    0
    Error detecting Compass Angle.
    Successfully executed
    Also, I know this is very basic, but it will help in anything using multiplayer and integers[0] because it sets the loops length for the people after they say how many loads on each individual character.
    Active only during the Summer...

  5. #5
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    (Name) 5
    (Name) 5
    (Name) 5
    (Name) 5
    (Name) 5
    This loop shall run for 25 loads over 5 players
    Writeln('One Player = '+IntTostr(Players[CurrentPlayer].Integers[0]' Loads!+' Loads)<---
    Error detecting Compass Angle.
    Successfully executed
    Could try this

  6. #6
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    SCAR Code:
    function DefineLoopDuration: integer;
    begin                              
    for I:=0 to HowManyPlayers-1 do
      begin
        WriteLn(Players[i].Name + IntToStr(Players[i].Integers[0]));
        Result := Result + Players[i].Integers[0];
        Definition := Result;
      end;
      Writeln('This loop shall run for '+ IntToStr(Result) + ' loads over ' + IntToStr(HowManyPlayers) + ' players');
    end;

    Try that, Santa put the name in result for some odd reason. (noob)
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

  7. #7
    Join Date
    Nov 2006
    Location
    NSW, Australia
    Posts
    3,487
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    I think I posted the answer to your question on another thread...
    [CENTER][img]http://signatures.mylivesignature.com/54486/113/4539C8FAAF3EAB109A3CC1811EF0941B.png[/img][/CENTER]
    [CENTER][BANANA]TSN ~ Vacation! ~ says :I Love Santy[/BANANA][/CENTER]

    [CENTER][BANANA]Raymond - Oh rilie? says :Your smart[/BANANA][/CENTER]

  8. #8
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    I saw that, I was wondering why you posted it in his other thread.
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

  9. #9
    Join Date
    Jun 2007
    Posts
    1,312
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Oh what the heck! Mine was right to begin with, the reason it wasn't giving you the player name was because the multiplayer I was using was blank!
    OK, so the one that works best is
    SCAR Code:
    Procedure DefineLoopDuration;
    begin
    for I:=0 to HowManyPlayers-1 do
    begin
    writeln(Players[i].Name + ' ' + inttostr(Players[i].Integers[0]));
    Result := Result + Players[i].Integers[0];
    Definition := Result;
    end;
    Writeln('This loop shall run for '+inttostr(Result) + ' loads over ' +
    inttostr(howmanyplayers) + ' players');
    end;
    ...lol ( <------ Dumb)
    Edit: Looking back, how is this a function to begin with?..Fixing it.
    Active only during the Summer...

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 02-27-2008, 05:20 PM
  2. Replies: 2
    Last Post: 02-26-2008, 08:26 PM
  3. [FUNCTION] FindDoorColour: integer; By ZephyrsFury [FUNCTION]
    By ZephyrsFury in forum Research & Development Lounge
    Replies: 10
    Last Post: 07-27-2007, 08:45 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
  •