sell script
|
|
Robo Eros
Registered User
Join date: 19 Feb 2007
Posts: 13
|
03-19-2007 04:31
hello everybody, i'm working on a sell script. So this is what i have: /// sell integer dialog_channel= 427; list menu = [ "Typ 1", "Typ 2" , "Typ 3", "Nachricht senden" ]; default { state_entry() { llListen( dialog_channel, "", NULL_KEY, ""  ; } touch_start(integer total_number) // Menu Übersicht mit touch offen { llDialog( llDetectedKey( 0 ), "What would you like to buy?", menu, dialog_channel ); } listen(integer chan, string name, key id, string mes) { if (mes == "Typ 1" { // here i want take the money } } } 1. for example if the customer choose typ 1 so my first step must be to send him a menu with the price. Which function can i use for doing this? 2. how can i change the personal menu. If you push with the right button on an object opens an menu with the atributes : touch,..and so on. Some people change it..so when i do it with a car i can choose drive..how can i do this? best regards robo
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
03-19-2007 06:45
From: Robo Eros hello everybody, i'm working on a sell script. So this is what i have: /// sell integer dialog_channel= 427; list menu = [ "Typ 1", "Typ 2" , "Typ 3", "Nachricht senden" ]; default { state_entry() { llListen( dialog_channel, "", NULL_KEY, ""  ; } touch_start(integer total_number) // Menu Übersicht mit touch offen { llDialog( llDetectedKey( 0 ), "What would you like to buy?", menu, dialog_channel ); } listen(integer chan, string name, key id, string mes) { if (mes == "Typ 1" { // here i want take the money } } } 1. for example if the customer choose typ 1 so my first step must be to send him a menu with the price. Which function can i use for doing this? 2. how can i change the personal menu. If you push with the right button on an object opens an menu with the atributes : touch,..and so on. Some people change it..so when i do it with a car i can choose drive..how can i do this? best regards robo The problem you will have with your first request is that you cannot request money, only receive it. So even if you do display a menu you cannot make some one pay you from it. Your best bet is to use the llSetPayPrice function. This would allow you to dynamically change the pay price menu when they make their selections so that when they do select pay it displays the right values.
Your second problem/request is a little ambiguious. Do you mean how do you change the text or change the default operation? The default sit text is altered using
llSetSitText("new text");
To change the default operation use the objects properties dialog and alter the when left clicked option.
|
|
Robo Eros
Registered User
Join date: 19 Feb 2007
Posts: 13
|
thanks
03-19-2007 16:09
hi,
thanks..you helped me very much. So now I'm using the function "llSetPayPrice"
llSetPayPrice(PAY_HIDE, [150 ,PAY_HIDE, PAY_HIDE, PAY_HIDE]); llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
so now it opens a menu which ask to take the money from the customer. Thats great but i can't see anywhere the Price. The system only ask for LS but it does't show the price. can I change it? I think it is very important to see the price...
best regards
Robo
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
03-20-2007 01:25
From: Robo Eros hi,
thanks..you helped me very much. So now I'm using the function "llSetPayPrice"
llSetPayPrice(PAY_HIDE, [150 ,PAY_HIDE, PAY_HIDE, PAY_HIDE]); llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
so now it opens a menu which ask to take the money from the customer. Thats great but i can't see anywhere the Price. The system only ask for LS but it does't show the price. can I change it? I think it is very important to see the price...
best regards
Robo llSetPayPrice is how you specify the price. llSetPayPrice(integer price, list quick_pay_buttons) where pay_buttosn is a list of 4 amounts or PAY_HIDE or PAY_DEFAULT. With teh code you are using it will set the price to 150 l$ and then hide all of the buttons. Be very aware that you should still check the amount paid in the money event.
|
|
Robo Eros
Registered User
Join date: 19 Feb 2007
Posts: 13
|
mhh
03-20-2007 04:22
ok so is it right that the custumer can only see the price oh a button? My Main problem is that the object asks for LS but don't use the price 100 LS. How can i do this?
best regards robo
|
|
Robo Eros
Registered User
Join date: 19 Feb 2007
Posts: 13
|
mh
03-20-2007 16:25
hi, i have a new problem: look at my selling script or maybe try it  /// sell integer dialog_channel= 427; list menu = [ "Typ 1", "Typ 2" , "Typ 3", "Nachricht senden" ]; default { state_entry() { llListen( dialog_channel, "", NULL_KEY, ""  ; } touch_start(integer total_number) // Menu Übersicht mit touch offen { llDialog( llDetectedKey( 0 ), "What would you like to buy?", menu, dialog_channel ); } listen(integer chan, string name, key id, string mes) { if (mes == "Typ 1" { llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); run_time_permissions(integer perm)// here is the mistake { if(perm & PERMISSION_DEBIT) state cash; } } } } so it shows always the error "syntax error" at line: run_time_permissions(integer perm) i don't know really why...can anybody help me? best reagrds robo
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
03-21-2007 02:55
You have the run timer permissions event handler as a part of the listen event handler which is wrong. Also you should only be requesting owner debit permissions once at rez not every time someone tries to buy anything. Its YOU the owner who is being affected not the buyer (see my previous post) I'd also replace the hard coded dialog channel with a randomly chossen one and only activate the listen when required (reduces lag) /// sell integer Listening; integer CHANNEL; list menu = [ "Typ 1", "Typ 2" , "Typ 3", "Nachricht senden" ];
// -------------------------- UpdateListen(key id) { CancelListen(); CHANNEL = 0 - (integer)llFrand(2147483647); Listening = llListen(CHANNEL,"",id,""); llSetTimerEvent(20); } // -------------------------- CancelListen() { if(Listening > 0) llListenRemove(Listening); Listening = 0; llSetTimerEvent(0); }
default { state_entry() { llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); // Just assume they where granted. } touch_start(integer total_number) // Menu Übersicht mit touch offen { key id = llDetectedKey( 0 ) ; UpdateListen( id); llDialog(id, "What would you like to buy?", menu, CHANNEL ); } listen(integer chan, string name, key id, string mes) { CancelListen(); if ("Typ 1" == mes) state cash; } timer() { CancelListen(); }
}
|
|
Robo Eros
Registered User
Join date: 19 Feb 2007
Posts: 13
|
mhhhh
03-21-2007 15:26
hi, ok i have extended my script. /// sell integer Listening; integer CHANNEL; integer price = 100; list menu = [ "Typ 1", "Typ 2" , "Typ 3", "Nachricht senden" ]; // -------------------------- UpdateListen(key id) { CancelListen(); CHANNEL = 0 - (integer)llFrand(2147483647); Listening = llListen(CHANNEL,"",id,""  ; llSetTimerEvent(20); } // -------------------------- CancelListen() { if(Listening > 0) llListenRemove(Listening); Listening = 0; llSetTimerEvent(0); } default { state_entry() { llSetTouchText("buy" ); } touch_start(integer total_number) // Menu Übersicht mit touch offen { key id = llDetectedKey( 0 ) ; UpdateListen( id); llDialog(id, "What would you like to buy?", menu, CHANNEL ); } listen(integer chan, string name, key id, string mes) { CancelListen(); if ("Typ 1" == mes) state cash; } timer() { CancelListen(); } } state cash { state_entry() { llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); // Just assume they where granted. llSetPayPrice(price, [price ,PAY_HIDE, PAY_HIDE, PAY_HIDE]); } money(key id, integer amount) { if(amount != price) { llGiveMoney(id, amount); llInstantMessage(id, "You payed "+(string)amount+", which is the wrong price, the price is: "+(string)price); } else { llInstantMessage(id, "You payed the right price"  ; } } } But it doesn't work right. First i can choose a type. If i choose typ 1 so the object want money from me. But the request : money(key id, integer amount) { if(amount != price) { llGiveMoney(id, amount); llInstantMessage(id, "You payed "+(string)amount+", which is the wrong price, the price is: "+(string)price); } else { llInstantMessage(id, "You payed the right price"  ; } doesn't work..it takes no money and don't show the result sentence. Can you help me..what is wrong? best regards robo
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
03-21-2007 16:36
As I've said it WONT take money. You cannot take money that way. You are jsut setting the pay price so that they can select the pay option with the correct parameters already preset
|
|
Robo Eros
Registered User
Join date: 19 Feb 2007
Posts: 13
|
mhh
03-22-2007 04:35
hi, ok maybe it is difficult to understand in english for me  so ok if i set the set llSetPayPrice(price, [price ,PAY_HIDE, PAY_HIDE, PAY_HIDE]); there is no menu where the customer can choose a price. I thought i set the price and then i take it from the customer with: llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); in which way i think wrong?
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
03-22-2007 05:20
From: Robo Eros hi, ok maybe it is difficult to understand in english for me  so ok if i set the set llSetPayPrice(price, [price ,PAY_HIDE, PAY_HIDE, PAY_HIDE]); there is no menu where the customer can choose a price. I thought i set the price and then i take it from the customer with: llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); in which way i think wrong? Its ok, I guessed english was not your first langauge. PERMISSION_DEBIT only works on the OWNER, its to allow the owner to give money not to take it from other people. the llSetPayPrice is used to either override the prices available when they select pay, or to hide them (as your code will do).
|
|
Robo Eros
Registered User
Join date: 19 Feb 2007
Posts: 13
|
...
03-22-2007 06:16
oh yes  I hope my english isn't to bad...but I'm working on it  /// sell integer Listening; integer CHANNEL; list menu = [ "Typ 1", "Typ 2" , "Typ 3", "Nachricht senden" ]; // -------------------------- UpdateListen(key id) { CancelListen(); CHANNEL = 0 - (integer)llFrand(2147483647); Listening = llListen(CHANNEL,"",id,""  ; llSetTimerEvent(20); } // -------------------------- CancelListen() { if(Listening > 0) llListenRemove(Listening); Listening = 0; llSetTimerEvent(0); } default { state_entry() { llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); // Just assume they where granted. } touch_start(integer total_number) // Menu Übersicht mit touch offen { key id = llDetectedKey( 0 ) ; UpdateListen( id); llDialog(id, "What would you like to buy?", menu, CHANNEL ); } listen(integer chan, string name, key id, string mes) { CancelListen(); if ("Typ 1" == mes) state cash; } timer() { CancelListen(); } } state cash { state_entry() { llSetPayPrice(price, [price ,PAY_HIDE, PAY_HIDE, PAY_HIDE]); } money(key id, integer amount) { if(amount != price) { llGiveMoney(id, amount); llInstantMessage(id, "You payed "+(string)amount+", which is the wrong price, the price is: "+(string)price); } else { llInstantMessage(id, "You payed the right price"  ; } } } ok so i think i have to work only with SetPayprice? My big, big problem is that this function don't create a menu. Ok i use Pay_HIDE but DEFAULT doesn't change anything. So how can i get the money from the customer? Sorry i'm studying informatic but i'm feeling me ver, very stupid now  But i hope you have pations!? best regards robo
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
03-22-2007 15:33
From: Robo Eros ok so i think i have to work only with SetPayprice? My big, big problem is that this function don't create a menu. Ok i use Pay_HIDE but DEFAULT doesn't change anything. So how can i get the money from the customer? Sorry i'm studying informatic but i'm feeling me ver, very stupid now But i hope you have pations!? llSetPayPrice will not generate a menu. It merely configures the pay menu shown when the user right clicks and selects pay.
|
|
Robo Eros
Registered User
Join date: 19 Feb 2007
Posts: 13
|
mhh
03-24-2007 09:46
oh thanks...i didn't know that the setpayprice function is only for the pay option. Ok so it hink i now how i make my script. But i have another question... i choosed pay object in the object menu. Ok and i use this script. integer price = 10; 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(price, [price ,PAY_HIDE, PAY_HIDE, PAY_HIDE]); } money(key id, integer amount) { if(amount != price) { llGiveMoney(id, amount); llInstantMessage(id, "You payed "+(string)amount+", which is the wrong price, the price is: "+(string)price); } else { llInstantMessage(id, "You payed the right price"  ; } } } my problem is ..if i click right on the object i can't choose the pay option...i don't understand why..can you help me? It is totaly unclear for me... best regards robo
|
|
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
|
03-24-2007 11:11
Newg - I truly admire your patience. Robo - give newg a break and try to use [ php ] tags around your script examples.
_____________________
http://slurl.com/secondlife/Together
|
|
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
|
03-24-2007 11:29
Here is your script Robo...in PHP tags so that it's easy to read. If you're unable to use the 'pay' option, it appears that your script is not changing states to 'state cash'...which means that your run_time_permissions() event is not returning perm & PERMISSION_DEBIT... ...which would probably mean that you're not approving the request of the object to take money from you? Just a guess...otherwise, the script appears alright at first look. It's slightly different from how I run the same thing...but looks to work. integer price = 10;
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(price, [price ,PAY_HIDE, PAY_HIDE, PAY_HIDE]); } money(key id, integer amount) { if(amount != price) { llGiveMoney(id, amount); llInstantMessage(id, "You payed "+(string)amount+", which is the wrong price, the price is: "+(string)price); } else { llInstantMessage(id, "You payed the right price"); } } }
_____________________
--AeonVox--Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.
|
|
Robo Eros
Registered User
Join date: 19 Feb 2007
Posts: 13
|
mhh
03-24-2007 17:48
Hi, now my script works. Can anybody if he see mistakes!? integer price = 1; integer dialog_channel= 427; list menu = [ "Typ 1", "Typ 2" , "Typ 3", "Nachricht senden" ]; key test= ""; default { state_entry() { state cash; } } state cash { state_entry() { llSetPayPrice(PAY_HIDE, [price ,PAY_HIDE, PAY_HIDE, PAY_HIDE]); } money(key id, integer amount) { if(amount != price) { llGiveMoney(id, amount); llInstantMessage(id, "You payed "+(string)amount+", which is the wrong price, the price is: "+(string)price); } else { test = id; llInstantMessage(id, "You payed the right price. Choose a Tattoo now!"  ; state choose; llInstantMessage(id, "You payed the right price. Choose a Tattoo now!"  ; } } } state choose { state_entry() { llSay(0, "test!"  ; llListen( dialog_channel, "", NULL_KEY, ""  ; llDialog( test, "What would you like to buy?", menu, dialog_channel ); } listen(integer chan, string name, key id, string mes) { if (mes == "Typ 1" { llSay(0, "test1!"  ; } if (mes == "Typ 2" { llSay(0, "test2!"  ; } if (mes == "Typ 3" { llSay(0, "test3!"  ; } }} I have just one problem. After the customer have payed, the object should give him a folder with content. I can do it with the command LlGiveInventory. But i can use it only to give single objects. But i would like to give the customer a folder with content. 2. Another problem is i have 3 folder in the object: named typ 1, typ 2 and typ3. is it possible to choose the folder which the customer should get? best regards robo
|