Advertisement
salahzar

_llSetText_@

Oct 23rd, 2013
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Script scritta fluttuante
  2. // Lo script lo chiamate così: _llSetText_@:  gli ultimi due caratteri indicano separatori per andare a capo e per separare i parametri della descrizione
  3. // La descrizione è fatta in questo modo
  4. // Riga1_riga2_riga3@<1,1,1>@1
  5. // Testo----^        Colore  Alpha
  6. // Default colore = bianco <1,1,1>, alpha 1
  7. //
  8. string NL="^"; // va a capo nella desc
  9. string NF="~"; // separa desc da colore e da alpha
  10. list desc;
  11. string text;
  12. vector color;
  13. vector COLOR=<1,1,1>; // colore di default
  14. float alpha;
  15.  
  16. string strReplace(string str, string search, string replace) {
  17.     return llDumpList2String(llParseStringKeepNulls( str, [search], []), replace);
  18. }
  19.  
  20. init()
  21. {
  22.        NL=llGetSubString(llGetScriptName(),-2,-2);
  23.        NF=llGetSubString(llGetScriptName(),-1,-1);
  24.  
  25.        desc=llParseStringKeepNulls(llGetObjectDesc(),[NF],[]);
  26.         text=strReplace(llList2String(desc,0),NL,"\n");
  27.         color=COLOR;
  28.         alpha=1;
  29.         string x;
  30.         if(llGetListLength(desc)>1)
  31.         {
  32.            x=llList2String(desc,1);
  33.            if(x=="") color=<1,1,1>; else
  34.            color=(vector)llList2String(desc,1);
  35.         }
  36.         if(llGetListLength(desc)>2)
  37.         {
  38.            x=llList2String(desc,2);
  39.            if(x=="") alpha=1;
  40.            else          
  41.            alpha=(float)llList2String(desc,2);          
  42.         }
  43.        
  44. }
  45. default
  46. {
  47.     state_entry()
  48.     {
  49.         init();
  50.         llSetText(text,color,alpha);
  51.     llRemoveInventory(llGetScriptName());
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement