modular.core

By: bdhtrn on Jan 19th, 2012  |  syntax: Linden Scripting  |  size: 1.38 KB  |  hits: 32  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1. integer cmdchannel=2;
  2. integer datachannel=-72492424;
  3. list segmentlist;
  4. rotation lastrot;
  5.  
  6. deployall(){
  7.     integer i;
  8.     for(i=0;i<llGetListLength(segmentlist);i++){
  9.         llRezObject(llList2String(segmentlist,i),llGetPos(),ZERO_VECTOR,ZERO_ROTATION,datachannel);
  10.     }
  11.     llSleep(0.5);
  12.     llShout(datachannel,"reorient");
  13. }
  14.  
  15. default{
  16.     state_entry(){
  17.         llListen(cmdchannel,"",llGetOwner(),"");
  18.         llListen(datachannel,"","","");
  19.         lastrot=llGetRot();
  20.         llSetTimerEvent(1);
  21.     }
  22.     listen(integer chan,string who,key id,string msg){
  23.         if(chan==cmdchannel){
  24.             if(msg=="compile"){
  25.                 if(llGetObjectName()=="Object")
  26.                     llOwnerSay("It is advisable that you change this core object's name and compile again.");
  27.                 else{
  28.                     segmentlist=[];
  29.                     llShout(datachannel,"compilelist");
  30.                 }
  31.             }
  32.             else if(msg=="deploy"){
  33.                 llShout(datachannel,"x");
  34.                 deployall();
  35.             }
  36.         }
  37.         else if(chan==datachannel){
  38.             segmentlist+=msg;
  39.         }
  40.     }
  41.     timer(){
  42.         if(llGetRot()!=lastrot){
  43.             lastrot=llGetRot();
  44.             llShout(datachannel,"reorient");
  45.         }
  46.     }
  47.     moving_end(){
  48.         llShout(datachannel,"reorient");
  49.     }
  50.        
  51. }