Results 1 to 8 of 8

Thread: Types

  1. #1
    Join Date
    Feb 2006
    Location
    Belgium
    Posts
    3,137
    Mentioned
    3 Post(s)
    Quoted
    5 Post(s)

    Default Types

    Ok, it has come to my attention that we don't use scar at it's full potential, so for those who don't know, here's a lesson.
    Most of you have propably already heard about the TPoint sometime...
    It is a variable that can contain an X and Y value.
    Now, we can make our own variable types!
    Most propably dunno this so watch carefully...
    It works somewhat as defining variables...
    You have ur script:
    Code:
    program New;
    begin
    end.
    Now we can add underneath program "var ..." but in this case we are going to add "type":
    Code:
    program New;
    type
    
    begin
    end.
    Now we will create a variable with X1, Y1, X2, Y2. We'll call it TBox.
    It has to be done like this:
    Code:
    program New;
    type
      TBox = record
        X1, Y1, X2, Y2: Integer;
      end;
      
    begin
    end.
    Now what if we want to use an array of our variable? Well you could write "array of TBox" every time, but you can do it another way as well, We create a TBoxArray like this:
    Code:
    program New;
    type
      TBox = record
        X1, Y1, X2, Y2: Integer;
      end;
      TBoxArray = array of TBox;
      
    begin
    end.
    And finally we can create closed arrays:
    Code:
    program New;
    type
      TBox = record
        X1, Y1, X2, Y2: Integer;
      end;
      TBoxArray = array of TBox;
      TBoxClosedArray = array[1..5] of Integer;
      
    begin
    end.
    Now, this is just a part of the possibilitys, but i hoped everyone who read this learned something...

  2. #2
    Join Date
    Feb 2006
    Location
    Australia, NSW.
    Posts
    1,461
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    We know how to use type, and it is used in SRL..

  3. #3
    Join Date
    Feb 2006
    Location
    L.A, USA
    Posts
    1,632
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    <3 PlayerArrays. good read!

  4. #4
    Join Date
    Feb 2006
    Location
    New Zealand
    Posts
    1,330
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by XxKanexX
    We know how to use type, and it is used in SRL..
    Ahhh so you know it........What about the people who dont know it?

  5. #5
    Join Date
    Feb 2006
    Location
    Australia, NSW.
    Posts
    1,461
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    He was implying that know one knew what it meant. By "We" i meant most of the Developers.

  6. #6
    Join Date
    Feb 2006
    Location
    New Zealand
    Posts
    485
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I learnt quite a bit freddy, thanks.

  7. #7
    Join Date
    Feb 2006
    Location
    Belgium
    Posts
    3,137
    Mentioned
    3 Post(s)
    Quoted
    5 Post(s)

    Default

    I wasen't talking about everyone, kane -_-"
    Most srl devs know an incredible load of scar stuff, this is more for the people who aren't devs, c?
    There are people who think playerarrays are standard scar stuff, let alone how to make types

  8. #8
    Join Date
    Feb 2006
    Location
    Australia, NSW.
    Posts
    1,461
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    I mis-understood. By the first line i meant we don't use such in SRL. Sorry.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Types in Functions?
    By FrÕzÑ_§ÕµL in forum OSR Help
    Replies: 6
    Last Post: 03-31-2008, 03:14 AM
  2. Types!
    By SKy Scripter in forum Outdated Tutorials
    Replies: 6
    Last Post: 10-15-2007, 03:39 AM
  3. Types of loops
    By ~alex~ in forum Outdated Tutorials
    Replies: 6
    Last Post: 05-07-2007, 08:41 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
  •