PDA

View Full Version : variable or type .create



Feroc1ty
03-07-2019, 09:44 PM
hey, just tried to run an example code in simba handbook and the example code wont compile for me, anyone give me points as to why its not working? i mean its in simbas documentation so im assuming something is wrong with my simba and not the code... anyways, this is the code and follows the syntax error.


program new;
var
Font : TFont;
begin
Font := TFont.Create;
Font.Name := 'Courier New';
Font.Size := 10;
Font.Style := [];
LoadSystemFont(Font,'test');
DisplayDebugImgWindow(0,0);
DisplayDebugImgWindow(150,50);
DrawBitmapDebugImg(BitmapFromText('BMP[0] has not been freed','test'));
Font.free;
end.

Error: Unknown declaration "Create" at line 5
Compiling failed.

daileyj93
03-08-2019, 02:33 PM
It doesn't look like that documentation has been updated since Simba switched from PascalScript to Lape. The following code should be the equivalent of what is in the docs (except for lape):

program new;
var
Font : TFont;
begin
Font.Init;
Font.setName('Courier New');
Font.setSize(10);
Font.setStyle([]);
LoadSystemFont(Font,'test');
DisplayDebugImgWindow(0,0);
DisplayDebugImgWindow(150,50);
DrawBitmapDebugImg(BitmapFromText('BMP[0] has not been freed','test'));
Font.free;
end.

EDIT: Yeah, the doc example compiles under Simba 1.2 if you switch the interpreter to PS. This is no longer an option in 1.3 so you gotta go with the Lape version.

Feroc1ty
03-09-2019, 02:25 AM
Okay, cool thanks that works, I got another question for ya, how do I import the full function list to simba?

the other day I was trying to work with an array and couldnt find set array length function on the function list, then I guessed it and it worked, but im assuming theres many other functions that wont appear but would compile and its really limiting my resources

Citrus
03-09-2019, 07:13 AM
Okay, cool thanks that works, I got another question for ya, how do I import the full function list to simba?

the other day I was trying to work with an array and couldnt find set array length function on the function list, then I guessed it and it worked, but im assuming theres many other functions that wont appear but would compile and its really limiting my resources

There are some 'magic functions' that won't pop up with a code completion hint.
Here are some docs that might help. http://docs.villavu.com/simba/scriptref/lape.html
You can also just search for the Free Pascal equivalent most of the time. https://www.freepascal.org/docs-html/rtl/system/setlength.html

Feroc1ty
03-09-2019, 09:37 PM
Thanks for the pascal link, really appreciate it!