VL Furniture Devkit

From GridPlay
Revision as of 05:11, 22 July 2022 by Ven (talk | contribs) (Created page with "=== Furniture / Food DevKit=== Our dev kit somes with one script that can be used in items like a couch Does require a notecard in the same prim as the core DevKit script and...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Furniture / Food DevKit

Our dev kit somes with one script that can be used in items like a couch

Does require a notecard in the same prim as the core DevKit script and named vl config

All included in the package.

Only item in the package that is not full perm is the core DevKit script itself. It is set to no mod for security reasons.

  • 99 - You send a message on this channel
  • 98 - Dev Kit script sends a message on this channel

Example of how to process incoming

// Message Link channels. Please see our wiki on how this works
integer LinkIn = 98; // You send a message to this script
integer LinkOut = 99; // This sends a message out to other scripts you make
// numbers are so this script doesnt get confused with its own messages
default {
	touch_end(integer num_detected) {
		llMessageLinked(LINK_SET, LinkOut, "menu", llDetectedKey(0));
		//llMessageLinked(LINK_SET, LinkOut, "use", llDetectedKey(0));
	}
	link_message(integer sender_num, integer num, string str, key id) {
		if (num == LinkIn) {
			if (llJsonValueType(str, ["uri"]) != JSON_INVALID) {
                string uri = llJsonGetValue(str, ["uri"]);
                if (uri == "confirm" || uri == "used") {
                	llSay(0, "Usage Confirmed");
                }
                if (uri == "#Stats#") {
                	//llOwnerSay(str);
                }
            }
		}
	}
}

URI are confirm and #Stats#

Stats uri will return the stats from the HUD of the person with id in JSON format

To Send a message to the script is easy

string json = llList2Json(JSON_OBJECT, ["uri","menu"]);
key id = llDetectedKey(0);
llMessageLinked(LINK_SET, 99, json, id);

Options are menu and getstats

menu will open a dialog menu to id with a option to use the item