| Name | GetWorld |
|---|---|
| Type | Method |
| Summary | Gets an object reference to the named world |
| Prototype | IDispatch* GetWorld(BSTR WorldName); |
| Description | Returns an object which can be used to refer to another world. You should be very cautious about storing the object reference of the world in a global variable, because if the world is closed then that reference becomes invalid, which will very likely lead to an access violation (program crash). You are better off using "world.getworld (name)" every time you need to get a reference to the world, and checking if it "is nothing" as in the example. You could use a small variation on the examples above to write your own "send to all worlds" or something similar. |
| VBscript example | |
| Jscript example | |
| PerlScript example | # --------------------------------------------------
# Example showing sending a message to another world
# --------------------------------------------------
sub SendToWorld {
my ($name, $message) = @_;
my $otherworld;
$otherworld = $world->getworld ($name);
if (!defined ($otherworld))
{
$world->note("World " . $name . " is not open");
return;
}
$otherworld->send($message);
}
SendToWorld ("MyOtherWorld", "say Hi there"); |
| Returns | An object reference to the named world, if it was found. |
See also ...