Many procedures and functions have been deprecated in Script-V2.0. Script V2.0 is more "object oriented" programmation style.
You should read carefully the new Script References.
// DEPRECATED
procedure SetValue(Param: TParameter; val: single);
function GetValue(Param: TParameter):single;
procedure SetStringValue (Param: TParameter; val: string);
function GetStringValue(Param: TParameter) : string;
procedure SetLength(Param: TParameter; val: integer);
function GetLength(Param: TParameter):integer;
procedure SetDataArrayValue (Param : TParameter;I: integer; val: single);
function GetDataArrayValue (Param : TParameter;I: integer): single;
procedure SetColorArrayValue (Param : TParameter;I: integer; val: TAlphaColor);
function GetColorArrayValue (Param : TParameter;I: integer): TAlphaColor;
procedure SetMIDIArrayValue (Param:TParameter;I: integer; val: TMIDI);
procedure GetMIDIArrayValue (Param:TParameter;I: integer; var val:TMIDI);
function CreateParam (caption: string; typ: TParamType):TParameter;
procedure SetIsInput (Param: TParameter; val: boolean);
procedure SetIsOutput (Param: TParameter; val: boolean);
procedure SetScale (Param: TParameter; val: TScale);
procedure SetColor (Param: TParameter; val: integer);
procedure SetVisible (N : Tparameter; val: Boolean);
procedure SetOffColor (Param: TParameter; val: integer);
procedure SetMin (Param: TParameter; val: single);
procedure SetMax (Param: TParameter; val: single);
procedure SetDefaultValue(Param: TParameter; val: single);
procedure SetCaption (Param: TParameter; val: string);
procedure SetSymbol (Param: TParameter; val: string);
procedure SetFormat (Param: TParameter; val: string);
procedure SetListBoxString (Param: TParameter; val: string);
procedure SetReadOnly (Param: TParameter; val: boolean);
procedure SetFastCallBack (Param: TParameter; val: boolean);
procedure SetDontSave (Param: TParameter; val: boolean);
procedure SetSavedName (Param: TParameter; val: string);
procedure SetIsSeparator (Param: TParameter; val: boolean);
The procedure SendInternalMsg(....);
is no longer available.
Replaced by
SendUsineMsg(msg,arg1:string);
SendUsineMsg(msg,arg1,arg2:string);
SendUsineMsg(msg,arg1,arg2,arg3:string);
SendUsineMsg(msg,arg1,arg2,arg3,arg4:string);
SendUsineMsg(msg,arg1,arg2,arg3,arg4,arg6:string);
The local variable result
is no longer allowed.
So for example,the code
procedure Test;
var result : integer;
begin
for result:= 1 to 10
do writeln('hello');
end;
Will fail on compile.
The var result : integer;
Must be replaced by another variable name. Like
procedure Test;
var res : integer;
begin
for res:= 1 to 10
do writeln('hello');
end;
Create a new script module and copy the old script code into the new one.
Assume that you have a variable SL declared as TStringlist.
var SL : TStringList;
SL := TStringList.Create; --must be replaced by --> SL.create;
SL.CommaText := 'a,b,c'; --must be replaced by --> SL.SetCommatext('a,b,c');
s := SL.CommaText; --must be replaced by --> s := SL.GetCommatext;
s := SL.strings[i] --must be replaced by --> s := SL.GetStrings(i);
SL.strings[i] := s; --must be replaced by --> SL.SetStrings(i,s);
A more complete example
//old version
procedure Init;
var SL : TStringList;
begin
SL := TScringList.create;
SL.CommaText := 'a,b,c,d';
for i := 0 to SL.count-1
do SL.strings[i] := SL.strings[i]+inttostr(i);
trace(SL.CommaText);
SL.free;
end;
// new version
procedure Init;
var SL : TStringList;
begin
SL.create;
SL.SetCommaText('a,b,c,d');
for i := 0 to SL.count-1
do SL.SetStrings(i,SL.GetStrings(i)+inttostr(i));
trace(SL.GetCommaText);
SL.free;
end;
Now your script will compile and run at least 10x faster.
version 6.0.241021
Edit All Pages