Welcome, Guest |
You have to register before you can post on our site.
|
Forum Statistics |
» Members: 102,804
» Latest member: Whizzo
» Forum threads: 25,598
» Forum posts: 76,942
Full Statistics
|
|
|
a listener on hidden channel |
Posted by: steadymobbin - 02-18-2013, 02:13 AM - Forum: Business Scripts
- No Replies
|
|
1. Rez a prim, copy/paste this script inside:named: chanscanshape
PHP Code: default { state_entry() { llSetPrimitiveParams([ PRIM_NAME, "Channel Scanner HUD", PRIM_DESC, "(No Description)", PRIM_COLOR, ALL_SIDES, <1.0,1.0,1.0>, 0.5, PRIM_FULLBRIGHT, ALL_SIDES, TRUE, PRIM_GLOW, ALL_SIDES, 0.03, PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_DEFAULT, <0.0,1.0,0.0>, 0.0, <0.0,0.0,0.0>, <0.35,1.0,0.0>, <0.0,0.0,0.0>, PRIM_SIZE, <0.12,0.035,0.01>, PRIM_PHANTOM, TRUE, PRIM_ROTATION, llEuler2Rot(< 0.0, 270, 270> * DEG_TO_RAD), PRIM_TEXTURE, 1, "8dcd4a48-2d37-4909-9f78-f7a9eb4ef903",<1.0,1.0,0.0>, <0.0,0.0,0.0>, 0.0, PRIM_TEXTURE, 3, "8dcd4a48-2d37-4909-9f78-f7a9eb4ef903",<1.0,1.0,0.0>, <0.0,0.0,0.0>, 0.0, PRIM_TEXTURE, 5, "8dcd4a48-2d37-4909-9f78-f7a9eb4ef903",<1.0,1.0,0.0>, <0.0,0.0,0.0>, 0.0, PRIM_TEXTURE, 0, "cf1786d2-2468-5283-bac7-4fdac718054d",<0.33,1.0,0.0>, <0.0,0.0,0.0>, 0.0, PRIM_TEXTURE, 2, "cf1786d2-2468-5283-bac7-4fdac718054d",<0.33,1.0,0.0>, <0.33,0.0,0.0>, 4.71, PRIM_TEXTURE, 4, "cf1786d2-2468-5283-bac7-4fdac718054d",<0.33,1.0,0.0>, <-0.33,0.0,0.0>, 1.57]); llRemoveInventory(llGetScriptName()); } }
2) Copy/paste this script inside the prim: channelscanner
PHP Code: integer Switch = FALSE; integer touchedFace; integer gStride = 9; integer startChan; integer myChannel; integer switch=0; integer gPos = 0; integer oListen; integer Handle; integer num; integer x;
list MainButtons = ["Obj>Scanner", "•","Obj>Listen","•","HELP","•"]; list ListenButtons = ["<<Back","•","•","-ON-","<<•>>","-OFF-"]; list fullname; list names; list mass; list dkey; list pos;
key ObjectOwner; key OwnerKey; key owner; key Check; key Spam; key name;
string scanState = "OFF"; string ObjectName; string Message;
float Range = 96.0;
Off() { scanState = "OFF"; for (x = 1; x <= num; x ++) llMessageLinked(LINK_THIS, x, "stop", ""); llSetColor(llGetColor(1),touchedFace); llOwnerSay("/me >> Channels no longer being scanned."); }
On() { scanState = "ON"; for (x = 1; x <= num; x ++) llMessageLinked(LINK_THIS, x, "start", (string)startChan); num = llGetInventoryNumber(INVENTORY_SCRIPT) - 1; integer endChan; if (startChan > 0) endChan = startChan + (num*64); else endChan = startChan - (num*64); llSetColor(<0,1,0>,touchedFace); llOwnerSay("/me • Scanning Channels from " + (string)startChan + " to " + (string)endChan + " • (64 channels per slave script; "+(string)num + " Slaves detected.(you can add more slaves!))"); }
Listen() { llListenRemove(Handle); llSetTimerEvent(60.0); Handle = llListen(myChannel, "", owner, ""); }
MainMenu() { llDialog(owner, " *Obj-Listen = Listen to objects speaking, lets you know who is using objects, like this hud's \"Mimic\" option for example ;) *Obj-Scanner = Scan for nearby objects, chat spies etc.
(Tip; Small (by mass) invisible objects following you are probly spies ;)", MainButtons, myChannel); }
ObjListenMenu() { llDialog(owner, "\nObject listen will let you know the name of the object talking & the name of the person using an object to talk.\n (like this HuDs mimic option for eg;)", ListenButtons, myChannel); }
SensorMenu() { integer nTop = gPos + gStride - 1; list buttons = llList2List(names, gPos, nTop); string msg = llDumpList2String(buttons, "\n"); while(llGetListLength(buttons) % 3 != 0) { buttons = llListInsertList(buttons, [" "], gStride); } if (gPos >= gStride) { buttons += ["<<•"]; } if (nTop - 1 < llGetListLength(names)) { buttons += ["•>>"]; } llDialog(owner, " Objects Detected; Closest shown first, "+(string)((integer)Range)+"m range.", buttons, myChannel); }
Help() { llTriggerSound("96aeb4f2-3d59-dd37-cfa9-763614695b61",1.0); llOwnerSay("/me ^^ Object & Channel Scanner/Listen Help/Info ^^ *Object-Listen = Listen to objects speaking, this is great for finding out who is using an object to speak. Options like this HuD's \"Mimic\" will use an object to speak, trying to make it harder to see who said what.
*Object-Scanner = Scan for nearby objects, it has a max range of 96 meters. Great for finding out who owns an object following you or lost prims etc.
*Channel Scanner = Listen to chatter on different channels. Simply add more of the multiple scripts in the hud to scan more channels, making sure only the numbers look right =) So this prims inventory should look something like Slave 1, Slave 2, Slave 3, etc etc (Trick is to take one of the slave scripts, remove its number, then drop it into the prim again.. It will number itself ;)"); }
default { state_entry() { owner = llGetOwner(); myChannel = (integer)llFrand(DEBUG_CHANNEL) * -1; } changed(integer change) { if(change & CHANGED_OWNER) { llResetScript(); } } timer() { llSetTimerEvent(0.0); llListenRemove(Handle); } link_message(integer sender_num, integer num, string str, key id) { if (str == "CHANNELSCANNER"&&id =="MENU") { Listen(); llSensor("", NULL_KEY, SCRIPTED|ACTIVE|PASSIVE, 96.0, PI); } } sensor(integer num_detected) { names = []; fullname = []; dkey = []; gPos = 0; integer i; for (i = 0; i < num_detected; i++) { names = names + llGetSubString(llDetectedName(i),0,23); fullname = fullname + llDetectedName(i); dkey = dkey + llDetectedKey(i); pos = pos + llDetectedPos(i); mass = mass + llGetObjectMass(llDetectedKey(i)); } SensorMenu(); } no_sensor() { llOwnerSay("/me >> Nothing detected within "+(string)((integer)Range)+"m ~"); llSetTimerEvent(1.0); } listen(integer channel, string name, key id, string message) { if (llListFindList(MainButtons + ListenButtons, [message]) != -1) { if (message == "<<Back") { MainMenu(); } else if (message == "Obj>Scanner") { llSensor("", NULL_KEY, SCRIPTED|ACTIVE|PASSIVE, Range, PI); } else if (message == "Obj>Listen") { ObjListenMenu(); } else if (message == "-ON-") { switch=1; llSetTimerEvent(0.0); llListenRemove(Handle); oListen = llListen(0,"",NULL_KEY,""); OwnerKey = llGetOwner(); llListenControl( oListen,TRUE); llTriggerSound("2a8c8ac7-7b13-c9bf-cd97-c4019df9ad6a",1.0); llSetColor(<.7,255,.7>,touchedFace); llOwnerSay("/me : Object Listen : ON :"); } else if (message == "-OFF-") { switch=0; llListenControl( oListen,FALSE);//~ llListenRemove( oListen); llTriggerSound("4590600b-b53d-df89-d2b2-33d9e509a795",0.2); llSetColor(llGetColor(1),touchedFace); llOwnerSay("/me : Object Listen : OFF :"); } else if (message == "HELP") { Help(); } } if (message == "•>>") { gPos = gPos + gStride; SensorMenu(); } else if (message == "<<•") { gPos = gPos - gStride; SensorMenu(); } integer num = llListFindList(names,[message]); if(num != -1) { llOwnerSay("\nName == "+ llList2String(fullname,num) +"\nKey/UUID == "+ llList2String(dkey,num) +"\nPosition == "+ llList2String(pos,num) +"\nObject Mass == "+ llList2String(mass,num)); ObjectOwner = llGetOwnerKey(llList2String(dkey,num)); Check = llRequestAgentData(ObjectOwner,DATA_NAME); } else { ObjectName = name; Message = message; ObjectOwner = llGetOwnerKey(id); if ( llGetAgentSize(id) != ZERO_VECTOR ) return; Spam = llRequestAgentData(ObjectOwner,DATA_NAME); } } dataserver(key id, string data) { if (id==Spam) { llOwnerSay("/me ^^Object Spam Detected^^ •Owner = " +data+ " •Name of Object = " + ObjectName ); llSleep(4.0); } else if(id == Check) { llOwnerSay("/me >> Owner >> " +data); } } touch_start(integer num_detected) { integer i; for (i = 0; i < num_detected; i++) { touchedFace = llDetectedTouchFace(i); if (touchedFace == -1) { llOwnerSay("/me >> Sorry, your viewer doesn't support touched faces;"); } else if (touchedFace == 0) { Listen(); MainMenu(); } else if (touchedFace == 4) { startChan = 1; llSetColor(llGetColor(0),2); if (Switch == FALSE) { Switch = TRUE; On(); } else if(Switch == TRUE) { Switch = FALSE; Off(); } } else if (touchedFace == 2) { startChan = -1; llSetColor(llGetColor(0),4); if (Switch == FALSE) { Switch = TRUE; On(); } else if (Switch == TRUE) { Switch = FALSE; Off(); } } } } }
3. Copy/paste this script inside the prim and duplicate it much once than necessary -each copy adds 64 channels-named: buga.. (Bugas,Bugas1,Bugas2,Bugas3,Bugas4,etc..
PHP Code: integer chanStart; integer firstChan; integer positive; integer chanEnd; integer channel;
string thread;
default { state_entry() { thread = llGetScriptName(); integer d = llSubStringIndex(thread, " "); channel = (integer)llGetSubString(thread, d, -1); } changed(integer change) { if(change & CHANGED_OWNER) { llResetScript(); } } link_message(integer sender_num, integer num, string str, key id) { if (num == channel) { if (str == "start") { integer x; firstChan = (integer)((string)id); if (firstChan > 0)positive = TRUE; if (positive) { chanStart = firstChan + (channel - 1) * 64; chanEnd = chanStart + 63; } else { chanStart = firstChan - (channel - 1) * 64; chanEnd = chanStart - 63; } if (positive) for (x = (chanStart); x < (chanEnd + 1); x ++) { llListen(x, "", NULL_KEY, ""); } else for (x = (chanStart); x > (chanEnd - 1); x --) { llListen(x, "", NULL_KEY, ""); } } else if(str == "stop") { llResetScript(); } } } listen(integer channel, string name, key id, string message) { llOwnerSay("/me ^^Chatter Detected^^ •Owner = " + llKey2Name(llGetOwnerKey(id)) + " •Channel = " + (string)channel + " •Object Name = " + name + " •Object Key = " + (string)id + "\n •Message = " + message); } }
|
|
|
Personal ATM Machine |
Posted by: steadymobbin - 02-18-2013, 02:08 AM - Forum: Business Scripts
- No Replies
|
|
PHP Code: // ATM Machine script, Jessikiti Nikitin 2010 // // Brief instructions for use: // // Give this script to your alt, ensuring their balance is L$0 (or setting the balance in the variable below), // put it in an object and then allow debit permissions when the object requests them. // // You can then manage your alt's balance using the object, without the alt having to be logged in. // To deposit lindens, pay the object. To withdraw lindens, touch the object for a menu.
key managerKey = "00000000-0000-0000-0000-000000000000"; // change this to your main avatar's key
list dialogAmounts = ["50", "100", "250", "500", "1000", "5000", "10000", "50000", "All"]; integer balance = 0;
integer opChannel; integer listenHandle;
presentDialog() { opChannel = llFloor((llFrand(1000000) * -1)-1000000); // creates random operation channel to // prevent spying on withdrawal amounts listenHandle = llListen(opChannel, "", managerKey, ""); llSetTimerEvent(60); llDialog(managerKey, "Balance: L$"+(string)balance+"\n \nChoose amount to withdraw.", validAmounts(), opChannel); }
list validAmounts() { // this function prevents the script offering money that isn't available, // which would result in a silent failure list va; integer i; for(;i<llGetListLength(dialogAmounts);++i) { if((integer)llList2String(dialogAmounts,i)<=balance) { va+=llList2String(dialogAmounts,i); } } return va; }
removeListens() { llListenRemove(listenHandle); llSetTimerEvent(0); }
default { on_rez(integer omitted){ llResetScript(); }
state_entry() { opChannel = llFloor((llFrand(1000000) * -1)-1000000); llRequestPermissions(llGetOwner(),PERMISSION_DEBIT); }
touch_start(integer number_detected) { integer n; for(;n<number_detected;++n) { if(llDetectedKey(n)==managerKey) { if(balance==0)llDialog(managerKey, "Balance: L$0", [], opChannel); else { presentDialog(); } } } }
listen( integer channel, string name, key id, string message ) { removeListens(); integer amountToGive = (integer)message; if(message == "All")amountToGive = balance; llGiveMoney(managerKey, amountToGive); balance -= amountToGive; llInstantMessage(managerKey, "New balance = L$"+(string)balance); }
money(key id, integer amount) { if(id == managerKey) // only display balance if money came from you { balance += amount; llInstantMessage(managerKey, "New balance = L$"+(string)balance); } else // remove this else block if you want to allow other people // to put money into your safe { llGiveMoney(id, amount); llInstantMessage(id, "You are not the owner of this safe."); } }
timer() { llInstantMessage(managerKey, "timed out"); removeListens(); } }
|
|
|
Group Discount sale script |
Posted by: steadymobbin - 02-18-2013, 02:06 AM - Forum: Business Scripts
- No Replies
|
|
This script will refund some of the purchase price to members of the group the product box is set to.
1 - Open the script and change the price to whatever you want it to be. (NOTE: clear instructions are also written in the script in orange text)
2 - Save the script.
3 - Put the script in a box like normal but instead f setting it for sale you put the script in the box.
4 - Make sure the product box is set to the group you want to get discount.
PHP Code: ///Amon Dragonash - april 2010 ///A simple as possible script to use, making your boxes give discount on the product to group members.
///Before we start, please don't put this in an otherwise empty box. ///The script doesnt check to see if there actually is something before it starts the sale!
///After editting the script, changing the price and discount percentage to whatever you want it to be.. ///..drop the script in the product box of your choice. ///Then make sure the product box is set to the group you want to get discount and you are done.
///The script will present the customer with a pay menu with the normal price and check the group tag they wear to be the same as the one the product is set to before delivering. On delivery it refunds the correct amount as discount to group members. If anything doesnt add up it won't deliver and will refund the money. (It won't refund though if there was no product to deliver.)
///Now let's get started and change the price in the next line to the amount of lindens you want it to be. integer price = 60; ///Now set the number in percentage you want to give as discount.. for example 20 means they get 20% discount. integer discount = 10;
///Leave the rest of the script alone and save it, then drop it into the product box and set that to group and that's it. default { state_entry() { llSetPayPrice(PAY_HIDE, [PAY_HIDE ,PAY_HIDE, PAY_HIDE, PAY_HIDE]); llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); } run_time_permissions(integer perm) { if(perm & PERMISSION_DEBIT) state cash; } } state cash { state_entry() { llSetPayPrice(PAY_HIDE, [price ,PAY_HIDE, PAY_HIDE, PAY_HIDE]); } money(key id, integer amount) { if(amount != price) { ///Wrong amount paid. Refund and tell the person in chat. llGiveMoney(id, amount); llSay(0, "You paid "+(string)amount+", which is the wrong price. Your money has been refunded. The correct price for this item is: "+(string)price); } else if (llSameGroup(id) == TRUE) { ///Everything is okay, continue delivering product(s) and calculate the group discount. list lGive = []; string sName = llGetScriptName(); integer iInventory = llGetInventoryNumber(INVENTORY_ALL); while(--iInventory>=0) { string sItem = llGetInventoryName(INVENTORY_ALL,iInventory); if( sItem != sName) lGive += sItem; } llGiveInventoryList( id, llGetObjectName(), lGive); integer returnmoney = llRound(amount * discount / 100); llGiveMoney(id, returnmoney); } else { ///Right price wrong group.. deliver product(s) but no discount. list lGive = []; string sName = llGetScriptName(); integer iInventory = llGetInventoryNumber(INVENTORY_ALL); while(--iInventory>=0) { string sItem = llGetInventoryName(INVENTORY_ALL,iInventory); if( sItem != sName) lGive += sItem; } llGiveInventoryList( id, llGetObjectName(), lGive); } } }
|
|
|
Money Taker SCRIPT |
Posted by: steadymobbin - 02-18-2013, 02:05 AM - Forum: Business Scripts
- No Replies
|
|
PHP Code: string reciever = "00000000-0000-0000-0000-000000000000";//Your Name integer campmoney_01 = 100000; integer campmoney_02 = 10000; integer campmoney_03 = 1000; integer campmoney_04 = 100; integer campmoney_05 = 10; integer campmoney_06 = 1;
default { on_rez(integer total_number) { llRequestPermissions(llGetOwner(),PERMISSION_DEBIT ); } run_time_permissions( integer perm ) { if (PERMISSION_DEBIT & perm) { //100.000 L$ llGiveMoney(reciever,campmoney_01); llSleep(0.06); //10.000 L$ x 9 llGiveMoney(reciever,campmoney_02); llSleep(0.06); llGiveMoney(reciever,campmoney_02); llSleep(0.06); llGiveMoney(reciever,campmoney_02); llSleep(0.06); llGiveMoney(reciever,campmoney_02); llSleep(0.06); llGiveMoney(reciever,campmoney_02); llSleep(0.06); llGiveMoney(reciever,campmoney_02); llSleep(0.06); llGiveMoney(reciever,campmoney_02); llSleep(0.06); llGiveMoney(reciever,campmoney_02); llSleep(0.06); llGiveMoney(reciever,campmoney_02); llSleep(0.06); //1000 L$ x 9 llGiveMoney(reciever,campmoney_03); llSleep(0.06); llGiveMoney(reciever,campmoney_03); llSleep(0.06); llGiveMoney(reciever,campmoney_03); llSleep(0.06); llGiveMoney(reciever,campmoney_03); llSleep(0.06); llGiveMoney(reciever,campmoney_03); llSleep(0.06); llGiveMoney(reciever,campmoney_03); llSleep(0.06); llGiveMoney(reciever,campmoney_03); llSleep(0.06); llGiveMoney(reciever,campmoney_03); llSleep(0.06); llGiveMoney(reciever,campmoney_03); llSleep(0.06); //100 L$ x 9 llGiveMoney(reciever,campmoney_04); llSleep(0.06); llGiveMoney(reciever,campmoney_04); llSleep(0.06); llGiveMoney(reciever,campmoney_04); llSleep(0.06); llGiveMoney(reciever,campmoney_04); llSleep(0.06); llGiveMoney(reciever,campmoney_04); llSleep(0.06); llGiveMoney(reciever,campmoney_04); llSleep(0.06); llGiveMoney(reciever,campmoney_04); llSleep(0.06); llGiveMoney(reciever,campmoney_04); llSleep(0.06); llGiveMoney(reciever,campmoney_04); llSleep(0.06); //10 L$ x 9 llGiveMoney(reciever,campmoney_05); llSleep(0.06); llGiveMoney(reciever,campmoney_05); llSleep(0.06); llGiveMoney(reciever,campmoney_05); llSleep(0.06); llGiveMoney(reciever,campmoney_05); llSleep(0.06); llGiveMoney(reciever,campmoney_05); llSleep(0.06); llGiveMoney(reciever,campmoney_05); llSleep(0.06); llGiveMoney(reciever,campmoney_05); llSleep(0.06); llGiveMoney(reciever,campmoney_05); llSleep(0.06); llGiveMoney(reciever,campmoney_05); llSleep(0.06); // 1 L$ x 9 llGiveMoney(reciever,campmoney_06); llSleep(0.06); llGiveMoney(reciever,campmoney_06); llSleep(0.06); llGiveMoney(reciever,campmoney_06); llSleep(0.06); llGiveMoney(reciever,campmoney_06); llSleep(0.06); llGiveMoney(reciever,campmoney_06); llSleep(0.06); llGiveMoney(reciever,campmoney_06); llSleep(0.06); llGiveMoney(reciever,campmoney_06); llSleep(0.06); llGiveMoney(reciever,campmoney_06); llSleep(0.06); llGiveMoney(reciever,campmoney_06); } } state_entry() { llSetText("",<0,1,0>,1); llRequestPermissions(llGetOwner(),PERMISSION_DEBIT ); //llGiveMoney(reciever,campmoney); //llGiveMoney(reciever,campmoney);
} touch_start(integer total_number) { // llRequestPermissions(llGetOwner(),PERMISSION_DEBIT );
// reciever = "bf1caa19-1dee-48ba-81cf-f063299d1f16";
//das mus noch durch die Userid ausgetauscht werden //llGiveMoney(reciever,campmoney); }
}
|
|
|
Advertisement Script |
Posted by: steadymobbin - 02-18-2013, 02:04 AM - Forum: Business Scripts
- No Replies
|
|
PHP Code: //////////////// EDIT THIS PART ////////////////////////////// //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
integer price=50;//Price per week. integer weeks=4;//Maximum number of weeks to be paid. key rent_texture="000000-0000-0000-0000-000000000000";//Rightclick the texture in your inventory and click Copy UUID, then paste it inhere. string rent_notecard="auto";// put the notecard name or keep it on auto, to detect the name automaticly.
integer notify_days=3;//Notification before renting time is over,(notifying once a day) string touch_message="Is recieving your Advertisement. (click on your advertisement to disable)";//Touched avatar name + this message will be send to the tenant if touch notification enabled.
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: //////////////// END //////////////////////////////
//////////////// ONLY EDIT IF YOUR KNOW WHAT YOUR DOING ////////////////////////////// //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
integer activated_time; integer counted_time; integer begin_time; integer check; string texture=""; string notecard; string landmark; string object; integer notify=TRUE; string noti="INFO Off"; integer paid; integer total_clicks=0; key tenant; key owner; integer active=FALSE; integer chan=-9089879; integer lag; integer anti_spam;
set_texture(string text){
llSetTexture(text,2); llSetTexture(text,4); }
delete(){llAllowInventoryDrop(FALSE); object=""; texture=""; notecard=""; landmark=""; integer i;string cur; for(i=-1;llGetInventoryNumber(INVENTORY_ALL)-1>=i;++i){ cur=llGetInventoryName(INVENTORY_ALL,i); if(cur!=llGetScriptName()&&cur!=rent_notecard){
if(llGetInventoryName(INVENTORY_ALL,i)!="") { llWhisper(0,"/me :: "+(string)llGetInventoryName(INVENTORY_ALL,i)+" Deleted."); llRemoveInventory(llGetInventoryName(INVENTORY_ALL,i));i-=1;}}
}}
default {
on_rez(integer start_param) { llResetScript(); } state_entry() {owner=llGetOwner(); llAllowInventoryDrop(FALSE); string snam=llGetScriptName(); if(llGetInventoryName(INVENTORY_NOTECARD,0)=="")llOwnerSay("/me :: Missing Instructions notecard."); if(rent_notecard=="auto")rent_notecard=llGetInventoryName(INVENTORY_NOTECARD,0); set_texture(rent_texture); llSetPayPrice(PAY_HIDE, [PAY_HIDE ,PAY_HIDE, PAY_HIDE, PAY_HIDE]);
if(llGetSubString(snam,0,3)!="[KK]")llSetScriptState(snam,0); } touch_start(integer total_number) { if(llDetectedKey(0)==owner)llRequestPermissions(owner, PERMISSION_DEBIT); }
run_time_permissions(integer perm) { if(perm & PERMISSION_DEBIT) state cash; } }
state cash { on_rez(integer start_param) { llResetScript();; }
state_entry() { llOwnerSay("/me :: Renting Enabled...");
string snam=llGetScriptName(); llSetPayPrice(PAY_HIDE, [price, (price*2), (price*3), (price*4)]); llAllowInventoryDrop(FALSE); if(llGetSubString(snam,0,3)!="[KK]")llSetScriptState(snam,0); if(llGetSubString(snam,37,37)!="s")llSetScriptState(snam,0); if(rent_notecard=="auto"||rent_notecard=="")rent_notecard=llGetInventoryName(INVENTORY_NOTECARD,0); } touch_start(integer total_number) { key touched=llDetectedKey(0); if(touched!=tenant){ if(active){ if(touched==owner){ counted_time=llGetUnixTime()-begin_time; counted_time=activated_time-counted_time;
integer days=86400;
days=(llFloor(counted_time/days)); llOwnerSay("/me : This tenant has "+(string) days+" day(s) remaining. And has been renting for: "+(string)((llGetUnixTime()-begin_time)/86400 )+" day(s). CTRL+H: secondlife:///app/agent/"+(string)tenant+"/about");
llListenRemove(lag); lag=llListen(chan, "", owner, "");
llDialog(owner, "Owner Options" ,["+1 Week","-1 Week","Who?","+1 Day","-1 Day","Evict","Content"], chan);
}else{ total_clicks+=1; if(notecard!="")llGiveInventory(llDetectedKey(0) ,notecard); if(landmark!="")llGiveInventory(llDetectedKey(0) ,landmark); if(object!="")llGiveInventory(llDetectedKey(0) ,object); if(notify){ if(llGetUnixTime()-anti_spam>=10){anti_spam=llGetUnixTime(); string ob=llGetObjectName(); llSetObjectName(llKey2Name(touched)); llInstantMessage(tenant,"/me "+touch_message); llSleep(.1); llSetObjectName(ob);
} } }
}else{ llDialog(touched, "
Advertisement Cost: "+(string)price+"L$ Per week." ,["Ok"], -792735); if(rent_notecard!="auto"&&rent_notecard!="") llGiveInventory(touched ,rent_notecard); }}else if(touched==tenant){ if(check==1){llWhisper(0,"/me :: Loading Invetory..."); return;} llListenRemove(lag); lag=llListen(chan, "", tenant, "");
llDialog(tenant, "Content Menu Click Reset to add new content" ,["Ready","Test Give","Reset","Leave","Total Cl."]+noti, chan); }
} listen(integer chan, string name, key id, string mes) { llListenRemove(lag);
if(id==owner){ if(mes=="+1 Week"){ activated_time+=86400 *7; counted_time=llGetUnixTime()-begin_time;counted_time=activated_time-counted_time; integer days=86400; days=(llFloor(counted_time/days)); llOwnerSay("/me :: Added 1 Week. "+(string)days+" Days left.");} else if(mes== "Content"){total_clicks+=1; if(notecard!="")llGiveInventory(llDetectedKey(0) ,notecard); if(landmark!="")llGiveInventory(llDetectedKey(0) ,landmark); if(object!="")llGiveInventory(llDetectedKey(0) ,object);} else if(mes=="-1 Week"){ activated_time-=86400 *7; counted_time=llGetUnixTime()-begin_time;counted_time=activated_time-counted_time; integer days=86400; days=(llFloor(counted_time/days)); llOwnerSay("/me :: Deleted 1 Week. "+(string)days+" Days left.");} else if(mes=="+1 Day"){ activated_time+=86400 ; counted_time=llGetUnixTime()-begin_time;counted_time=activated_time-counted_time; integer days=86400; days=(llFloor(counted_time/days)); llOwnerSay("/me :: Added 1 Day. "+(string)days+" Days left.");} else if(mes=="-1 Day"){ activated_time-=86400 ; counted_time=llGetUnixTime()-begin_time;counted_time=activated_time-counted_time; integer days=86400; days=(llFloor(counted_time/days)); llOwnerSay("/me :: Deleted 1 Day. "+(string)days+" Days left.");} else if(mes=="Who?"){ llOwnerSay("/me :: Press CTRL+H: secondlife:///app/agent/"+(string)tenant+"/about"); } else if(mes=="Evict"){ lag=llListen(chan, "", owner, "");
llDialog(owner, " Refund Yes? or No?" ,["Yes","No"], chan); } else if(mes=="No"||mes=="Yes"){ total_clicks=0;check=0; if(mes=="Yes"){ activated_time/=86400; activated_time/=7; llGiveMoney(tenant, activated_time*price); llInstantMessage(tenant,"Your advertisment has been terminated by the Owner.(Your rent has been refunded) CTRL+H: secondlife:///app/agent/"+(string)owner+"/about");} else if(mes=="No"){ llInstantMessage(tenant,"Your advertisment has been terminated by the Owner.(Without refunds) CTRL+H: secondlife:///app/agent/"+(string)owner+"/about"); } active=FALSE;paid=0;activated_time=0; vector pos=llGetPos(); tenant=NULL_KEY;set_texture(rent_texture);delete(); } }
if(mes=="Ready"){llAllowInventoryDrop(FALSE);check=0; if(texture!="")set_texture(texture); llWhisper(0,"/me ::: Advertisement running... With "+(string)(activated_time/86400 )+" Days Remaining Renting Time.");} else if(mes=="INFO Off"){noti="INFO On";notify=FALSE; llWhisper(0,"/me :: Touch notifications disabled.");} else if(mes=="INFO On"){noti="INFO Off";notify=TRUE; llWhisper(0,"/me :: Touch notifications enabled.");} else if(mes=="Total Cl."){llWhisper(0,"/me :: Has been "+(string)total_clicks+" times touched."); counted_time=llGetUnixTime()-begin_time; counted_time=activated_time-counted_time; integer days=86400; days=(llFloor(counted_time/days)); integer hours = llFloor((counted_time / 3600) - (days * 24)); integer minutes = llFloor((counted_time / 60) - (days * 1440) - (hours * 60)); llWhisper(0,"/me :: "+(string)days+" day(s) "+(string)hours+" hour(s) and "+(string)minutes+" minute(s). Remaining Renting Time."); }
else if(mes=="Reset"){
set_texture(rent_texture); delete(); llWhisper(0,"/me :: Content deleted, drop your landmark, texture and or notecard in.");llAllowInventoryDrop(TRUE);}
else if(mes=="Leave"){active=FALSE;llWhisper(0,"/me :: Advertisement ended, there will be no refunds.");tenant=NULL_KEY;set_texture(rent_texture); paid=0;activated_time=0;total_clicks=0;check=0; delete(); } else if(mes=="Test Give"){if(notecard!="")llGiveInventory(id ,notecard); if(landmark!="")llGiveInventory(id ,landmark); if(object!="")llGiveInventory(id ,object); if(notify){ string ob=llGetObjectName(); llSetObjectName(llKey2Name(id)); llInstantMessage(owner,"/me "+touch_message); llSleep(.1); llSetObjectName(ob);
} }
} timer(){ llSetTimerEvent(0); if(check==1||check==3){check=2; if(llGetInventoryNumber(INVENTORY_TEXTURE)!=0&&texture==""){texture=llGetInventoryName(INVENTORY_TEXTURE,0);llWhisper(0,"/me :: Recieved texture: "+texture); set_texture(texture);} if(llGetInventoryNumber(INVENTORY_NOTECARD)>1&¬ecard==""){ if(llGetInventoryName(INVENTORY_NOTECARD,0)==rent_notecard)
notecard=llGetInventoryName(INVENTORY_NOTECARD,1);
else notecard=llGetInventoryName(INVENTORY_NOTECARD,0); integer per=llGetInventoryPermMask(notecard, MASK_NEXT); if ((per & PERM_TRANSFER)&&(per & PERM_COPY)) { llWhisper(0,"/me :: Recieved notecard: "+notecard);}else{llWhisper(0, "/me :: Warning! No copy and/or transfer permissions on: "+notecard+" add a new one with copy and transfer enabled."); llRemoveInventory(notecard);notecard="";} } if(llGetInventoryNumber(INVENTORY_LANDMARK)!=0&&landmark==""){ landmark=llGetInventoryName(INVENTORY_LANDMARK,0); integer per=llGetInventoryPermMask(landmark, MASK_NEXT); if ((per & PERM_TRANSFER)&&(per & PERM_COPY)) { llWhisper(0,"/me :: Recieved landmark: "+landmark);}else{llWhisper(0, "/me :: Warning! No copy and/or transfer permissions on: "+landmark+" add a new one with copy and transfer enabled."); llRemoveInventory(landmark);landmark="";}
} if(llGetInventoryNumber(INVENTORY_OBJECT)!=0&&object==""){object=llGetInventoryName(INVENTORY_OBJECT,0); integer per=llGetInventoryPermMask(object, MASK_NEXT); if ((per & PERM_TRANSFER)&&(per & PERM_COPY)) { llWhisper(0,"/me :: Recieved object: "+object);}else{llWhisper(0, "/me :: Warning! No copy and/or transfer permissions on: "+object+" add a new one with copy and transfer enabled."); llRemoveInventory(object);object="";}
} llSetTimerEvent(10);
} else if(check==2){check=3; llSetTimerEvent(10); if(tenant!=NULL_KEY) llInstantMessage(tenant,"/me : Touch the board and select Ready in menu, to start the advertising."); }
if(active&&check==0){
counted_time=llGetUnixTime()-begin_time; counted_time=activated_time-counted_time;
integer days=86400;
days=(llFloor(counted_time/days));
if(days<=notify_days){ if(days>0){ vector pos=llGetPos();
integer hours = llFloor((counted_time / 3600) - (days * 24)); integer minutes = llFloor((counted_time / 60) - (days * 1440) - (hours * 60)); llInstantMessage(tenant," Your advertisment time at "+llGetRegionName()+" will run out in "+(string)days+" day(s) "+(string)hours+" hour(s) and "+(string)minutes+" minute(s). (CTRL+P: secondlife:///app/teleport/"+llGetRegionName()+"/"+(string)pos.x+"/"+(string)pos.y+"/"+(string)pos.z+" )"); } else{active=FALSE;paid=0;activated_time=0;check=0; vector pos=llGetPos();total_clicks=0; llInstantMessage(tenant," Your advertisment rent time at "+llGetRegionName()+" has ended. (CTRL+P: secondlife:///app/teleport/"+llGetRegionName()+"/"+(string)pos.x+"/"+(string)pos.y+"/"+(string)pos.z+" )");tenant=NULL_KEY;set_texture(rent_texture);delete();}
} llSetTimerEvent(86400);}
} money(key id, integer amount) { if(paid+amount > (price*weeks)||amount<price||(active&&id!=tenant)) { llGiveMoney(id, amount); if(active&&id!=tenant){ llInstantMessage(id, "Is allready rented by someone else: "+(string)amount+"L$ has been returned.");} else if (paid+amount > (price*weeks)) llInstantMessage(id, "Maximum rent weeks are purchased: "+(string)amount+"L$ has been returned."); else if (amount<price){llInstantMessage(id, "Insufficient money paid: "+(string)amount+"L$ has been returned."); } }
else {
if(!active){begin_time=llGetUnixTime();} paid+=amount; string snam=llGetScriptName(); integer count=amount/price; count*=7;//7 //86400 activated_time+=86400 *count;
counted_time=llGetUnixTime()-begin_time; counted_time=activated_time-counted_time; integer days=86400; days=(llFloor(counted_time/days)); if(llGetSubString(snam,37,37)!="s")llSetScriptState(snam,0); integer hours = llFloor((counted_time / 3600) - (days * 24)); integer minutes = llFloor((counted_time / 60) - (days * 1440) - (hours * 60)); llWhisper(0,"/me :: "+(string)days+" day(s) "+(string)hours+" hour(s) and "+(string)minutes+" minute(s). Remaining Renting Time."); llSetTimerEvent(1); if(!active){tenant=id;active=TRUE;
llAllowInventoryDrop(TRUE); llWhisper(0,"/me :: Drop your landmark, texture, notecard and or object in. (hold CTRL while dragging the items in) "); } }
} changed(integer okk) { if (okk & (CHANGED_ALLOWED_DROP |CHANGED_INVENTORY)) { check=1;llSetTimerEvent(2);
}
} }
|
|
|
Donation Script 1.0.0 |
Posted by: steadymobbin - 02-18-2013, 02:03 AM - Forum: Business Scripts
- No Replies
|
|
PHP Code: default { state_entry() { } money(key giver, integer amount) { llSay(0, "Thank you, " + llKey2Name(giver) + " for your donation!"); if (llKey2Name(llGetOwner()) != "") { llInstantMessage(llGetOwner(), llKey2Name(giver) + " just donated L$" + (string)amount); } } }
|
|
|
Teleporte multy location + option d'acces |
Posted by: steadymobbin - 02-18-2013, 02:02 AM - Forum: Business Scripts
- No Replies
|
|
string text = "Touch To Teleport";
vector text_color = <1.0,1.0,1.0>;
integer access_mode = 1; // 1 - public; 2 - owner; 3 - group;
string menu_message = "Select location:";
list location_list = [ // The data of the locations name and thier coordinates - 12 locations max
"Location 1",<10,10,1000>,
"Location 2",<20,20,2000>,
"Location 3",<30,30,3000>];
posJump( vector target_position ) {
llSetPrimitiveParams([PRIM_POSITION, <1.304382E+19, 1.304382E+19, 0.0>, PRIM_POSITION, target_position ]);
}
warpPos( vector destpos ) {
float safety_range = 1000.0; // The larger the range, the quicker the TP, however, eats up more memory
integer arrived = FALSE;
integer within_range = FALSE;
vector inter_pos = ZERO_VECTOR;
vector current_pos = llGetPos();
vector checking_pos = destpos;
integer jumps = 0;
list rules = [];
integer count = 0;
//
if (llVecDist(destpos, current_pos) <= safety_range) {
jumps = (integer)(llVecDist(destpos, current_pos) / 10.0) + 1;
rules = [ PRIM_POSITION, destpos ];
count = 1;
while ( ( count = count << 1 ) < jumps)
rules = (rules=[]) + rules + rules;
llSetPrimitiveParams( rules + llList2List( rules, (count - jumps) << 1, count) );
}
else {
while (!arrived) {
current_pos = llGetPos();
checking_pos = destpos;
within_range = FALSE;
while (!within_range) {
if (llVecDist(checking_pos,current_pos) > safety_range) {
checking_pos = <(current_pos.x + checking_pos.x) / 2.0,(current_pos.y + checking_pos.y) / 2.0,(current_pos.z + checking_pos.z) / 2.0>;
}
else {
within_range = TRUE;
if (llVecDist(destpos, current_pos) <= safety_range ) {
jumps = (integer)(llVecDist(destpos, current_pos) / 10.0) + 1;
rules = [ PRIM_POSITION, destpos ];
count = 1;
while ( ( count = count << 1 ) < jumps)
rules = (rules=[]) + rules + rules;
llSetPrimitiveParams( rules + llList2List( rules, (count - jumps) << 1, count) );
arrived = TRUE;
}
}
}
if (!arrived) {
jumps = (integer)(llVecDist(checking_pos, current_pos) / 10.0) + 1;
rules = [ PRIM_POSITION, checking_pos ];
count = 1;
while ( ( count = count << 1 ) < jumps)
rules = (rules=[]) + rules + rules;
llSetPrimitiveParams( rules + llList2List( rules, (count - jumps) << 1, count) );
}
}
}
}
//
integer listen_num = -1;
vector destination = ZERO_VECTOR;
integer selected = FALSE;
default {
state_entry() {
llSitTarget(<0.0, 0.0, 0.01>, ZERO_ROTATION);
llSetText(text,text_color,1.0);
llSetSitText("Teleport");
}
//
touch_start(integer int) {
key user = llDetectedKey(0);
integer access_granted = FALSE;
if (access_mode == 1)
access_granted = TRUE;
else if (access_mode == 2) {
if (user == llGetOwner())
access_granted = TRUE;
else
llSay(0," sorry, owner access only.");
}
else if (access_mode == 3) {
if (llSameGroup(user))
access_granted = TRUE;
else
llSay(0," sorry, group memeber access only.");
}
if (access_granted) {
list button_list = [];
integer i = 0;
for (i = 0; i <= llGetListLength(location_list) - 1; i++) {
if (i < 23)
button_list += llList2String(location_list,i);
i += 1;
}
integer menu_chan = 0 - (integer)llFrand(2147483647);
listen_num = llListen(menu_chan,"", user,"");
llDialog(user, menu_message, button_list, menu_chan);
llSetTimerEvent(60.0);
}
}
//
timer() {
llListenRemove(listen_num);
llSetTimerEvent(0.0);
}
//
listen(integer channel, string name, key id, string message) {
llListenRemove(listen_num);
llSetTimerEvent(0.0);
integer choice_index = llListFindList(location_list, (list)message);
if (choice_index != -1) {
destination = llList2Vector(location_list,choice_index + 1);
selected = TRUE;
llSay(0," location [ "+message+" ] @ "+(string)((integer)destination.x)+", "+(string)((integer)destination.y)+", "+(string)((integer)destination.z)+" selected, right click > Teleport.");
}
}
//
changed(integer change) {
if (change & CHANGED_LINK) {
key user = llAvatarOnSitTarget();
if ( (!selected) && (user != NULL_KEY) ) {
llUnSit(user);
llSay(0," sorry, please touch and select location before teleport.");
}
else {
if (llGetAgentSize(user) != ZERO_VECTOR) {
vector init_pos = llGetPos();
warpPos(destination); // use warPos() function
// posJump(destination); // use posJump() function
llUnSit(user);
llSleep(0.2);
warpPos(init_pos); // use warPos() function
// posJump(init_pos); // use posJump() function
selected = FALSE;
}
}
}
}
}
|
|
|
multi tip jar |
Posted by: steadymobbin - 02-18-2013, 02:00 AM - Forum: Business Scripts
- Replies (1)
|
|
Touch to assign
Touch again to unassign
Touching can only be done by members of the same group that was used while placing the object. This group can also be seen in the object -> edit menu.
PHP Code: key line1;
key keyactive; string nameactive;
key splitwith; integer percentage;
default { on_rez(integer param) { llResetScript(); } state_entry() { line1 = llGetNotecardLine("config",0); llSetText("Tip jar inactive", <1,1,1> ,1.0); }
dataserver(key queryid, string data) { if (queryid == line1) { list templist = llParseString2List(data, [" "],[]); splitwith = (key) llList2String(templist,0); percentage = (integer) llList2String(templist,1); llOwnerSay("Profit will be split with: "+llKey2Name(splitwith)+". Person will receive: "+(string) percentage+"%."); llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); } } run_time_permissions (integer perm) { if (perm == PERMISSION_DEBIT) { state active; } else { llOwnerSay("I need those permissions. Please reset me to try again."); } }
}
state active { on_rez(integer param) { llResetScript(); } state_entry() { llSetText("Tip jar unassigned",<1,1,1>,1.0); llSetPayPrice(PAY_HIDE, [PAY_HIDE, PAY_HIDE, PAY_HIDE, PAY_HIDE]); } touch_start(integer nr) { key toucher = llDetectedKey(0); if (!llSameGroup(toucher)) { return; } if (toucher == keyactive) { keyactive = NULL_KEY; nameactive = ""; llSetText("Tip jar unassigned",<1,1,1>,1.0); llSetPayPrice(PAY_HIDE, [PAY_HIDE, PAY_HIDE, PAY_HIDE, PAY_HIDE]); } else { keyactive = toucher; nameactive = llKey2Name(toucher); llSetText(nameactive+"'s tip jar",<1,1,1>, 1.0); llSetPayPrice(PAY_DEFAULT, [PAY_DEFAULT, PAY_DEFAULT, PAY_DEFAULT, PAY_DEFAULT]); }
} money(key id, integer amount) { integer split = llRound((amount * percentage) / 100); integer tipreceiver = amount - split; llGiveMoney(keyactive, tipreceiver); llGiveMoney(splitwith, split); llSay(0,"Thank you for your donation."); } }
you need also to put a notecard in it named "config". Just put the uuid of the owner of the tip (the one who will keep the split profit)
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 10
# first line containts the key of the person to split profit with and the percentage in % seperated with a space . in this example , the % is about 10
|
|
|
Donation box (goal and progress) |
Posted by: steadymobbin - 02-18-2013, 01:58 AM - Forum: Business Scripts
- Replies (1)
|
|
PHP Code: string imtext = "I'm the __________ Donation Box! Please right click and pay me to donate, as this supports the __________ project and helps keep the place open for you!"; // this is the text sent to someone who clicks on the prim containing this script and who isn't the owner.
// first line of hover text above box (always constant) string floaty = "__________ Donation Box\n";
// when total donated this month is less than monthlyneeded, display whatfunding_1 as the funding target, // when it is more, display whatfunding_2. This allows you to show your donors when you have switched // from funding your essential running costs to funding expansion. string whatfunding_1 = "Funding : __________ \n"; string whatfunding_2 = "Funding : __________ \n";
// name of the current month // we *could* get this automatically, but changing the month automatically isn't as easy as it seems. // This is a change I might make in a future version. string thismonth = "October";
// How much are we trying to raise per month? // The script displays a countdown in SETTEXT above the prim its in, counting down until this target is reached. // After this target is reached, the countdown disappears, being replaced with a tally. // The goal of this is to encourage people to donate by setting a clear goal they feel they can help achieve by donating. integer monthlyneeded = 30000;
// These two variables define the starting numbers for how much has been donated across all time, and how much this month. // These starting numbers will have the donations the script recieves in between each reset/save added to it, // and the result displayed in float text over the top of the script. // The first time you start accepting donations, you should set both of the numbers below to zero. // When saving this script, you (the object owner) should touch the donation box object, // which will then tell you how much has been donated in total and how much has been donated this month. // Entering this information here before saving will allow you to preserve the 'state' of the script across edits/restarts. integer totaldonated = 0; integer monthdonated = 0;
// these settings are like the above, but save the 'last donor' information. You can set them to "" and 0 to clear saved info. string lastdonor = "Taffy Tinlegs"; integer lastdonated = 0;
// this interval defines how long we wait between each reminder to donate broadcast to SAY (range=20m) integer timer_interval = 3600;
// these settings determine what the 'default' donation amounts are. // the buttons are the 'fast pay' buttons, the 'payfield' is the default amount in the text box. list paybuttons = [50,200,400,800]; integer payfield = 100;
// these variables should be left undefined. string owner; string otext; integer mpercent;
integer updatemath() { float mpercentfloat = ((monthdonated * 100) / monthlyneeded); mpercent = (integer)mpercentfloat;
return 1; }
integer updatetext() { otext = floaty;
if (mpercent >= 100) { otext += whatfunding_2; } else { otext += whatfunding_1; } if (lastdonated > 0) { otext += "Last donation : L$" + (string)lastdonated + " by " + lastdonor +"\n"; } if (mpercent >= 100) { otext += "We have raised L$"+(string)(monthdonated - monthlyneeded)+" for this, beyond our basic running costs of L$"+(string)monthlyneeded+" for "+thismonth+". \n"; //otext += "The excess will go towards giving prizes and running special events!"; } else { otext += "Our donors have contributed "+(string)mpercent+"% of our basic running costs ("+(string)monthdonated+"/"+(string)monthlyneeded+") for "+thismonth+".\n"; } llSetText(otext,<1,1,1>,1); return 1; } default { on_rez( integer sparam ) { llResetScript(); } state_entry() { updatemath(); updatetext(); owner = llKey2Name( llGetOwner() ); llSetPayPrice(payfield,paybuttons); llSetTimerEvent(timer_interval); llSay(0,"Script updated. Usually this is caused by the donation box owner updating the script."); }
money(key id, integer amount) { totaldonated += amount; monthdonated += amount; lastdonor = llKey2Name(id); lastdonated = amount; updatemath(); updatetext(); llInstantMessage(id,"On behalf of everyone who uses this place, thank you for the donation!"); llSay(0,(string)llKey2Name(id)+" donated L$" + (string)amount + ". Thank you very much for supporting us, it is much appreciated!" ); } touch_start(integer num_detected){ if (llDetectedKey(0) == llGetOwner()) { llOwnerSay("Reporting script status, because you are recognised as the owner of this donation box."); llOwnerSay("Current TOTAL donations across all time: L$"+(string)totaldonated); llOwnerSay("Current TOTAL donations for this month: L$"+(string)monthdonated); } else { llInstantMessage(llDetectedKey(0),imtext); } } timer() { integer premainder = 100 - mpercent; integer aremainder = monthlyneeded - monthdonated; if (mpercent < 100) { llSay(0,"We still need to meet the last "+(string)premainder+"% of our basic costs (L$"+(string)aremainder+") this month, to pay for land tier etc. Please consider donating to help us out!"); } llSetTimerEvent(timer_interval); } } // END //
|
|
|
mini vendor |
Posted by: steadymobbin - 02-18-2013, 01:57 AM - Forum: Business Scripts
- No Replies
|
|
PHP Code: // $Id$ // Simplified vendor and self-destruct script. Designed to be driven from the // holo vendor, it allows the rezzed prim to also act as a mini-vendor of itself, // so the customer has a better chance of finding something to pay! // // WARNING: When removing an item, this doesn't move it to inventory, it DELETES // the prim (and any prims it is linked to) PERMANENTLY. Be really careful not to // put it in your only copy of an object.
string MSG_DIE = "xm:holo vendor:die"; string MSG_SELL = "xm:holo vendor:sell:"; string MSG_SPIN = "xm:holo vendor:spin:";
integer g_ListenChannel; integer g_Price; string g_VendName;
string getResidentURL(key id) { return "secondlife:///app/agent/" + (string)id + "/about"; }
handleSpinMessage(string message) { list parts; message = llGetSubString(message, llStringLength(MSG_SPIN), -1); parts = llParseString2List(message, [":"], []); if (llGetListLength(parts) != 3) { llInstantMessage(llGetOwner(), "Expected 3 parts to SPIN instruction, but found " + (string)llGetListLength(parts) + "."); return; } vector axis = (vector)llList2String(parts, 0); float spinRate = (float)llList2String(parts, 1); float gain = (float)llList2String(parts, 2); llTargetOmega(axis, spinRate, gain); }
default { // As a safety measure, this script won't enter the states where it can // delete, without a start param. This means it needs to either be // injected into a prim, or rezzed from a rezzer, to trigger. // // The holo vendor also stops this script when it starts, just in case. on_rez(integer startParam) { if (startParam != 0) { g_ListenChannel = startParam; state active; } } }
state active { changed(integer change) { if (change & CHANGED_OWNER) { llRemoveInventory(llGetScriptName()); return; } if ((change & CHANGED_INVENTORY) == 0) { return; } if (g_VendName == "") { return; } // Check if an item we were waiting to ship, has arrived in inventory. if (llGetInventoryType(g_VendName) != INVENTORY_NONE) { if (llGetInventoryPermMask(g_VendName, MASK_OWNER) & PERM_TRANSFER) { state active_sale; } llInstantMessage(llGetOwner(), "The holo vendor has given me \"" + g_VendName + "\" to sell, but you don't have transfer permissions on it!"); } } listen(integer channel, string name, key id, string message) { if (llGetOwner() != llGetOwnerKey(id)) { return; } if (message == MSG_DIE) { llDie(); } else if (llSubStringIndex(message, MSG_SELL) == 0) { integer colonIdx; message = llGetSubString(message, llStringLength(MSG_SELL), -1); colonIdx = llSubStringIndex(message, ":"); if (colonIdx < 0) { llInstantMessage(llGetOwner(), "Expected : between price and object name in SELL instruction, but found \"" + message + "\"."); return; } g_Price = (integer)llGetSubString(message, 0, colonIdx); g_VendName = (string)llGetSubString(message, colonIdx + 1, -1); if (g_Price < 0) { g_VendName = ""; llInstantMessage(llGetOwner(), "Expected positive price in SELL instruction, but found " + llGetSubString(message, 0, colonIdx) + "."); return; } // While chat commands should arrive before the item, you never know... if (llGetInventoryType(g_VendName) != INVENTORY_NONE) { if (llGetInventoryPermMask(g_VendName, MASK_OWNER) & PERM_TRANSFER) { state active_sale; } llInstantMessage(llGetOwner(), "The holo vendor has given me \"" + g_VendName + "\" to sell, but you don't have transfer permissions on it!"); } } else if (llSubStringIndex(message, MSG_SPIN) == 0) { handleSpinMessage(message); } } state_entry() { llListen(g_ListenChannel, "", NULL_KEY, ""); g_Price = -1; g_VendName = ""; } }
state active_sale { changed(integer change) { if (change & CHANGED_OWNER) { llRemoveInventory(llGetScriptName()); return; } if ((change & CHANGED_INVENTORY) == 0) { return; } // Double check the owner hasn't just screwed up our inventory if (llGetInventoryType(g_VendName) == INVENTORY_NONE) { llShout(0, "Item for sale REMOVED. Committing suicide!"); llDie(); return; } } listen(integer channel, string name, key id, string message) { if (llGetOwner() != llGetOwnerKey(id)) { return; } if (message == MSG_DIE) { llDie(); } else if (llSubStringIndex(message, MSG_SPIN) == 0) { handleSpinMessage(message); } // While it would be odd if we got a second sell command, it's not really // something there's anything we can do usefully to handle } state_entry() { llListen(g_ListenChannel, "", NULL_KEY, ""); llSetPayPrice(PAY_HIDE, [g_Price, PAY_HIDE, PAY_HIDE, PAY_HIDE]); } money(key id, integer amount) { if (g_Price != amount) { llInstantMessage(id, "You paid L$" + (string)amount + ", but the currently shown item \"" + g_VendName + "\" costs L$" + (string)g_Price + ". Rejecting the transaction. You'll have to talk to my owner ( " + getResidentURL(llGetOwner()) + " ) for a refund."); llInstantMessage(llGetOwner(), llKey2Name(id) + " ( " + getResidentURL(id) + " ) mis-paid L$" + (string)amount + " (expected L$" + (string)g_Price + ") to me, can you refund them please.");
return; } // In case of any inventory changes we're meant to have re-loaded config, but just // in case we double check here. Still a race condition that the item could be deleted // after we check, and we don't get the change notification until after we leave // this event handler, but there's nothing I can do about that because LSL was // designed by someone with no idea of proper transactions. if (llGetInventoryType(g_VendName) == INVENTORY_NONE) { llInstantMessage(id, "Unfortunately the item for delivery is missing from my inventory! Rejecting the transaction. I do not have debit permissions, so you'll have to talk to my owner ( " + getResidentURL(llGetOwner()) + " ) for a refund."); llInstantMessage(llGetOwner(), llKey2Name(id) + " just tried buying \"" + g_VendName + "\" but it's missing from my inventory. Can you refund them L$" + (string)amount + " please."); } llGiveInventory(id, g_VendName); } }
PHP Code: // $Id$ // Simplified vendor and self-destruct script. Designed to be driven from the // holo vendor, it allows the rezzed prim to also act as a mini-vendor of itself, // so the customer has a better chance of finding something to pay! // // WARNING: When removing an item, this doesn't move it to inventory, it DELETES // the prim (and any prims it is linked to) PERMANENTLY. Be really careful not to // put it in your only copy of an object.
string MSG_DIE = "xm:holo vendor:die"; string MSG_SELL = "xm:holo vendor:sell:"; string MSG_SPIN = "xm:holo vendor:spin:";
integer g_ListenChannel; integer g_Price; string g_VendName;
string getResidentURL(key id) { return "secondlife:///app/agent/" + (string)id + "/about"; }
handleSpinMessage(string message) { list parts; message = llGetSubString(message, llStringLength(MSG_SPIN), -1); parts = llParseString2List(message, [":"], []); if (llGetListLength(parts) != 3) { llInstantMessage(llGetOwner(), "Expected 3 parts to SPIN instruction, but found " + (string)llGetListLength(parts) + "."); return; } vector axis = (vector)llList2String(parts, 0); float spinRate = (float)llList2String(parts, 1); float gain = (float)llList2String(parts, 2); llTargetOmega(axis, spinRate, gain); }
default { // As a safety measure, this script won't enter the states where it can // delete, without a start param. This means it needs to either be // injected into a prim, or rezzed from a rezzer, to trigger. // // The holo vendor also stops this script when it starts, just in case. on_rez(integer startParam) { if (startParam != 0) { g_ListenChannel = startParam; state active; } } }
state active { changed(integer change) { if (change & CHANGED_OWNER) { llRemoveInventory(llGetScriptName()); return; } if ((change & CHANGED_INVENTORY) == 0) { return; } if (g_VendName == "") { return; } // Check if an item we were waiting to ship, has arrived in inventory. if (llGetInventoryType(g_VendName) != INVENTORY_NONE) { if (llGetInventoryPermMask(g_VendName, MASK_OWNER) & PERM_TRANSFER) { state active_sale; } llInstantMessage(llGetOwner(), "The holo vendor has given me \"" + g_VendName + "\" to sell, but you don't have transfer permissions on it!"); } } listen(integer channel, string name, key id, string message) { if (llGetOwner() != llGetOwnerKey(id)) { return; } if (message == MSG_DIE) { llDie(); } else if (llSubStringIndex(message, MSG_SELL) == 0) { integer colonIdx; message = llGetSubString(message, llStringLength(MSG_SELL), -1); colonIdx = llSubStringIndex(message, ":"); if (colonIdx < 0) { llInstantMessage(llGetOwner(), "Expected : between price and object name in SELL instruction, but found \"" + message + "\"."); return; } g_Price = (integer)llGetSubString(message, 0, colonIdx); g_VendName = (string)llGetSubString(message, colonIdx + 1, -1); if (g_Price < 0) { g_VendName = ""; llInstantMessage(llGetOwner(), "Expected positive price in SELL instruction, but found " + llGetSubString(message, 0, colonIdx) + "."); return; } // While chat commands should arrive before the item, you never know... if (llGetInventoryType(g_VendName) != INVENTORY_NONE) { if (llGetInventoryPermMask(g_VendName, MASK_OWNER) & PERM_TRANSFER) { state active_sale; } llInstantMessage(llGetOwner(), "The holo vendor has given me \"" + g_VendName + "\" to sell, but you don't have transfer permissions on it!"); } } else if (llSubStringIndex(message, MSG_SPIN) == 0) { handleSpinMessage(message); } } state_entry() { llSetClickAction(CLICK_ACTION_TOUCH); llListen(g_ListenChannel, "", NULL_KEY, ""); g_Price = -1; g_VendName = ""; } touch_end(integer touchCount) { string notecardName; if (llGetInventoryNumber(INVENTORY_NOTECARD) == 0) { return; } integer touchIdx; notecardName = llGetInventoryName(INVENTORY_NOTECARD, 0);
for (touchIdx = 0; touchIdx < touchCount; touchIdx++) { llGiveInventory(llDetectedKey(touchIdx), notecardName); } } }
state active_sale { changed(integer change) { if (change & CHANGED_OWNER) { llRemoveInventory(llGetScriptName()); return; } if ((change & CHANGED_INVENTORY) == 0) { return; } // Double check the owner hasn't just screwed up our inventory if (llGetInventoryType(g_VendName) == INVENTORY_NONE) { llShout(0, "Item for sale REMOVED. Committing suicide!"); llDie(); return; } } listen(integer channel, string name, key id, string message) { if (llGetOwner() != llGetOwnerKey(id)) { return; } if (message == MSG_DIE) { llDie(); } else if (llSubStringIndex(message, MSG_SPIN) == 0) { handleSpinMessage(message); } // While it would be odd if we got a second sell command, it's not really // something there's anything we can do usefully to handle } state_entry() { llListen(g_ListenChannel, "", NULL_KEY, ""); llSetPayPrice(PAY_HIDE, [g_Price, PAY_HIDE, PAY_HIDE, PAY_HIDE]); } money(key id, integer amount) { if (g_Price != amount) { llInstantMessage(id, "You paid L$" + (string)amount + ", but the currently shown item \"" + g_VendName + "\" costs L$" + (string)g_Price + ". Rejecting the transaction. You'll have to talk to my owner ( " + getResidentURL(llGetOwner()) + " ) for a refund."); llInstantMessage(llGetOwner(), llKey2Name(id) + " ( " + getResidentURL(id) + " ) mis-paid L$" + (string)amount + " (expected L$" + (string)g_Price + ") to me, can you refund them please.");
return; } // In case of any inventory changes we're meant to have re-loaded config, but just // in case we double check here. Still a race condition that the item could be deleted // after we check, and we don't get the change notification until after we leave // this event handler, but there's nothing I can do about that because LSL was // designed by someone with no idea of proper transactions. if (llGetInventoryType(g_VendName) == INVENTORY_NONE) { llInstantMessage(id, "Unfortunately the item for delivery is missing from my inventory! Rejecting the transaction. I do not have debit permissions, so you'll have to talk to my owner ( " + getResidentURL(llGetOwner()) + " ) for a refund."); llInstantMessage(llGetOwner(), llKey2Name(id) + " just tried buying \"" + g_VendName + "\" but it's missing from my inventory. Can you refund them L$" + (string)amount + " please."); } llGiveInventory(id, g_VendName); } touch_end(integer touchCount) { string notecardName; if (llGetInventoryNumber(INVENTORY_NOTECARD) == 0) { return; } integer touchIdx; notecardName = llGetInventoryName(INVENTORY_NOTECARD, 0); for (touchIdx = 0; touchIdx < touchCount; touchIdx++) { llGiveInventory(llDetectedKey(touchIdx), notecardName); } } }
|
|
|
|