Orito Wonder Posted August 31, 2013 Share Posted August 31, 2013 Hello, Below I am showing a segment of code that I am having an issue with. The issue is when I right click it to pay, it doesn't show anything. The code may seem a bit redundant, but that's only because it's a piece I'm messing with.string payTemp; default { state_entry() { llSetPayPrice(PAY_HIDE,[]); payTemp = "25|50|75|100"; } touch(integer num_detected) { llSetPayPrice(PAY_DEFAULT,llParseString2List(payTemp,["|"],[])); } } Any help is appreciated. Thanks. Link to comment Share on other sites More sharing options...
Orito Wonder Posted August 31, 2013 Author Share Posted August 31, 2013 Hello, Below I am showing a segment of code that I am having an issue with. The issue is when I right click it to pay, it doesn't show anything. The code may seem a bit redundant, but that's only because it's a piece I'm messing with.string payTemp; default { state_entry() { llSetPayPrice(PAY_HIDE,[]); payTemp = "25|50|75|100"; } touch(integer num_detected) { llSetPayPrice(PAY_DEFAULT,llParseString2List(payTemp,["|"],[])); } } Any help is appreciated. Thanks. Link to comment Share on other sites More sharing options...
Cerise Sorbet Posted August 31, 2013 Share Posted August 31, 2013 Hi, you need to have a money event before llSetPayPrice can be active. It doesn't have to do anything special if you are making something like a simple tip jar, but it has to be there. (That is also how we can switch payment off, by changing to another state that doesn't have one.) 1 Link to comment Share on other sites More sharing options...
Orito Wonder Posted August 31, 2013 Author Share Posted August 31, 2013 Thank you for the reply. The code now looks like this... string payTemp;default{ state_entry() { llResetScript(); llSetClickAction(CLICK_ACTION_TOUCH); llSetPayPrice(PAY_HIDE,[]); payTemp = "25|50|75|100"; } touch(integer num_detected) { llSetPayPrice(PAY_DEFAULT,llParseString2List(payTemp,["|"],[","])); } money(key giver, integer amount) { }} However, the problem persists. Thanks again. Link to comment Share on other sites More sharing options...
Cerise Sorbet Posted August 31, 2013 Share Posted August 31, 2013 This second script works for me, in a simple cube. It lets me pay and the money comes right back to me. How is the object built? I will toss out this common problem area noted on the wiki -- Note that the pay option will only be shown in prims having a running script with a money event (or in all the prims of the object if the root has a running script with a money event).So, you may have to play a little if the script is in a child prim. 1 Link to comment Share on other sites More sharing options...
Orito Wonder Posted August 31, 2013 Author Share Posted August 31, 2013 Thanks for replying again. The second script has the pay option working - but it's displaying wrong values. It's showing 1,5,10, and 20 - instead of 25,50,75,100. It is just a single box prim at this point. Link to comment Share on other sites More sharing options...
revochen Mayne Posted August 31, 2013 Share Posted August 31, 2013 You need to touch it at least once to get your custom pay options, did you? And just noticed you need to remove the "," at: llSetPayPrice(PAY_DEFAULT,llParseString2List(payTemp,["|"],[","])); Because the list elements are comma separated by system and the SetPayPrice function in your state_entry event is empty which will result in showing the default options. Example using llParseString2List: string yourOptions = "1|2|3|4"; list parsedOptions = llParseString2List(yourOptions,["|"], [ ] ); // go on using your parsedOptions list Link to comment Share on other sites More sharing options...
Cerise Sorbet Posted August 31, 2013 Share Posted August 31, 2013 Oh right, because llParseString2List only knows strings. You have to convert types yourself. Here is one sleepy way to do it. string payTemp;default{ state_entry() { llSetClickAction(CLICK_ACTION_TOUCH); llSetPayPrice(PAY_HIDE,[]); payTemp = "25|50|75|100"; } touch(integer num_detected) { list priceStrings = llParseString2List(payTemp,["|"],[","]); list prices; integer i; for (i = llGetListLength(priceStrings) -1; i > -1; i--) { prices = (integer)llList2String(priceStrings, i) + prices; } llSetPayPrice(PAY_DEFAULT,prices); } money(key giver, integer amount) { }} 1 Link to comment Share on other sites More sharing options...
revochen Mayne Posted August 31, 2013 Share Posted August 31, 2013 Orito Wonder wrote: Thank you for the reply. The code now looks like this... string payTemp;default{ state_entry() { llResetScript(); llSetClickAction(CLICK_ACTION_TOUCH); llSetPayPrice(PAY_HIDE,[]); payTemp = "25|50|75|100"; } touch(integer num_detected) { llSetPayPrice(PAY_DEFAULT,llParseString2List(payTemp,["|"],[","])); } money(key giver, integer amount) { }} However, the problem persists. Thanks again. You seriously want to reset the script in a state_entry event? What's the reason for to do so? Link to comment Share on other sites More sharing options...
Orito Wonder Posted August 31, 2013 Author Share Posted August 31, 2013 Hello, and thanks for responding. I did indeed touch the object before trying to pay. I also changed the part of code you referenced, and it's still not Link to comment Share on other sites More sharing options...
revochen Mayne Posted August 31, 2013 Share Posted August 31, 2013 Cerise script will work. You need to type cast the string elements into integer types. Link to comment Share on other sites More sharing options...
Orito Wonder Posted August 31, 2013 Author Share Posted August 31, 2013 This was successful. Thank you very much. Also, for revochen - it was there because it was easier to type instead of adding debug say lines. Link to comment Share on other sites More sharing options...
revochen Mayne Posted August 31, 2013 Share Posted August 31, 2013 I'm sorry for asking again but... what? Oô It just doesnt makes sense to let the script reset in a state_entry event as its the start (entry) point for each script. Usually non of the following functions after a ResetScript gets executed. The following code (usually has to) result in infinite looping the state_entry event without the Whipser("after reset") executing: default{ state_entry() { llWhisper(0,"befor reset"); llResetScript(); llWhisper(0,"after reset"); }} Edit: I did a test and got a loop with the "befor reset" chat message like 100 times. Then the script stucked, running box is still checked but im not able to get it recompiled by reset or simply saving it. Also a shift copy will result in a broken script somehow. Disclaimer: If you experience any inconvenience on your sim - It wasn't me (i hope)! Link to comment Share on other sites More sharing options...
Xiija Posted August 31, 2013 Share Posted August 31, 2013 list payTemp;default{ state_entry() { llSetPayPrice(PAY_HIDE,[]); payTemp = [25,50,75,100]; } touch(integer num_detected) { llSetPayPrice(PAY_DEFAULT,payTemp); } money(key id, integer amt) { } } Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now