Jump to content

Floofies

Resident
  • Posts

    4
  • Joined

  • Last visited

Posts posted by Floofies

  1. Ok, I modified (pretty much just copy-pasted) the code which also rezzes the object and tracks the permissions. I now get a syntax error on the run_time_permissions line for some reason.

     

     do {            if(llGetSubString(message, 0, 23) == llGetSubString(llGetInventoryName(GIVE_TYPE, itra), 0, 23)) {  {        llRequestPermissions( llGetOwner(), PERMISSION_ATTACH );    }        run_time_permissions( integer vBitPermissions )    {        if( vBitPermissions & PERMISSION_ATTACH )        {            llAttachToAvatarTemp( ATTACH_RHAND , id, llGetInventoryName(GIVE_TYPE, itra));        }        else        {            llOwnerSay( "Permission to attach denied" );        }    }     on_rez(integer rez)    {        if(!llGetAttached())        { //reset the script if it's not attached.            llResetScript();        }    }     attach(key AvatarKey)    {        if(AvatarKey)        {//event is called on both attach and detach, but Key is only valid on attach            integer test = llGetAttached();            if (test) {                llOwnerSay( "The object is attached" );            } else {                llOwnerSay( "The object is not attached");            }        }    }                jump close;            }        } while(--itra>=0);@close;

     On second thought, maybe I didn't do that right. I need to create a seperate script that rezzes the object. 

  2. Hmm, perhaps I am missing something.

    I am getting a Syntax error when I inject the relevant code. On the llAttachToAvatarTemp line.

     

    Here's what my script looks like, in the relevant section:

     if(llGetSubString(message, 0, 23) == llGetSubString(llGetInventoryName(GIVE_TYPE, itra), 0, 23)) {              {        llRequestPermissions( llGetOwner(), PERMISSION_ATTACH );    }               llAttachToAvatarTemp(ATTACH_RHAND)(id, llGetInventoryName(GIVE_TYPE, itra));                jump close;            }        } while(--itra>=0);@close;

     And here's the whole thing:

    //////////////////////////////////////////////////////////// [K] Kira Komarov - 2011, License: GPLv3              //// Please see: http://www.gnu.org/licenses/gpl.html     //// for legal details, rights of fair usage and          //// the disclaimer and warranty conditions.              //////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////                   CONFIGURATION                      //////////////////////////////////////////////////////////////                                                      // // The possible values for this parameter are:// 0 for textures.// 1 for sound.// 3 for landmarks.// 5 for clothing.// 6 for objects.// 7 for notecards.// 10 for scripts (the giver script will be excluded).// 13 for body parts.// 20 for animations.// 21 for gestures. // The type is 6, so using the reference above, this // script will hand out objects.integer GIVE_TYPE = 6;  //                                                      ////                  END CONFIGURATION                   //////////////////////////////////////////////////////////// integer _runner = 0;integer _comHandle = 0;list _cList = [];list _storage = []; list mFwd() {    if(_runner+1>llGetListLength(_storage)) return _cList;    return (_cList = llListInsertList(llListInsertList(llList2List(_storage, ++_runner, _runner+=9), ["<= Back"], 0), ["Next =>"], 2));}  list mBwd() {    if(_runner-19<0) return _cList;    return (_cList = llListInsertList(llListInsertList(llList2List(_storage, _runner-=19, _runner+=9), ["<= Back"], 0), ["Next =>"], 2));} default{    state_entry()    {        _storage = [];        integer itra=llGetInventoryNumber(GIVE_TYPE)-1;        do {            if(llGetInventoryName(GIVE_TYPE, itra) != llGetScriptName())                _storage += llGetSubString(llGetInventoryName(GIVE_TYPE, itra), 0, 23);        } while(--itra>=0);        _cList = llListInsertList(llListInsertList(llList2List(_storage, _runner, _runner+=9), ["<= Back"], 0), ["Next =>"], 2);    }     listen( integer channel, string name, key id, string message ) {        if(message == "<= Back") {            llDialog(id, "Would you like Regular or Chocolate flavored Dragon Spunk?:\n", mBwd(), channel);            return;        }         if(message == "Next =>") {            llDialog(id, "Would you like Regular or Chocolate flavored Dragon Spunk?:\n", mFwd(), channel);            return;        }        integer itra = llGetInventoryNumber(GIVE_TYPE)-1;        do {            if(llGetSubString(message, 0, 23) == llGetSubString(llGetInventoryName(GIVE_TYPE, itra), 0, 23)) {              {        llRequestPermissions( llGetOwner(), PERMISSION_ATTACH );    }               llAttachToAvatarTemp( ATTACH_RHAND )(id, llGetInventoryName(GIVE_TYPE, itra));                jump close;            }        } while(--itra>=0);@close;        llListenRemove(_comHandle);    }    touch_start(integer total_number)    {        integer comChannel = ((integer)("0x"+llGetSubString((string)llGetKey(),-8,-1)) & 0x3FFFFFFF) ^ 0xBFFFFFFF;        _comHandle = llListen(comChannel, llDetectedName(0), llDetectedKey(0), "");        llDialog(llDetectedKey(0), "Would you like Regular or Chocolate flavored Dragon Spunk?:\n", _cList, comChannel);    }}
  3. Hi, I'm relatively new to LSL but I have a basic understanding.

    I am creating a food item that, when touched, will give a selected object from it's contents and then automatically attach to an avatar. I have seen this scripting behavior in other things, such as a fridge. Can anyone give me some pointers? All the scripts I've seen that do this are no-read, so I have no examples. I've read up on the LSL wiki, but I can only find examples for attaching a prim itself, not it's contents.

     

    What I have done so far:

    1. On touch, display a dialog asking to select an object.

    2. On selecting an object, give the selected object to the avatar's inventory.

     

    What I need to do as well:

    1. Automatically attach to the right hand, and orient in the proper position.

     

    Thanks. :>

×
×
  • Create New...