Code Monkey home page Code Monkey logo

SLPhant: a Second Life/OpenSim Phant Library. Tested in both Second Life(tm) and OpenSim(tm).

With SLPhant you can...

  • Clear All Data
  • Add Data
  • Get Data (in Supported Formats)
  • Get Stats (in Supported Formats)
  • Supported Formats [CSV, JSON, MySQL, PostgreSQL, ATOM]

To Test the Example:

  1. Copy SLPhant_v1_0.lsl to a script in your own Prim and save.

  2. Monitor chat (uses llOwnerSay) to see results.

  3. View the data at https://data.sparkfun.com/streams/7JvgN1NbE5H2JwAvlza0 to see that it worked.

Usage in your own scripts:

  1. Copy the upper half to your own script (above where it says "above this line")

  2. Modify these two constants to use YOUR keys (the keys shown here are for a public stream only used for demonstration.) string sSLPHANT_PUBLIC_KEY = "7JvgN1NbE5H2JwAvlza0"; string sSLPHANT_PRIVATE_KEY = "mzqm6g6GNaS0q6D7RrNy";

  3. If you're running your own Phant Server, modify the following constant string sSLPHANT_BASE_URL = "https://data.sparkfun.com/";

  4. Use of the following Functions is self explanitory to any self-respecting scripter... key SLPhant_Clear(); key SLPhant_AddData(string sData); key SLPhant_RequestData(string sFormat); key SLPhant_RequestStats(string sFormat);

  5. Results are returned when the http_response Event fires... http_response(key kRequestId, integer iStatus, list lMetadata, string sBody);

The only thing that may need explaining is the Formatting of the Data for SLPhant_AddData. It is YOUR responsibility to have sData in format "Field1=Value1&Field2=Value2..." Fields must be the valid names for YOUR stream. Values must be put thru llEscapeURL(sURL). Name/Value pairs must be separated by "&".

For example (note use of llEscapeURL)...
	SLPhant_AddData(
		"avatarname="+llEscapeURL(llKey2Name(llGetOwner()))+
		"&id="+llEscapeURL(llGetOwner())+
		"&regionname="+llEscapeURL(llGetRegionName()));

Note that Phant sometimes messes up if accessed too fast; so I put a llSleep(1.0) in the loop (YMMV.)

slphant's Projects

phant icon phant

the data logging engine behind data.sparkfun.com

slphant icon slphant

SLPhant: a Second Life/OpenSim Phant Library.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.