Problema:
Ci sono determinati oggetti che è desiderabile che possano essere dati gratuitamente a chi li chiede, ma solo da un determinato sottoinsieme di "distributori" autorizzati.
La soluzione è simile a quella che si adotta per vendere merce con slexchange, cercherò di presentare uno script semplice ma efficace.
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.
Secondo me è l'uovo di colombo per risolvere i nostri problemi.
Ti passo il receptor.
Come funziona:
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.
Script dentro il repository:
- Nota la prima cosa che fa il repository al reset è di segnalare la propria id che deve essere riportata sul dispenser
- Occorre mettere dentro il repository un oggetto con il nome da consegnare.
string pass="it_mentor";
default
{
state_entry()
{
llSetText("Central Repository",<1,1,1>,1);
llSay(0,llGetKey());
llSetTimerEvent(2.5);
}
timer() {
llGetNextEmail("", ""); // Check for email with any sender address and subject.
}
touch_start(integer total_number)
{
llSay(0, "Touched.");
}
email(string time, string address, string subj, string message, integer num_left) {
llSay(0, "You got mail! " + message);
// subject is the what, message is to be decrypted using password
message=llDeleteSubString(message, 0, llSubStringIndex(message, "\n\n") + 1);
string decrypted=llBase64ToString(llXorBase64Strings(message,llStringToBase64(pass)));
list parms=llParseString2List(decrypted,["|"],[]);
key whom=llList2Key(parms,0); // to whom give the object
string whomname=llList2String(parms,1); // their name
key object=llList2Key(parms,2); // dispenser key
key owner=llList2Key(parms,3); // owner of the key
// we may accept only a limited set of owner, object
llGiveInventory(whom,subj);
llSay(0,"Gave "+subj+" to "+whomname);
}
}
2\ vengono distribuite delle scatole che NON hanno contenuto, ma hanno il seguente script nomodify:
key target_key="fb96b2e6-cffa-2e08-e97d-1e2da5a97afd";
string what="Freebie #1";
string pass="it_mentor";
string sURL="http://www.salahzar.info/lsl/httplog.php?pass=PASS";
debug(string k,string action,string str)
{
string k="tran_"+(string)llGetKey()+llGetDate()+".txt";
string action="log";
string s=sURL+"&key="+llEscapeURL(k)+"&action="+action+"&text="+llEscapeURL(str);
llHTTPRequest(s,[],"");
}
default
{
state_entry()
{
llSetText("Toccami per avere "+what,<1,1,1>,1);
}
touch_start(integer i)
{
// manda una email all'oggetto principale, nel subject cosa mandare e nel testo
// l'id dell'avatar e il nome vengono criptati con una password in modo da non poter essere
// facilmente producibili senza questo programma. Inoltre viene spedita la key di questo
// 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
key id=llDetectedKey(0);
string name=llKey2Name(id);
llDialog(id,"Riceverai a breve "+what,[],-1);
//
string message=(string)id+"|"+name+"|"+(string)llGetKey()+"|"+(string)llGetOwner();
string crypt = llXorBase64Strings(llStringToBase64(message), llStringToBase64(pass));
llEmail((string)target_key + "@lsl.secondlife.com", what, crypt); // Send email central repository.
debug("tran_"+(string)llGetKey()+llGetDate()+".txt","log",message);
}
}
{
state_entry
}
Comments