Simba1500 Alpha
Pre-releaseIt's been years but a new Simba release is here. If you've still been active in the community this is building on Simba 1.3, which somehow never got a release.
Some Simba related changes:
- The GUI at this point been completely rewritten and is dockable. Drag the header of a component to rearrange or attach/detach.
- Scripts now run in their own process.
- DTM Editor & ACA.
- Package system.
- Quoted Files/URLs can now be clicked and opened from the output box
- Holding F1 will now print the current mouse position.
- In addition to
AddOnTerminate
there is nowAddOnPause
,AddOnResume
andAddOnUserTerminated
(the stop button was clicked)
The following are some of the major scripting changes.
Self Variable
Self is no longer implicit. It's now required to access the type variable.
// Previously
procedure TPoint.Test;
begin
X := 15;
Y := 15;
end;
// Now
procedure TPoint.Test;
begin
Self.X := 15;
Self.Y := 15;
end;
Previous functionality can be enabled with {$EXPLICTSELF OFF}
or with
can be used which is what was happening before internally.
procedure TPoint.Test;
begin
with Self do
begin
X := 15;
Y := 15;
end;
end;
Constref (Method Modifier)
constref
as a method modifier has been removed. If the variable is not writable a copy is made.
procedure Integer.Next;
begin
Self += 1;
end;
const
MyConst: Integer = 100;
var
MyVar: Integer = 100;
begin
MyConst.Next();
WriteLn('It did not change! ', MyConst);
MyVar.Next();
WriteLn('It changed! ', MyVar);
end;
Array Helpers
Many methods are now automatically added to arrays.
var
Arr: array of Integer;
begin
Arr.SetLength(1);
end;
Full list:
function <Array>.Low: Integer;
function <Array>.High: Integer;
function <Array>.Contains(Value: <ArrayType>): Boolean;
procedure <Array>.Swap(FromIndex, ToIndex: Integer);
function <Array>.Unique: <Array>;
function <Array>.IndexOf(Value: <ArrayType>): Integer;
function <Array>.IndicesOf(Value: <ArrayType>): TIntegerArray;
procedure <Array>.Sort;
procedure <Array>.Sort(CompareFunc: function(constref L, R: <ArrayType>): Integer);
procedure <Array>.Sort(Weights: TIntegerArray; LowToHigh: Boolean);
function <Array>.Sorted: <Array>;
function <Array>.Sorted(CompareFunc: function(constref L, R: <ArrayType>): Integer): <Array>;
function <Array>.Sorted(Weights: TIntegerArray; LowToHigh: Boolean): <Array>;
function <Array>.Length: Integer;
function <Array>.Copy: <Array>;
function <Array>.Copy(StartIndex: Integer; Count: Integer = High(Integer)): <Array>;
function <Array>.First: <ArrayType>;
function <Array>.Last: <ArrayType>;
function <Array>.RandomValue: <ArrayType>;
function <Array>.Reversed: <Array>;
function <Array>.Min: <ArrayType>;
function <Array>.Max: <ArrayType>;
function <Array>.Sum: <ArrayType>;
function <Array>.Mode: <ArrayType>;
function <Array>.Median: Double;
function <Array>.Mean: Double;
function <Array>.Variance: Double;
function <Array>.Stddev: Double;
function <Array>.Slice(Start, Stop, Step: Integer): <Array>;
function <Array>.Remove(Value: <ArrayType>): Boolean;
function <Array>.RemoveAll(Value: <ArrayType>): Integer;
procedure <Array>.Delete(Index: Integer; Count: Integer = High(Integer));
procedure <Array>.Insert(Item: <ArrayType>; Index: Integer);
procedure <Array>.SetLength(NewLength: Integer);
function <Array>.Pop: <ArrayType>;
function <Array>.Pop(Index: Integer): <ArrayType>;
function <Array>.RandomValue: <ArrayType>;
procedure <Array>.Reverse;
procedure <Array>.Clear;
procedure <Array>.Append(Value: <ArrayType>);
procedure <Array>.Extend(Value: <Array>);
Static Improvements
Static methods have had an improvement. Attempting to call a non-static method with a type will now error.
procedure String.Test;
begin
end;
begin
String.Test(); // Variable expected. "String.Test" is not a static method
end;
Bitmap Changes
The old bitmap integer wrappers have been removed. TMufasaBitmap
is now used which is what most Includes have been using for a long time.
var Bitmap: Integer;
begin
Bitmap := CreateBitmap(100, 100);
end;
var Bitmap: TMufasaBitmap;
begin
// Either
Bitmap.Init();
// Or
Bitmap := TMufasaBitmap.Create();
end;
FormatMilliseconds
Format them milliseconds.
It supports a lot. See the method here.
var
t: UInt64;
begin
t := 120*60000+6000;
WriteLn FormatMilliseconds(t, 'hh:mm:ss'); // 02:00:06
end.
String methods
Lots of string helpers have been added.
See all the methods here.
var
s: String;
begin
s := 'Hello World';
WriteLn s.Before(' '); // Hello
end.
Include & Macros
The include directive can now load from a URL:
{$I URL(www.someurl.com)}
The macro directive can now reference a environment variable.
WriteLn({$MACRO ENV(PATH)})
Area selector
A simple area selector has been added.
Once opened the area can be expanded by dragging the sides/corners.
To close either double click or press enter/escape. The selected area will be printed in the output box.