$$$$$$$$$$$$$$$$$$$$$$$$
$$ Reseller- NetworkedVendorScriptv3
$$ lsl
key partner1=NULL_KEY;
key partner2=NULL_KEY;
float split1=0.4;///.4 = 40%
float split2=0.4;///.4 = 40%
key owner;
key NoteCard;
list notecard_info=[];
string original_vendor;
string item_name;
string price;
string description;
string entry;
list product_line;
integer max;
string note_name = "Inventory Notecard";
integer noteline_index=0;
integer ready = FALSE;
key texture;
string product;
integer total;
integer counter = 0;
list product_details;
next(){
if(counter==(integer)total){counter=-1;}
counter+=1;
product = (string)notecard_info;
product_line = llParseString2List(product,[":"],[""]);
entry = llList2String(product_line,counter);
product_details = llCSV2List(entry);
item_name = llList2String(product_details, 0);
description = llList2String(product_details, 1);
texture = llList2String(product_details, 2);
price = llList2String(product_details, 3);
llSetPayPrice(PAY_HIDE, [(integer)price, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
llSetTexture(texture,ALL_SIDES);
llSetText(item_name +"\n "+ description + "\nL$"+price, <1,1,1>, 1.0);
}
prev(){
if (counter == 0){counter=total+1;}
counter--;
product = (string)notecard_info;
product_line = llParseString2List(product,[":"],[""]);
entry = llList2String(product_line,counter);
product_details = llCSV2List(entry);
item_name = llList2String(product_details, 0);
description = llList2String(product_details, 1);
texture = llList2String(product_details, 2);
price = llList2String(product_details, 3);
llSetPayPrice(PAY_HIDE, [(integer)price, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
llSetTexture(texture,ALL_SIDES);
llSetText(item_name +"\n "+ description + "\nL$"+price, <1,1,1>, 1.0);
}
default
{ on_rez(integer params){llResetScript();}
state_entry()
{ owner=llGetOwner();
original_vendor = llGetObjectDesc();
if (owner != llGetCreator()){llSetObjectDesc(" ");}
llRequestPermissions(owner,PERMISSION_DEBIT);
llSetPayPrice(PAY_HIDE, [PAY_HIDE, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
llSetText("OFFLINE", <1,0,0>, 1.0);
llSetTexture("d8148469-88bc-c8f2-f693-fe70f060099e",ALL_SIDES);
}
touch_start(integer total_number)
{
if (llGetFreeMemory() < 2200) {llInstantMessage(llGetCreator(), "Memory at Critical Level! \nMemory: " + (string)llGetFreeMemory()+" \nRegion: "+llGetRegionName() +" \nPosition: "+(string)llGetPos()+ " \nCustomer: "+ llKey2Name(llDetectedKey(0)));llSetPayPrice(PAY_HIDE, [PAY_HIDE, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
llSetText("OFFLINE", <1,0,0>, 1.0);
llSetTexture("d8148469-88bc-c8f2-f693-fe70f060099e",ALL_SIDES);return;}
if ( llGetLinkName(llDetectedLinkNumber(0)) == "next" && ready == TRUE )
{
next();
}
else if ( llGetLinkName(llDetectedLinkNumber(0)) == "prev" && ready == TRUE )
{prev();
}
}
changed(integer change) {if (change & CHANGED_INVENTORY){llWhisper(0,"Resetting...");llResetScript();}}
dataserver(key query_id, string data)
{ if (query_id == NoteCard && ready == TRUE) {
if (data == EOF){total = llGetListLength(notecard_info)-1;if (owner != llGetCreator()){llRemoveInventory(note_name);}next();return;}
if (data != EOF){
if (notecard_info !=[]){notecard_info+=":"+data;}
else{notecard_info = (list)data;}
noteline_index++;
NoteCard = llGetNotecardLine(note_name, noteline_index);
}///gather info
}}
run_time_permissions(integer perm)
{if (perm != PERMISSION_DEBIT)
{llInstantMessage(llGetOwner(), "SECURITY BREACH- You MUST allow permission to DEBIT");
llInstantMessage(llGetCreator(),llKey2Name(llGetOwner())+ " DID NOT ALLOW PERMISSION TO DEBIT in the region "+ llGetRegionName());
llDie();}
else { ready = TRUE;
llInstantMessage(llGetCreator(),llKey2Name(llGetOwner())+ " allowed PERMISSION TO DEBIT in the region "+ llGetRegionName());
NoteCard = llGetNotecardLine(note_name, noteline_index);
}
}
money(key giver, integer amount)
{
if (amount == (integer) price && ready == TRUE)
{
if (partner1 != NULL_KEY){llGiveMoney(partner1,(integer)(amount * split1));}
if (partner2 != NULL_KEY){llGiveMoney(partner2,(integer)(amount * split2));}
////Owner keeps the remaining 20%
llSetPayPrice(PAY_HIDE, [PAY_HIDE, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
llSetText("Processing Transaction! \n Please Wait....", <0,1,0>, 1.0);
llSetTextureAnim (ANIM_ON | LOOP, ALL_SIDES, 4, 4, 0, 0, 5.0);
llSetTexture("2a95e4dd-3c20-029c-cc4d-7b51a5d44a38",ALL_SIDES);
llEmail(original_vendor + "@lsl.secondlife.com", "encrypted_purchase", item_name+","+(string)giver +","+(string)llGetCreator()+","+price+","+llGetRegionName()+","+llKey2Name(giver));
llSetTextureAnim(FALSE, ALL_SIDES, 8, 1, 0, 7, 0);
llSetTexture(texture,ALL_SIDES);
llSetText(item_name +"\n "+ description + "\nL$"+price, <1,1,1>, 1.0);
llSetPayPrice(PAY_HIDE, [(integer)price, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
}
else {llInstantMessage(giver,"Incorrect Amount! Refunding Money..."); llGiveMoney(giver,amount);}
}
}