SRL Archive - General

how to create your own class?


yimboli

2010-10-16 15:58:12

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.

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/Article.asp?Name=OOExamplePlus), into a new script file and tried to compile it, getting the same error.

What am I doing wrong?

noidea

2010-10-16 16:19:34

Actually, the interpreter Simba is using atm does not support making your own class :/

yimboli

2010-10-16 16:24:15

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?

i luffs yeww

2010-10-16 16:51:36

No.

http://villavu.com/forum/showthread.php?t=54898
http://villavu.com/forum/showthread.php?t=43158
http://villavu.com/forum/showthread.php?t=40661

One of those should help.

noidea

2010-10-16 17:00:35

From: i luffs yeww
No.

to what? A type/record is definitely not a class.

i luffs yeww

2010-10-16 18:18:26

¯\(°_o)/¯

Markus

2010-10-16 18:22:02

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.