Talk:LlRequestExperiencePermissions

From Second Life Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Suggestion for llStartAnimation() example

Since it's not immediately obvious how to use llRequestExperiencePermissions() to play animations, may I contribute this simple example?

string strAnim="Nadu";
string strExperienceName="The LSL Portal Experience";//substitute the name of your experience here!
default
{
	state_entry()
	{
		if(llList2String(llGetExperienceDetails(NULL_KEY),0)!=strExperienceName){//if I am not set to the appropriate experience
			llOwnerSay("This script must be set to "+strExperienceName);
		}
		if(llGetInventoryType(strAnim)!=INVENTORY_ANIMATION){
			llOwnerSay("This script needs the animation "+strAnim+" in this object to work");
		}
	}

	touch_start(integer num_detected)
	{
		llRequestExperiencePermissions(llDetectedKey(0), "");
	}

	experience_permissions(key agent)
	{
		llStartAnimation(strAnim);//you need to request experience permissions again each time you want to trigger an animation if you're using experience permissions rather than run_time_permissions
	}

	experience_permissions_denied(key agent, integer reason)
	{
		llOwnerSay("Experience permissions failed because: "+llGetExperienceErrorMessage(reason));
	}
}

Innula Zenovka (talk) 19:45, 22 January 2015 (PST)