Advertisement
salahzar

Progetto distributore gratuito di oggetti notransfe08032008

Feb 16th, 2020
572
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.24 KB | None | 0 0
  1. Problema:
  2.  
  3. Ci sono determinati oggetti che è desiderabile che possano essere dati gratuitamente a chi li chiede, ma solo da un determinato sottoinsieme di "distributori" autorizzati.
  4.  
  5. La soluzione è simile a quella che si adotta per vendere merce con slexchange, cercherò di presentare uno script semplice ma efficace.
  6.  
  7. NOTA: questo sistema può funzionare anche per garantire che gli oggetti consegnati siano aggiornati in quanto i box da cui vengono presi NON DANNO l'inventory, ma chiedono ad una scatola centrale di dare quell'elemento all'avatar. L'oggetto è in grado di dare un elemento ogni circa 3 secondi. Per cui se c'è un traffico molto grande occorre trovare altri sistemi.
  8.  
  9.  
  10. Secondo me è l'uovo di colombo per risolvere i nostri problemi.
  11. Ti passo il receptor.
  12.  
  13. Come funziona:
  14.  
  15. 1\ il proprietario degli oggetti mette tutti i suoi oggetti in UNA sola scatola mettendo i diritti NOTRANSFER per il prossimo acquirente. La box ha una sua id key (la sua UUID) che non è pubblica.
  16. Script dentro il repository:
  17. - Nota la prima cosa che fa il repository al reset è di segnalare la propria id che deve essere riportata sul dispenser
  18. - Occorre mettere dentro il repository un oggetto con il nome da consegnare.
  19.  
  20. string pass="it_mentor";
  21.  
  22. default
  23. {
  24. state_entry()
  25. {
  26. llSetText("Central Repository",<1,1,1>,1);
  27. llSay(0,llGetKey());
  28. llSetTimerEvent(2.5);
  29. }
  30.  
  31. timer() {
  32. llGetNextEmail("", ""); // Check for email with any sender address and subject.
  33. }
  34.  
  35. touch_start(integer total_number)
  36. {
  37. llSay(0, "Touched.");
  38. }
  39. email(string time, string address, string subj, string message, integer num_left) {
  40. llSay(0, "You got mail! " + message);
  41.  
  42. // subject is the what, message is to be decrypted using password
  43. message=llDeleteSubString(message, 0, llSubStringIndex(message, "\n\n") + 1);
  44. string decrypted=llBase64ToString(llXorBase64Strings(message,llStringToBase64(pass)));
  45.  
  46. list parms=llParseString2List(decrypted,["|"],[]);
  47.  
  48. key whom=llList2Key(parms,0); // to whom give the object
  49. string whomname=llList2String(parms,1); // their name
  50. key object=llList2Key(parms,2); // dispenser key
  51. key owner=llList2Key(parms,3); // owner of the key
  52.  
  53. // we may accept only a limited set of owner, object
  54.  
  55. llGiveInventory(whom,subj);
  56.  
  57. llSay(0,"Gave "+subj+" to "+whomname);
  58.  
  59.  
  60.  
  61. }
  62. }
  63.  
  64.  
  65. 2\ vengono distribuite delle scatole che NON hanno contenuto, ma hanno il seguente script nomodify:
  66.  
  67. key target_key="fb96b2e6-cffa-2e08-e97d-1e2da5a97afd";
  68. string what="Freebie #1";
  69. string pass="it_mentor";
  70.  
  71. string sURL="http://www.salahzar.info/lsl/httplog.php?pass=PASS";
  72. debug(string k,string action,string str)
  73. {
  74. string k="tran_"+(string)llGetKey()+llGetDate()+".txt";
  75. string action="log";
  76. string s=sURL+"&key="+llEscapeURL(k)+"&action="+action+"&text="+llEscapeURL(str);
  77. llHTTPRequest(s,[],"");
  78. }
  79. default
  80. {
  81. state_entry()
  82. {
  83. llSetText("Toccami per avere "+what,<1,1,1>,1);
  84. }
  85. touch_start(integer i)
  86. {
  87. // manda una email all'oggetto principale, nel subject cosa mandare e nel testo
  88. // l'id dell'avatar e il nome vengono criptati con una password in modo da non poter essere
  89. // facilmente producibili senza questo programma. Inoltre viene spedita la key di questo
  90. // oggetto e la key dell'owner in modo tale che il distributore possa verificare all'interno di un elenco di key se l'oggetto o l'owner sono autorizzati a concedere questa cosa inoltre la transazione viene registrata
  91. key id=llDetectedKey(0);
  92. string name=llKey2Name(id);
  93.  
  94. llDialog(id,"Riceverai a breve "+what,[],-1);
  95. //
  96. string message=(string)id+"|"+name+"|"+(string)llGetKey()+"|"+(string)llGetOwner();
  97. string crypt = llXorBase64Strings(llStringToBase64(message), llStringToBase64(pass));
  98.  
  99. llEmail((string)target_key + "@lsl.secondlife.com", what, crypt); // Send email central repository.
  100. debug("tran_"+(string)llGetKey()+llGetDate()+".txt","log",message);
  101.  
  102. }
  103. }
  104.  
  105.  
  106. {
  107. state_entry
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement