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

wolfGetAgentIPHash

Wolf Territories
string wolfGetAgentIPHash(string agent)

A fingerprint of the address the avatar `agent` (root or child presence in this region) is connected from: 32 lowercase hex characters, HMAC-SHA256 under a grid secret of "wolf-iphash-v1\n" + the script owner's UUID + "\n" + the address. The same for the same address in all of this owner's objects on every region; unrelated to any other owner's values; never the address. "" for a non-avatar key, an NPC or a region without the secret (wolfGetLastError says which). Defined on Wolf_Api.AgentIPHash.

Recognise a returning visitor, or two avatars on one connection, without ever seeing anyone's IP address. You get a fingerprint of the address the avatar is connected from: 32 lowercase hex characters. The same connection gives the same value in every object you own, on every Wolf Territories region, so you can keep a list of them. The values are keyed to you, the script's owner, with a grid secret: another owner's script gets different values for the same visitor, so lists cannot be matched between owners, and nobody can work an address back out of one. It changes when the visitor's address does (a new router, a mobile network, a VPN), so a match means "probably the same connection", not proof of who it is. Returns "" for an NPC, a key that is not an avatar here, or a region without the feature, with wolfGetLastError saying which. osGetAgentIP returns "" unless the script's owner is a grid administrator: use this instead.

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 welcome mat at the landing point: greets new visitors, and welcomes back the ones it has seen before.
list seen;   // fingerprints of visitors already greeted, oldest first

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 fp = wolfGetAgentIPHash(who);
                if (fp == "")
                    llOwnerSay("No fingerprint: " + wolfGetLastError());
                else if (llListFindList(seen, [fp]) != -1)
                    llRegionSayTo(who, 0, "Welcome back, " + llGetDisplayName(who) + "!");
                else
                {
                    llRegionSayTo(who, 0, "Welcome, " + llGetDisplayName(who) + "!");
                    seen += [fp];
                    if (llGetListLength(seen) > 500)
                        seen = llDeleteSubList(seen, 0, 0);   // keep the newest 500
                }
            }
        }
    }
}

Are two avatars on the same connection (an alt)?

string a = wolfGetAgentIPHash(avatar1);
if (a != "" && a == wolfGetAgentIPHash(avatar2))
    llOwnerSay("Same connection - probably the same person.");
Energy 10

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

More in Wolf Territories