These forums are CLOSED. Please visit the new forums HERE
Is it possible to trigger llDialog with a money event? |
|
|
Spider Voss
Registered User
Join date: 17 Oct 2006
Posts: 4
|
08-07-2007 10:15
I'm working on a script where, ideally, someone will pay into an object and a menu will appear, whereupon their key will be placed into a list based on their menu selection. I've tried several different ways and nothing seems to work. Would some kind scripting guru out there point me in the right direction? Thanks in advance.
|
|
BamBam Sachertorte
floral engineer
Join date: 12 Jul 2005
Posts: 228
|
08-07-2007 10:20
This should be trivial, since the money event handler gets the payer's key. It should simply be a matter of turning on a listener and using llDialog. Can you post some code so that we can see what the issue might be?
|
|
Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
|
08-07-2007 10:43
Here's a quick musing on what you asked, but keep in mind when you are dealing with money SECURITY SECURITY SECURITY. If somebody pays you money, then doesn't click a menu option.. is it ok that their key never goes anywhere? Is it ok that the listen stays open for their key indefinitely? Do these lists affect item transfers or money back to the payee? Could they garble you up by paying $1 just after somebody else payed 10k and somehow fool your script into useing their new key to pay out? Stuff like that is critical any time money is involved and the below script really considers none of it.
list MENU = ["one","two","three"]; integer menu_channel; integer listenHandle; key payee; list keylist1; list keylist2; list keylist3; integer generateRandomChannel() { //do this, or you will be hacked for sure } default { state_entry() { // get permission from the owner to pay out money using the llGiveMoney function. llRequestPermissions(llGetOwner(),PERMISSION_DEBIT); } money(key id, integer amount) { menu_channel = generateRandomChannel(); listenHandle = llListen(menu_channel , "", id, "" ![]() llDialog(id, "Make a selection", MENU, menu_channel); } listen( integer channel, string name, key id, string message ) { if("one"==message) { keylist1+=id; } else if("two"==message) { keylist2+=id; } else if("three"==message) { keylist3+=id; } llListenRemove(listenHandle); } } |
|
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
|
08-07-2007 21:08
Aww... Not "if("one"==message)", but "if(message=="one"
", is it?_____________________
Seagel Neville ![]() |
|
Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
|
08-08-2007 08:28
they both work, apparently the way I put it is faster.
|
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
08-08-2007 09:15
I don't think either of "if (constant == variable)" and "if (variable == constant)" have much (any?) performance difference.
OTOH, if you use = instead of == by mistake, one will generate a compile-time error and the other won't.. _____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224 - If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left |
|
Spider Voss
Registered User
Join date: 17 Oct 2006
Posts: 4
|
08-08-2007 14:10
Thanks for the responses and help. This Scripting Tips forum is once again, as always, an amazing resource.
|