Panel

Linden Labs

Second Life ® y Linden Lab ® are registered trademarks from Linden Research, Inc. KodigoStyle is not affiliated or sponsored by Linden Reseach.
KodigoStyle API‎ > ‎API examples‎ > ‎

Log object clicks

This example code log all clicks on an object. In other object we retrieve the clicks list.

Remember to include the API header functions at the top of each script. AND USE THE SAME API CODE in both scripts.

default
{
    state_entry() {
        api_set_code("YOUR API CODE HERE");
    }
    
    touch_start(integer r) {

        // Send the log to the storage system, in a [new] table named 'userClicks'
        api_storage("ADD", "UserClicks", llKey2Name(llDetectedKey(0)), (string)llGetKey(), ""); 
        llInstantMessage(llDetectedKey(0), "Registered!");   
    }
    
}



default
{
    state_entry(){
        api_set_code("YOUR API CODE HERE");
    }
    
    touch_start(integer r) {

        // Use GET instead of ADD to get a list of registered values.
        
        // Set to blank the values you dont want to filter.
        
        api_storage("GET", "UserClicks", "", "", "");    
    }
    link_message(integer _sender_num, integer _num, string _str, key _id){
   
        if(_num!=2000){return;}
        
        list params = llParseString2List(_str, ["#"], []);
        string com1 = llList2String(params,0);
        string com2 = llList2String(params,1);
        
        if(com1=="RESPONSE"){
            integer i;
           
            // Ignore the #END response
            if(com2=="END")
                return; 
            
            // Print all the stored values
            for(i=1;i<llGetListLength(params);i++)
                llInstantMessage(llGetOwner(), (string)(i-1) + " value = " + llList2String(params,i));        
        }           
    }
}

  Sign in   Recent Site Activity   Terms   Report Abuse   Print page  |  Powered by Google Sites