world.CreateGUID
Creates a GUID - Global Unique Identifier
Prototype
BSTR CreateGUID();
Description
This generates a unique GUID (Global Unique Identifier). This is almost certain to be unique throughout the world, and at any time (ie. completely and utterly unique).
The GUID will look like this: 6B29FC40-CA47-1067-B31D-00DD010662DA
The purpose of this is to give you a way of having a unique identifier (eg. for a variable). If you were to use it for that purpose you would have to add a letter to the front, as variables must start with a letter, not a number, and change hyphens to underscores. eg.
dim uniqueid
uniqueid = "X" & world.replace (world.createguid, "-", "_", true)
These numbers may seem cumbersome, but at least if you use them you are guaranteed of a unique identifier.
Contrast this to "GetUniqueNumber" which only returns a unique number for this session of MUSHclient. Thus, the numbers (from "GetUniqueNumber") will not be unique over multiple sessions.
See also the new script function world.GetUniqueID.
Also, using random number generation for unique identifiers has a chance of returning the same number, depending on a) the seed given to the generator; and b) the way the generator must eventually recyle and regenerate the same sequence.
VBscript example
world.Note world.CreateGUID
Jscript example
world.Note (world.CreateGUID ());
PerlScript example
$world->Note ($world->CreateGUID ());
Python example
world.Note (world.CreateGUID )
Lua example
Note (CreateGUID ())
Return value
A 36-character GUID.
Related topic
See also
| Function | Description |
|---|---|
| GetUniqueID | Creates a unique ID for general use, or for making Plugin IDs |
| GetUniqueNumber | Returns a unique number |