Jump to content

Syntax issues with experince perm'd code


Macrocosm Draegonne
 Share

You are about to reply to a thread that has been inactive for 2003 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I have made these many times with prims, and its fairly straight forward, but after making my own xyzzytext mesh & setup for another thing, I was inspired to make a teleporter with multiple buttons using the up to 8 faces.  I was able to get the face click detection working, but when I tried to add in the experience perms stuff I started getting syntax errors, and ive yet to figure out why, im sure learning why will be useful lol, its got to be something dumb im doing with the formatting.  I was hoping to reduce the amount of scripts in a control panel to one only.

Below is a little of my attempts.  In the end I just switched to single plane mesh's for the teleporter buttons, and will use the multi face mesh for other buttons on the control panel.  BUT, it really bothers me that I didnt figure out where I f'd up yet, so I will not let myself skate by so easily.  Any help is much appreciated, I will post back when I figure out more too

Code below, I have tried many ways to integrate the teleporter code into this and failed every time with syntax errors.  The face detection does work though with this first item below.

default{
    touch_start(integer num_detected)    {
        integer link = llDetectedLinkNumber(0);
        integer face = llDetectedTouchFace(0);
 
        if (face == TOUCH_INVALID_FACE)
            llSay(PUBLIC_CHANNEL, "Sorry, your viewer doesn't support touched faces");
        else if (face == 0) {
            llOwnerSay("You touched face number " + (string) face);
        }
        else if (face == 1) {
            llOwnerSay("You touched face number " + (string) face);                  
        }
        else if (face == 2) {
            llOwnerSay("You touched face number " + (string) face);    
        }
        else if (face == 3) {
            llOwnerSay("You touched face number " + (string) face);        
        }
        else if (face == 4) {
            llOwnerSay("You touched face number " + (string) face);
        }  
        else if (face == 5){
            llOwnerSay("You touched face number " + (string) face);
        } 
        else {
            llOwnerSay("thats a missed one, but how? " + (string) face); 
        }                
    }
 
}

Teleporter script using experience perms & landmark in objects inventory, its a per button/object script, which I was trying to avoid, works great though.

default
{
    touch_start(integer n)
    {
        llRequestExperiencePermissions(llDetectedKey(0), "");
    }
    experience_permissions(key av)
    {
        llTeleportAgent(av, "Landmark", ZERO_VECTOR, ZERO_VECTOR);
    }
}

One Example Combo, I've tried many so far, some like this where its in the touch start, and others where its in a separate section below, neither have worked yet because im still missing an important aspect of the syntax.  Which is a nice way of saying NOOB! lol

default
{
    touch_start(integer num_detected)
    {
        llRequestExperiencePermissions(llDetectedKey(0), "");
        integer link = llDetectedLinkNumber(0);
        integer face = llDetectedTouchFace(0);
 
        if (face == TOUCH_INVALID_FACE)
            llSay(PUBLIC_CHANNEL, "Sorry, your viewer doesn't support touched faces.");
        else if (face == 0) {
                llOwnerSay("You touched face number " + (string) face);
                experience_permissions(key av){
                    llTeleportAgent(av, "Level-1", ZERO_VECTOR, ZERO_VECTOR);
                    //llTeleportAgent(av, "", <101,250,23>,ZERO_VECTOR);
                }
        }
        else if (face == 1) {
                llOwnerSay("You touched face number " + (string) face);    
                experience_permissions(key av){
                    llTeleportAgent(av, "Level-2", ZERO_VECTOR, ZERO_VECTOR);
                    //llTeleportAgent(av, "", <101,250,201>,ZERO_VECTOR);            
                }
        }
        else if (face == 2) {
                llOwnerSay("You touched face number " + (string) face);    
                experience_permissions(key av){
                    llTeleportAgent(av, "Level-3", ZERO_VECTOR, ZERO_VECTOR);
                    //llTeleportAgent(av, "", <101,250,321>,ZERO_VECTOR); 
                }
        }
        else if (face == 3) {
                llOwnerSay("You touched face number " + (string) face);
                experience_permissions(key av){
                    llTeleportAgent(av, "Level-4", ZERO_VECTOR, ZERO_VECTOR);
                    //llTeleportAgent(av, "", <101,250,1011>,ZERO_VECTOR);
                }
        }
        else if (face == 4) {
            llSay(0, "Nope, Nothing there yet");
            //experience_permissions(key av){
            //llOwnerSay("You touched face number " + (string) face);
            //llTeleportAgent(av, "Level-5", ZERO_VECTOR, ZERO_VECTOR); 
            //}
        }  
        else if (face == 5){
            llSay(0, "Nope, Nothing there yet");
            //llOwnerSay("You touched face number " + (string) face);
            //experience_permissions(key av){
            //llTeleportAgent(av, "Level-6", ZERO_VECTOR, ZERO_VECTOR); 
            //}
        } 
        else {
            llOwnerSay("thats a missed one, but how? " + (string) face); 
        }                
    }
}

 

Edited by Macrocosm Draegonne
Link to comment
Share on other sites

That's because you are trying to use llTeleportAgent in the touch_start event.  Put it in the experience_permissions event and it will work.  Make your variable face into a global variable and then use llRequestExperiencePermissions in the touch_start event.

Edited by Rolig Loon
  • Like 1
Link to comment
Share on other sites

1 hour ago, Rolig Loon said:

That's because you are trying to use llTeleportAgent in the touch_start event.  Put it in the experience_permissions event and it will work.  Make your variable face into a global variable and then use llRequestExperiencePermissions in the touch_start event.

I did run a few tries with the experience_permissions(key av){}  below the touch_start{}.  I cant recall exacty the issue but I believe it was the else/if logic would not work in there.  And. that is precisely because I did not make the face stuff a global variable! Wow... I knew I was doing something stupid... lol  Good thing I cannot embarrass easily and am not scared to ask questions.  Thank you so much for that nudge in the right direction! ❤️

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2003 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...