I would like to define an array of, for example, 400 elements. In Basic, the user would use statement like dim a(400). When using Scripter I get a syntax error. It looks like I can only create such an array by specifying an initial value for each element. (dim a[0,0,0,0,0.....). Is that correct or am I missing something? Thank you.
wlandgraf
(Wagner Landgraf)
September 22, 2025, 12:01pm
2
Arrays in TMS Scripter are Variant arrays, so you have to use VarArrayCreate to initialize an array. Here are examples:
I'm a new user of Scripter, first of all thanks a lot for a great product! I'm trying to create arrays using vararraycreate, with Delphi-like syntax like so: var x: variant;x:=vararraycreate([1, 1000], varInteger); This gives a syntax error: Unknown identifier or variable is not declared: 'varInteger'. Although using vararraycreate is suggested in the documentation, I can not find any examples of vararraycreate actually used in Scripter. Could you give me a hint?
Hello,
Installed the current version today. Delphi 10.2
This code:
DIM inBuffer as integer
inBuffer=VarArrayCreate([0,1023],0x11) '0x11 = byte
function IDGood as boolean
result=((inBuffer[0] = 0) and (inBuffer[1] = 1))
end function
Compiles without error.
When used
if IDGood then <runtime error
This code:
function IDGood as boolean
return ((inBuffer[0] = 0) and (inBuffer[1] = 1))
end function
Works.
Why is "result" not flagged as an error at compile time?
Cheers,
Mark
Thank you Wagner. This works fine, although I was hoping for an approach understandable by Basic programmers.
1 Like