|
Tomfox Wiranata
Registered User
Join date: 20 Dec 2006
Posts: 80
|
01-13-2007 05:17
Hi everybody.
if a resident pays me money i use llGiveMoney to pay a part of it to the land owner, who allowed me to put my terminal on his land.
it is really annoying that i have to permit the money transfer(llRequestPermissions) everytime someone pays.
first of all i am not always online, and certainly it is annoying..
is there a chance that i do not have to permit the transaction?
thx
|
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
01-13-2007 06:13
From: Tomfox Wiranata it is really annoying that i have to permit the money transfer(llRequestPermissions) everytime someone pays. You don't need to call llRequestPermissions for each transaction. Call it once in state_entry, and those permissions should remain in effect until the script is reset. Just include a check for the proper permissions before calling llGiveMoney, to avoid potential script errors e.g. if( llGetPermissions() & PERMISSION_DEBIT ) llGiveMoney( blah blah );
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
01-13-2007 06:20
From: Tomfox Wiranata Hi everybody.
if a resident pays me money i use llGiveMoney to pay a part of it to the land owner, who allowed me to put my terminal on his land.
it is really annoying that i have to permit the money transfer(llRequestPermissions) everytime someone pays.
first of all i am not always online, and certainly it is annoying..
is there a chance that i do not have to permit the transaction?
thx EDIT: Deanna's post covers this but for some weird reason didnt show up on my screen until after I posted! You only ever need to give permissions once, unless you are either resetting the script or changing permissions to do something else post requesting debit permissions. What is your terminal doing and when? When do you request the debit permissions?
|
|
Tomfox Wiranata
Registered User
Join date: 20 Dec 2006
Posts: 80
|
01-13-2007 09:44
i am about to open a lottery... so far everything works perfect...just this tiny thing is missing...
after a resident picked his numbers and sent it to my db the script will be put to reset. so i guess this is the problem here. the llScriptReset() function....damn
i need to, because all the variables need to be reset and the terminal need to be unblocked. i added a timer. during the picking process the terminal is blocked for other residents.when the resident leaves or finishes his play the script will be reset and the terminal is free again for the next one....
so what am i supposed to do now?
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
01-13-2007 09:47
From: Tomfox Wiranata i am about to open a lottery... so far everything works perfect...just this tiny thing is missing...
after a resident picked his numbers and sent it to my db the script will be put to reset. so i guess this is the problem here. the llScriptReset() function....damn
i need to, because all the variables need to be reset and the terminal need to be unblocked. i added a timer. during the picking process the terminal is blocked for other residents.when the resident leaves or finishes his play the script will be reset and the terminal is free again for the next one....
so what am i supposed to do now? Well you dont need to reset the script to do that. Just reinitialise all the variables. What you are doing isnt exactly so complex that you cannot work out what needs to be reset and where.
|
|
Tomfox Wiranata
Registered User
Join date: 20 Dec 2006
Posts: 80
|
01-13-2007 09:49
well that's true ^^. thx newgate  will post tomorrow if it worked wish you both a nice saturday
|
|
Tomfox Wiranata
Registered User
Join date: 20 Dec 2006
Posts: 80
|
01-13-2007 16:57
well now i replaced llResetScript with my own function, which btw JUST sets a few variables back to their root values....
but now i have the problem that llemail does not work anymore. usually, after a resident pressed "send" i send an email to a server, which raises the jackpot, and sends this amount to all terminals which show this above, via llSetText.....
how is that related to each other????? i do not get it......
it is definitly because of my new function....my untouched script still works fine....
thx
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
01-14-2007 00:02
From: Tomfox Wiranata well now i replaced llResetScript with my own function, which btw JUST sets a few variables back to their root values....
but now i have the problem that llemail does not work anymore. usually, after a resident pressed "send" i send an email to a server, which raises the jackpot, and sends this amount to all terminals which show this above, via llSetText.....
how is that related to each other????? i do not get it......
it is definitly because of my new function....my untouched script still works fine....
thx Tomfox, Your post is not complete enough for us to be able to help you debug your code. Check exactly what your new function is doing, is your email address being reset?
|
|
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
|
01-14-2007 02:09
If you sending an email and expecting the same script to receive the reply, perhaps the 20 sec script delay after sending your email is catching you out? I usually put my email calls in separate scripts and send them link messages with the stuff to email.
|
|
Tomfox Wiranata
Registered User
Join date: 20 Dec 2006
Posts: 80
|
01-14-2007 02:50
yeah...sorry.....the llEmail problem is solved...But here is a new one..... key requestOfServerStatusRequestid; key saveData; key agentId; key currentUser;
string myStatus="status0"; string serverStatus="no_status_received"; string serverId = "xxx"; string number1; string number2; string number3; string number4; string number5; string number6;string sendb; string cancelb; string location = "xxx"; string newItem; string name; string timestamp; string serverAdress = "xxx"; string element1;string element2;string element3;string element4;string element5;string element6; string keyID; string element = "";
integer position1 = 0; integer position2 = 0; integer i; integer nochvorhanden=0; integer max = 6; integer left = 0; integer handle; integer anzTipps = 0; integer Channel; integer treffer; integer amount = 1;
list letters = [" ","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","1","2","3","4","5","6","7","8","9"]; list PC__01_09 = ["<<< 37-45","Delete all","10-18 >>>","7","8","9","4","5","6","1","2","3"]; list PC__10_18 = ["<<< 01-09","Delete all","19-27 >>>","16","17","18","13","14","15","10","11","12"]; list PC__19_27 = ["<<< 10-18","Delete all","28-36 >>>","25","26","27","22","23","24","19","20","21"]; list PC__28_36 = ["<<< 19-27","Delete all","37-45 >>>","34","35","36","31","32","33","28","29","30"]; list PC__37_45 = ["<<< 28-36","Delete all","01-09 >>>","43","44","45","40","41","42","37","38","39"]; list GETIPPTE_ZAHLEN = ["Send","Delete all","New Choice"]; list DATA_FOR_DB;
//================================================================================================================================================================== reset() { number1 = ""; number2 = ""; number3 = ""; number4 = ""; number5 = ""; number6 = ""; newItem = ""; anzTipps = 0; treffer = 0; GETIPPTE_ZAHLEN = ["Send","Delete all","New Choice"];
element1 = ""; element2 = ""; element3 = ""; element4 = ""; element5 = ""; element6 = ""; currentUser = NULL_KEY; element = ""; DATA_FOR_DB = []; }
integer ChannelFromName(string person) { integer x; integer length; integer channel; string owner = llToLower(person); for(x=0, length=llStringLength(owner); x<length; ++x) { channel+=llListFindList(letters,[llGetSubString(owner,x,x)]); } return channel; }
touched(key toucher) { if (currentUser == toucher || currentUser == NULL_KEY) { llSetTimerEvent(0); llInstantMessage(toucher,"You are the current user of this terminal"); currentUser = toucher; llSetTimerEvent(240); name = llDetectedName(0); integer ch = ChannelFromName(name); llListen(ch,"",currentUser,""); llDialog(toucher, "Pick a Number. Use the navigation buttons for different numbers! ", PC__01_09, ch); } else { llInstantMessage(toucher,"This system is already in use. Please use another terminal."); } }
send(integer ch, string name, key id, string message) {
name = llList2String(DATA_FOR_DB,0); keyID = currentUser; element1 = llList2String(DATA_FOR_DB,1); element2 = llList2String(DATA_FOR_DB,2); element3 = llList2String(DATA_FOR_DB,3); element4 = llList2String(DATA_FOR_DB,4); element5 = llList2String(DATA_FOR_DB,5); element6 = llList2String(DATA_FOR_DB,6);
if(anzTipps == 6){ string urlStore = "http://xxxxxx "&sl_n1="+element1+"&sl_n2="+element2+"&sl_n3="+element3+"&sl_n4="+element4+"&sl_n5="+element5+"&sl_n6="+element6+"&sltime="+timestamp; saveData = llHTTPRequest(urlStore,[HTTP_METHOD,"GET"],""); llInstantMessage(currentUser,"Your numbers are saved! Please take your receipt");
} else { llInstantMessage(currentUser,"Sending failed. Not enough numbers Picked."); llDialog(id, "OVERVIEW\n--------\nPress a number to delete it and 'New Choice' to pick one new.\n'Send': Saves your numbers.\n'Delete all': Deletes all numbers. Start all over.", GETIPPTE_ZAHLEN, ch); } llRezObject("My First Lottery Receipt", llGetPos() + <0, 0, 0.5>, ZERO_VECTOR, ZERO_ROTATION, 42); llSay(xxxx, element1+" "+element2+" "+element3+" "+element4+" "+element5+" "+element6+" "+name); llEmail(serverAdress+"@lsl.secondlife.com", "xxx",""); //llResetScript(); reset(); }
deleteAllNumbers(integer ch, string name, key id, string message) { xxxxx }
listening(integer ch, string name, key id, string message) { xxxx xxxx
if(message == "Send") { send(ch,name,id,message); reset(); state default; } if(message == "Delete all") { deleteAllNumbers(ch,name,id,message); } if(message == "New Choice") { if(anzTipps == 0 || anzTipps == 1 || anzTipps == 2 || anzTipps == 3 || anzTipps == 4 || anzTipps == 5) llDialog(id, "Navigate through the dialogs to pick numbers", PC__01_09, ch); if(anzTipps > 5){ llInstantMessage(currentUser,"Sorry. You have to delete one of your numbers first"); llDialog(id,"OVERVIEW\n--------\nPress a number to delete it and 'New Choice' to pick one new.\n'Send': Saves your numbers.\n'Delete all': Deletes all numbers. Start all over. ", GETIPPTE_ZAHLEN, ch); } } }
//================================================================================================================================================================== default {
state_entry() { llRequestPermissions(llGetOwner(),PERMISSION_DEBIT); llSetText("",<1,0,0>,1); llSetPayPrice(PAY_HIDE,[15,PAY_HIDE,PAY_HIDE,PAY_HIDE]); } money(key giver, integer amount) { currentUser = giver; llGiveMoney("xxxxx",1); state payed;
}
state_exit() { llMessageLinked(LINK_ALL_CHILDREN, 0, "PAYED", NULL_KEY); llInstantMessage(currentUser,"Please TOUCH the keyboard to pick your numbers."); llSetTimerEvent(30); }
}//default
state payed {
state_entry() { //currentUser = NULL_KEY; }
touch_start(integer total_number) { timestamp = llGetTimestamp(); touched(llDetectedKey(0)); }
listen(integer channel, string name, key id, string message) { integer ch = ChannelFromName(name); listening(ch,name,id,message); } http_response(key request_id, integer status, list metadata, string body) { xxxx
}
timer() { integer ch = ChannelFromName(name); llInstantMessage(currentUser,"Time is up. You were logged off");
currentUser = NULL_KEY; //reset(); //llResetScript(); } state_exit() { } }
here is the thing...as you said, if i use llResetScript i need to confirm that my terminal transfers money via llGiveMoney, eerytime. So i wrote my own function "reset()", which sets back all the variables. BUT: it is still not working....i need to confirm it after each play.....why? thx
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
01-14-2007 03:01
TomFox, In the segments code you have deleted, do you request any other permissions?
|
|
Tomfox Wiranata
Registered User
Join date: 20 Dec 2006
Posts: 80
|
01-14-2007 05:56
hello newgate,
i guess with other permissions you mean predefined constants from lsl, right? no i do not... just deleting all pciked numbers and stuff the script has to do when a button is clicked...
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
01-14-2007 06:49
From: Tomfox Wiranata hello newgate,
i guess with other permissions you mean predefined constants from lsl, right? no i do not... just deleting all pciked numbers and stuff the script has to do when a button is clicked... No I mean do you make any calls to llRequestPermissions  Looking at the posted code, you dont appear switch back to state default?
|
|
Tomfox Wiranata
Registered User
Join date: 20 Dec 2006
Posts: 80
|
01-14-2007 07:47
ohh....no i don't.....
i switch to default in the listening() function...after a resident presses "send"...i thought this is the problem, right? cause i put the requestpermission in the state_entry in default..
so the terminal asks everytime....
if i do not switch to default...i can not start over again
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
01-14-2007 11:11
From: Tomfox Wiranata ohh....no i don't.....
i switch to default in the listening() function...after a resident presses "send"...i thought this is the problem, right? cause i put the requestpermission in the state_entry in default..
so the terminal asks everytime....
if i do not switch to default...i can not start over again that would be the reason you would be being asked every time but I dont think you can switch state from within a function, only from within an event handler directly.
|
|
Shippou Oud
The Fox Within
Join date: 11 Jul 2005
Posts: 141
|
01-14-2007 12:00
From: Tomfox Wiranata i am about to open a lottery... so far everything works perfect...just this tiny thing is missing...
after a resident picked his numbers and sent it to my db the script will be put to reset. so i guess this is the problem here. the llScriptReset() function....damn
i need to, because all the variables need to be reset and the terminal need to be unblocked. i added a timer. during the picking process the terminal is blocked for other residents.when the resident leaves or finishes his play the script will be reset and the terminal is free again for the next one....
so what am i supposed to do now? use states instead of resetting?
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
01-14-2007 12:51
I agree with Shippou, add an extra state, request perms in default, then switch state to the init/idle state and use it to reseteverything on state_entry.
|
|
Tomfox Wiranata
Registered User
Join date: 20 Dec 2006
Posts: 80
|
01-14-2007 13:37
so i use the default state just for perms and switch between both OTHER states? well i thought everything has to start within default...
maybe u can help me out with a little code....thx
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
01-14-2007 13:47
From: Tomfox Wiranata so i use the default state just for perms and switch between both OTHER states? well i thought everything has to start within default...
maybe u can help me out with a little code....thx You already know how to do it Tomfox. Yes every script must have a default state but yours will have, all you are doing is pushing everything bar permissions down into a second state Pseudo Code default { state_entry() { SetPermissions(); state Idle; } }
state Idle { state_entry() { ResetParameters(); } // All other handlers that where part of default }
state Payed { // A|s was - but now switch back to state Idle NOT default. }
|
|
Tomfox Wiranata
Registered User
Join date: 20 Dec 2006
Posts: 80
|
01-15-2007 00:10
thank you all so much....especially newgate....it worked.....
|