Forgot? Join

Scripting

LSL Guide

Every script function this grid actually runs, read straight from the region software rather than copied from a wiki — including the wolf* functions that exist only here.

Functions · Constants

wolfGetAgentCountry

Wolf Territories
string wolfGetAgentCountry(string agent)

The country the avatar `agent` (root or child presence in this region) is connected from, as an upper-case ISO 3166-1 alpha-2 code ("GB", "DE") from the region's local IP-to-country database - never the address. "" for a non-avatar key, an NPC, a region without the database, an avatar on a WolfStorm proxy host, or an address with no country in the database (wolfGetLastError says which). Defined on Wolf_Api.wolfGetAgentCountry / WolfGeoCountry.

The country an avatar is connected from, as a two-letter code in capitals (ISO 3166-1 alpha-2): "GB", "DE", "US". Use it to greet visitors, or show a poster or a terminal, in a language they are likely to read. The region looks the address up in its own country database: the address never leaves the region, and your script never sees it. It is where the connection comes from, not where someone lives or which language they speak - a VPN or a mobile network can put them anywhere. Returns "" for a key that is not an avatar here, an NPC, a region without the country database, an avatar using WolfStorm (the region sees the WolfStorm server's address, not theirs), or an address the database has no country for, with wolfGetLastError saying which.

Parameters

TypeName What it does
string agent The avatar's key. They must be in this region (or in a neighbouring one with a view into it).

Example

// A greeter at the landing point: says hello in the visitor's own language where it can.
default
{
    state_entry()
    {
        llVolumeDetect(TRUE);   // walk-through: avatars pass over it
    }

    collision_start(integer n)
    {
        while (n--)
        {
            if (llDetectedType(n) & AGENT)
            {
                key who = llDetectedKey(n);
                string cc = wolfGetAgentCountry(who);   // "GB", "DE", "FR" ... or ""
                string hello = "Welcome";
                if (cc == "DE" || cc == "AT") hello = "Willkommen";
                else if (cc == "FR") hello = "Bienvenue";
                else if (cc == "NL") hello = "Welkom";
                else if (cc == "IT") hello = "Benvenuto";
                else if (cc == "ES" || cc == "MX" || cc == "AR") hello = "Bienvenido";
                llRegionSayTo(who, 0, hello + ", " + llGetDisplayName(who) + "!");
            }
        }
    }
}

Why was there no country?

string cc = wolfGetAgentCountry(avatar);
if (cc == "")
    llOwnerSay(wolfGetLastError());   // e.g. "wolfGetAgentCountry: that avatar is on a WolfStorm proxy, its country is not known here"
Energy 10

Ours alone. Grid features you will not find on any other OpenSimulator grid.

More in Wolf Territories