Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion: State Driven Land Ownership Scanner

Kristian Ming
Head Like A Hole
Join date: 5 Feb 2005
Posts: 404
01-04-2006 18:57
Inspired by my attempts to get the script in this thread to perform as expected, I decided it was high time to teach myself states and rewrote my solution to the problem from scratch. It is a fully functioning landscanner (on touch) , and hopefully a good jumping off point for other land scanning functionality or as a straightforward example of states. :)

CODE
// State Based Land Ownership Scanner
// by Kristian Ming
// public domain: do what thou wilt shall be the whole of the law
key landowner;
key queryid;
integer timeout = 10;
integer num_detected;
string data;


default {
state_entry () {
state idle;
}

}

state idle {
state_entry () {
llSetText("Ready.\nTouch to Scan.", <0,1,0>, 1.0);
}

touch_start (integer num_detected) {
landowner = llGetLandOwnerAt(llGetPos());
if (landowner == NULL_KEY) {
llSay(0,"This land is public! Act fast!");
} else {
llRequestAgentData(landowner, DATA_NAME);
llSay(0, "Querying dataserver for Avatar name...");
state scanning;
}
}

dataserver (key queryid, string data) {
llSay(0, "Dataserver event triggered when I wasn't expecting one.");
}
}

state scanning {

state_entry () {
llSetText("Scanning...\nTouch to cancel.", <1,0,0>, 1.0);
llSetTimerEvent(timeout);
}

touch_start (integer num_detected) {
llSay(0, "Scan Cancelled.");
llSetTimerEvent(0);
state idle;
}

dataserver (key queryid, string data) {
llSay(0, "Land is owned by: " + data);
llSetTimerEvent(0);
state idle;
}

timer () {
llSay(0, "Dataserver event timeout. Land may be group owned.");
llSetTimerEvent(0);
state idle;
}
}
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Original Thread
01-07-2006 09:23
/15/5a/80850/1.html
_____________________
i've got nothing. ;)
Dragon Steele
Artist/conservationist
Join date: 3 Jan 2005
Posts: 183
01-08-2006 09:09
What does it do and how do you use it?

thanks
_____________________
Boycot the spam farms and the ads on them. Ban the spamers from your land. Look for the clocktower network for a blacklist to put on you land that is grid wide.
Dragon Steele
Artist/conservationist
Join date: 3 Jan 2005
Posts: 183
01-09-2006 18:51
I guess no one knows how to use the this script.
_____________________
Boycot the spam farms and the ads on them. Ban the spamers from your land. Look for the clocktower network for a blacklist to put on you land that is grid wide.
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
01-09-2006 23:32
It tries to find out who the owner of the parcel it's over it when it gets touched.
Kristian Ming
Head Like A Hole
Join date: 5 Feb 2005
Posts: 404
01-11-2006 07:13
From: Dragon Steele
I guess no one knows how to use the this script.


Sorry Dragon, my notifications on this thread weren't enabled and I haven't been tracking the forums lately.

To use: Drop the script in a prim and place it over the land in question. Touch it, and it will tell you either the player's name who owns it, or tell you the request to the dataserver timed out, indicating the land is probably group owned. (Or the dataserver is slow.)

The script itself is no big deal, but I needed to learn states and the script I linked in the initial post was supposed to detect group owned land and really couldn't be trusted as one of the functions it relied on only worked if the agent was in the same sim as the running script, which works great when you're testing on your land, but...
Dragon Steele
Artist/conservationist
Join date: 3 Jan 2005
Posts: 183
01-12-2006 18:45
Oh thanks I thought it was one like the Land sellers use to find land at a set price in the sim.

Neat script to play with though.

Land Sellers? LOL I don't know what to call them.:p
_____________________
Boycot the spam farms and the ads on them. Ban the spamers from your land. Look for the clocktower network for a blacklist to put on you land that is grid wide.