Results 1 to 7 of 7

Thread: how to create your own class?

  1. #1
    Join Date
    Oct 2009
    Posts
    4
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default how to create your own class?

    I'm trying to create some objects to make things easier in a script I'm running for a browser game (not RS). I've found some Delphi guides online for creating classes, records, units, etc. What I need is to create a class. In this case, it will represent a planet in the game (which is space-based). It is in a separate include file (planet.scar) but I cannot get this include file to compile, and I get the same error when I include it in the main script and attempt to run it. In an attempt to eliminate any possible code syntax errors I've commented out all the declared variables/functions and just left the most basic code. Below is literally the entire planet.scar file.

    SCAR Code:
    type
      TPlanet = class

      private
        //plName : string;



      published

        //constructor Create();

        //procedure Update(TradeHTML : string);

      end;

    This is the error when I compile. It moves the cursor right after the equal sign (line 2 # 11)
    Failed when compiling
    Line 2: [Error] (2:11): Identifier expected in script D:\Program Files (x86)\SCAR 3.21\includes\Pardus\PardusPlanet.scar

    I've even tried copying/pasting the entire "Stringy" example class, located here (http://www.delphibasics.co.uk/Articl...=OOExamplePlus), into a new script file and tried to compile it, getting the same error.

    What am I doing wrong?

  2. #2
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Actually, the interpreter Simba is using atm does not support making your own class :/
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

  3. #3
    Join Date
    Oct 2009
    Posts
    4
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I'm using SCAR. It's a bit complicated why I can't use Simba, but basically it's because I run Windows Vista and SCAR has resources that let me get around that which Simba does not. I'd prefer Simba, but it's not an option at the moment.

    Does what you said also apply to SCAR?

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

  5. #5
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Quote Originally Posted by i luffs yeww View Post
    No.
    to what? A type/record is definitely not a class.
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

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

    Default

    ¯\(°_o)/¯

  7. #7
    Join Date
    Feb 2007
    Location
    Het ademt zwaar en moedeloos vannacht.
    Posts
    7,211
    Mentioned
    26 Post(s)
    Quoted
    72 Post(s)

    Default

    To end the spam: The interpreter used by SCAR and Simba (currently Pascalscript) doesn't support creating your own classes. You can try records but that isn't really what you want I think..
    /thread closed.
    I made a new script, check it out!.

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
  •