MyChat Scripts: CreateGUIDString function, get a unique generated text string based on a GUID
Generate a unique string identifier (GUID). This is a convenient function for generating text strings with a guaranteed degree of uniqueness.
Syntax
function CreateGUIDString: string;
Function result
Text string like "{6F9619FF-8B86-D011-B42D-00CF4FC964FF}". Each repeated call will generate a unique and non-repeating sequence of fixed length.
Example
Generate a unique sequence 3 times and output the result to the console.
var
i: integer;
begin
for i := 1 to 3 do
mLogScript(CreateGUIDString, 'Attempt #' + IntToStr(i));
end.
Script work result
[19:58:28] (Log "CreateGUIDStringExample"): [Attempt #1] {0A18B716-8281-4252-97F3-7AC02087BC14}
[19:58:28] (Log "CreateGUIDStringExample"): [Attempt #2] {880D9FAF-5535-44B5-AE63-43D848763B8B}
[19:58:28] (Log "CreateGUIDStringExample"): [Attempt #3] {BE6E8E51-32CC-4FDC-8221-3BF00C60135F}
[19:58:28] (Run "CreateGUIDStringExample"): Script operation time: 3 ms
[19:58:28] (Run "CreateGUIDStringExample"): Script done successfully.