Results 1 to 5 of 5

Thread: Booleans[0] help

  1. #1
    Join Date
    Jan 2010
    Posts
    1,414
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default Booleans[0] help

    Alright, so I was playing around with coding, trying to learn some of the new recommended stuff since I've been gone for a while due to real life stuff.
    I decided to try the 'Booleans[0]' thing for DeclarePlayers;. But when I try to use it in an If statement, it won't work for some reason. I'm using them on line 48 and 53, by the way.

    Am I missing something here? Or am I just using it wrong? It gives me this error:
    [Error] (49:18): Unknown identifier 'Booleans' at line 48
    Compiling failed.
    SCAR Code:
    program New;
    {$i SRL/SRl.scar}

    var X, Y : Integer;

    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      with Players[0] do
      begin
        Name := '';
        Pass := '';
        Nick := '';
        Pin  := '';
        Booleans[0] := False; // Powerchopping = False - Banking = True
      end;
    end;

    procedure Antiban;
    begin
      if not LoggedIn then Exit;

      case Random(3042 + Random (601)) of
        0  .. 12   : HoverSkill('Woodcutting', False);
        13 .. 15   : HoverSkill('Constitution', False);
        16 .. 21   : HoverSkill('Fletching', False);
        36 .. 54   : begin
                       case Random(3) of
                         0 : MakeCompass('N');
                         1 : MakeCompass('S');
                         2 : MakeCompass('W');
                         3 : MakeCompass('E');
                       end;
                     end;
        103 .. 110 : MouseSpeed := 9 + Random (4);
        250 .. 302 : RandomAngle('');
      end;
    end;

    procedure FindAndChopTree;
    begin
      if not LoggedIn then Exit;

      // If our inventory is full and we are powerchopping
      if InvFull and Booleans[0] = False then
      begin

      end else
      // If our inventory is full and we are banking
      if InvFull and Booleans[0] = True then
      begin
      end else

    end;

    begin
    end.

    Thanks in advance for any help.

  2. #2
    Join Date
    Sep 2009
    Posts
    580
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    As you can see, in the DeclarePlayers procedure, there is a part that goes :
    SCAR Code:
    with Players[0] do//HERE
      begin
        Name := '';
        Pass := '';
        Nick := '';
        Pin  := '';
      end;

    This means that the variables are set for Players[0], meaning that you can use Players[0].Booleans[0], Players[0].Pin, Players[0].Nick, etc.
    I don't check this place often, sorry.

    Currently working on - Software Engineering degree. Thank you SRL for showing me the one true path

  3. #3
    Join Date
    Jan 2010
    Posts
    1,414
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Well thanks for the help. But that's not really what I was looking for. What I was looking for was:

    If I perhaps wanted to use that Players[0].Booleans in an If statement, what would I have to do? Because it gives me an error every time I try to do:
    SCAR Code:
    procedure FindAndChopTree;
    begin
      if not LoggedIn then Exit;

      // If our inventory is full and we are powerchopping
      if InvFull and Booleans[0] = False then
      begin

      end else
      // If our inventory is full and we are banking
      if InvFull and Booleans[0] = True then
      begin
      end else

    end;

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

    Default

    Quote Originally Posted by Risk View Post
    Well thanks for the help. But that's not really what I was looking for. What I was looking for was:

    If I perhaps wanted to use that Players[0].Booleans in an If statement, what would I have to do? Because it gives me an error every time I try to do:
    SCAR Code:
    procedure FindAndChopTree;
    begin
      if not LoggedIn then Exit;

      // If our inventory is full and we are powerchopping
      if InvFull and Booleans[0] = False then
      begin

      end else
      // If our inventory is full and we are banking
      if InvFull and Booleans[0] = True then
      begin
      end else

    end;
    Cigue just explained what you would have to do. You have to access the Players array and then the Booleans variable inside that. Those two lines of code could be:

    Code:
    if InvFull and not(Players[CurrentPlayer].Booleans[0])
    if InvFull and Players[CurrentPlayer].Booleans[0]
    :-)

  5. #5
    Join Date
    Jan 2010
    Posts
    1,414
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Oh, I see. Thank you very much for your help, you two. I really appreciate it. I didn't mean to misunderstand. I just learn better from examples and explanation.

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
  •