# UOX3 Script Engine

### API and Event handling

### SpawnRegion Functions

Note that any changes to SpawnRegions re applied in runtime memory only, and next server startup or reload of spawn regions from UOX3 console will overwrite those changes.

GetSpawnRegion
Prototype |
    SpawnRegion GetSpawnRegion( spawnRegionNum )
Purpose | Returns SpawnRegion object for specified spawnRegionNum
Example of Usage |
    var spawnRegion = GetSpawnRegion( 1 ); // Returns SpawnRegion object for spawn region #1 from spawns.dfn
    pUser.TextMessage( "The name of this SpawnRegion is: " + spawnRegion.name );

GetSpawnRegionCount
Prototype |
    int GetSpawnRegionCount()
Purpose | Returns amount of SpawnRegions that exist
Example of Usage |
    var spawnRegionCount = GetSpawnRegionCount();
    pUser.TextMessage( "There are " + spawnRegionCount + " SpawnRegions on this server!" );

    var spawnRegion;
    for( var i = 0; i < spawnRegionCount; i++ )
    {
    	spawnRegion = GetSpawnRegion( i );
    	Console.Print( "SpawnRegion Name: " + spawnRegion.name + "\n" );
    }

IterateOverSpawnRegions
Prototype |
    void IterateOverSpawnRegions()
Purpose | Iterates over all SpawnRegions on the server.
Extra Info | For every object it comes across, the iterator will call onIterateSpawnRegions( SpawnRegionObject ) in the calling script.
Example of Usage |
    var count = IterateOverSpawnRegions();
    function onIterateSpawnRegions( toCheck )
    {
    	Console.Print( "Spawn Region Number: " + toCheck.regionNum + "\n" );
    	Console.Print( "Spawn Region Name: " + toCheck.name + "\n" );
    	Console.Print( "Spawn Region World: " + toCheck.world + "\n" );
    	return true;
    }

©Copyright 2020 WWW.UOX3.ORG