Results 1 to 6 of 6

Thread: Data Types

  1. #1
    Join Date
    Feb 2007
    Posts
    849
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Data Types

    Hey

    Is it possible to make my own data type?
    Instead of having lots of messy arrays, I'd like to create an object/data type for a Dungeoneering bot. It will contain each rooms data, such as doors, locked doors, spawn point, cleared, etc etc.

    (A class would do, if Simba supports classes).

    Simba Code:
    NewDataType Room
    {
    id: integer;
    doors: integer;
    doorLocations: TPointArray;
    isSpawn: boolean;
    }

    Then say we have three rooms as objects/data types (whatever), searching through them for something for example, what room is the spawn. (I could have a seperate variable for that (in global vars), but it's just an example.)
    ________________________________________
    14:19 < cycrosism> I wonder what she would have done without it
    14:19 < cycrosism> without me*
    Cycrosism is now an it.
    Quote Originally Posted by Dervish View Post
    /Facedesk.

  2. #2
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    Yes it it!

    Simba Code:
    type
      THarryJames = record
        Age : Integer;
        Location : String;
      end;

    begin
    end.
    I just made a HarryJames type!

  3. #3
    Join Date
    Feb 2007
    Posts
    849
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Usage is as follows, correct?

    Simba Code:
    var
    Myself : THarryJames;
    Begin
    Myself.Age := 16;
    Myself.Location := "Narnia";

    writeln(Myself.Age);
    end;
    ________________________________________
    14:19 < cycrosism> I wonder what she would have done without it
    14:19 < cycrosism> without me*
    Cycrosism is now an it.
    Quote Originally Posted by Dervish View Post
    /Facedesk.

  4. #4
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

  5. #5
    Join Date
    Feb 2007
    Posts
    849
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks

    Would I be better off making a few variables in the TRoom record, or making another record for doors. You have to know their location, colour, shape, locked/unlocked. (That's it I think, for doors).
    ________________________________________
    14:19 < cycrosism> I wonder what she would have done without it
    14:19 < cycrosism> without me*
    Cycrosism is now an it.
    Quote Originally Posted by Dervish View Post
    /Facedesk.

  6. #6
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    Doesn't really matter.. The purpose of making a new type is really just to keep things more organized and less confusing.

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
  •