Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Tracking an avatar and logging location on web

Nichiren Dinzeo
Registered User
Join date: 14 Feb 2007
Posts: 203
10-10-2007 17:58
Can anyone point me to a script sample that can be placed in an object worn by an avatar that periodically logs location (region, x,y,z) into a db?
I have the backend (web, db etc) just need the scripts. thx
nand Nerd
Flexi Fanatic
Join date: 4 Oct 2005
Posts: 427
10-11-2007 03:17
string URL="http://www.mydbwebaddress.com/loggingslmovement.php";

default
{
state_entry()
{
llSetTimer(60.0);
llOwnerSay("Please be aware that your location is being fed to a web database located at "+URL);
}

timer()
{
//string owner = llGetOwnerName(); // can be taken from HTTP header
//string region = llGetRegionName(); // can also be taken from HTTP header
//vector location = llGetPos(); // and this.
//vector globalcoord = llGetRegionCorner() + llGetPos(); // and this.
integer timestamp = llGetUnixTime(); // Could be generated by PHP.
llHTTPRequest(URL, [HTTP_METHOD, "POST"], "?timestamp="+(string)timestamp);
// if you wish to add any of the commented values above, append the string with
//+"&owner="+owner
//+"&region="+region
//+"&location="+(string)location
//+"&globalcoord="+(string)globalcoord
}
}

see also http://wiki.secondlife.com/wiki/LlHTTPRequest for list of headers from which you can extract all the above data from the http request.
_____________________
www.nandnerd.info
http://ordinalmalaprop.com/forum - Ordinal Malaprop's Scripting Forum
Geuis Dassin
Filming Path creator
Join date: 3 May 2006
Posts: 565
10-11-2007 04:22
you gave away teh secret!
nand Nerd
Flexi Fanatic
Join date: 4 Oct 2005
Posts: 427
10-11-2007 05:41
From: Geuis Dassin
you gave away teh secret!


omg lol oops :rolleyes:
_____________________
www.nandnerd.info
http://ordinalmalaprop.com/forum - Ordinal Malaprop's Scripting Forum
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
10-11-2007 10:19
From: nand Nerd
omg lol oops :rolleyes:

well at least that scripts warns you your being logged externally... I have an "associate" that tracks me a similar way... =(
nand Nerd
Flexi Fanatic
Join date: 4 Oct 2005
Posts: 427
10-11-2007 10:24
From: Void Singer
well at least that scripts warns you your being logged externally... I have an "associate" that tracks me a similar way... =(


Yes, I meant to say more on that. Use of this without the permission of whomsoever you are tracking is against the TOS/CS/FBI/whatever and I only give you permission to use my code if you do so with permission of whomsoever it is tracking. (that's my ass covered).
_____________________
www.nandnerd.info
http://ordinalmalaprop.com/forum - Ordinal Malaprop's Scripting Forum
Nichiren Dinzeo
Registered User
Join date: 14 Feb 2007
Posts: 203
10-12-2007 09:05
hey thanks. i will give this a try. i have no plans to break sl laws...this will be in a shirt that explains what it does and is for our members to play the game...
Nichiren Dinzeo
Registered User
Join date: 14 Feb 2007
Posts: 203
11-26-2007 18:23
From: nand Nerd


timer()
{
//string owner = llGetOwnerName(); // can be taken from HTTP header
//string region = llGetRegionName(); // can also be taken from HTTP header
//vector location = llGetPos(); // and this.
//vector globalcoord = llGetRegionCorner() + llGetPos(); // and this.
integer timestamp = llGetUnixTime(); // Could be generated by PHP.
llHTTPRequest(URL, [HTTP_METHOD, "POST"], "?timestamp="+(string)timestamp);
// if you wish to add any of the commented values above, append the string with
//+"&owner="+owner
//+"&region="+region
//+"&location="+(string)location
//+"&globalcoord="+(string)globalcoord
}
}


Can you elaborate on your APPEND statement above.
Do you mean like this:
string owner = llGetOwnerName();+"&owner="+owner

OR is that something that belongs in the webpage?
Roy Flanagan
Registered User
Join date: 10 Feb 2007
Posts: 8
11-27-2007 08:16
Since you have PHP code (I assume you made it yourself) I think you're a scripter. So I suggest you read up on the LSL scripting llHTTPRequest function. This is the most simple script to make with that. And you should see where the append go's (In the parameter function)

If you're not a scripter try this:

From: someone
llHTTPRequest(URL, [HTTP_METHOD, "POST"], "?timestamp="+(string)timestamp+"&owner="+owner);


As you can see the stuff is appended in the parameter section of the function. ;)


*Trys to figure wich icon should go with this message*
Erawk Rumpler
Registered User
Join date: 17 Nov 2007
Posts: 2
12-08-2007 13:25
Was llGetOwnerName() removed from the API? I only see llGetOwner() now which returns a key for the owner. How do I get the name of the owner?

* Erawk *
Erawk Rumpler
Registered User
Join date: 17 Nov 2007
Posts: 2
12-08-2007 13:29
Oh, answered my own question. Should have kept looking a little longer. This works, I think...

key ownerKey = llGetOwner();
string ownerName = llKey2Name(ownerKey);

* Erawk *
Nichiren Dinzeo
Registered User
Join date: 14 Feb 2007
Posts: 203
05-31-2008 18:32
revisiting this after playing around with similar code that uses twitter.com
Anyone have sample PHP code that does the below?

From: Roy Flanagan
Since you have PHP code (I assume you made it yourself) I think you're a scripter. So I suggest you read up on the LSL scripting llHTTPRequest function. This is the most simple script to make with that. And you should see where the append go's (In the parameter function)

If you're not a scripter try this:



As you can see the stuff is appended in the parameter section of the function. ;)


*Trys to figure wich icon should go with this message*
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
05-31-2008 19:06
There was a guy who put together a product to do precisely this, called "SLGPS"... basically you dropped his script into.. "something" and the system would actually put dots on a webmap of SL for you.

The idea was cool.. but it just didn't have a marketing angle I guess. I was really interested in marketing it to "slave-owners"... but that inevitably led to the "jealous boyfriend wanting to put it in the engagement ring... and bleah.
_____________________

● Inworld Store: http://slurl.eclectic-randomness.com
● Website: http://www.eclectic-randomness.com
● Twitter: @WinterVentura