# UOX3 Script Engine

### API and Event handling

### Town Related Functions

IsMemberOfTown
Prototype |
    bool IsMemberOfTown( pChar, town );
Purpose | Returns true if pChar is a member of town
Example of Usage |
    if( IsMemberOfTown( pTalking, GetTown( pTalkingTo ) ) )

    {

    	TextMessage( pTalkingTo, "Hello fellow town member" );

    }

GetTownMayor
Prototype |
    PLAYER GetTownMayor( town );
Purpose | Returns a handle to the mayor of the town. If == -1, then there is no mayor
Example of Usage |
    if( GetTownMayor( GetTown( pTalkingTo ) ) == pTalking )

    {

    	TextMessage( pTalkingTo, "Why hello mayor, how are you?" );

    }

GetTownRace
Prototype |
    RACEID GetTownRace( town );
Purpose | Returns the race that is associated with the town. Default is race 0.
Example of Usage |
    var iRace = GetRace( pTalking );

    var iTownRace = GetTownRace( GetTown( pTalkingTo ) );

    if( RaceCompareByRace( iTownRace, iRace )  < 0 )

    {

    	TextMessage( pTalkingTo, "Guards!  Guards!  Where the HELL are the guards?" );

    }

SetTownRace
Prototype |
    SetTownRace( town, newRace );
Purpose | Sets the race of town to newRace
Example of Usage |
    SetTownRace( GetRace( pTalking ) );

PossessTown
Prototype |
    PossessTown( srcTown, trgTown );
Purpose | srcTown takes over the town of trgTown. This means they get the treasury and other resources accumulated by trgTown. It also turns the guards over to them.
Example of Usage |
    var iSrc = GetTown( pTalking );

    var iTrg = GetTown( pTalkingTo );

    PossessTown( iSrc, iTrg );

    TextMessage( pTalkingTo, "You are my new... master" );

GetTownTax
Prototype |
Purpose |
Example of Usage |

GetTownTaxResource
Prototype |
    ITEMID GetTownTaxResource( town );
Purpose | Returns the ID of the town's primary tax resource. Normally, it would be 0x0EED (gold), but it may be something else.
Example of Usage |
    var iID = GetTownTaxResource( GetTown( pTalking ) );

    if( iID == 0x0EED )

    {

    	TextMessage( pTalkingTo, "Gimme all your tax money, knave!" );

    }

©Copyright 2000-2001 WWW.UOX3.NET (Daniel Stratton/Matthew Randall)