|
Keelia DeCuir
Registered User
Join date: 18 Feb 2007
Posts: 19
|
02-26-2008 12:22
Hi, using the EataVendor multi-panel vendor scripts, when using the next button to cycle through products, when you reach the last page, you need to use the back button. I would prefer if it were able to "loop" back to the first page again rather than just stopping. Is this something that is simple to do? Here is a snippet of the code which deals with the two buttons, I'm not sure if this is enough of the code, or do you need to see all of it? link_message(integer sender, integer num, string message, key id) { if (num == 002) // Someone clicked a panel // Little bit of math to work out the item number using our offset { if (offsetWindow == 0) SetCurrentItem(sender - 2); else SetCurrentItem(offsetWindow * panelNumber + (sender - 2)); } else if (message == "next") // Next button - Move item window forwards if we can { if (offsetWindow == 0 && panelNumber >= llGetListLength(items)) return; else if ((offsetWindow + 1) * panelNumber >= llGetListLength(items)) return; else { offsetWindow++; Cascade(); llMessageLinked(LINK_ALL_OTHERS, 5000, "", NULL_KEY); llSleep(0.5); } } else if (message == "prev") // Back button - Move item window backwards if we can { if (offsetWindow != 0) { offsetWindow--; Cascade(); llMessageLinked(LINK_ALL_OTHERS, 5000, "", NULL_KEY); } } else if (num == 1000) { llResetScript(); } else if (num == 1100) { state disabled; } }
Also, I would be interested to know peoples opinions of this vendor if they know about it or have used it, is it low lag? If not, any other suggestions? I'm not looking for networked and prefer to build my own vendor and just use the scripts. Cheers guys.
|
|
Keelia DeCuir
Registered User
Join date: 18 Feb 2007
Posts: 19
|
03-01-2008 11:26
Anyone able to help?
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
03-01-2008 12:34
For starters, try changing the behavior of these conditionals: else if (message == "next") { ... else if ((offsetWindow + 1) * panelNumber >= llGetListLength(items)) { offsetWindow = 0; ... } ... }
else if (message == "prev") { if (offsetWindow != 0) { ... } else { // Round up, subtract one. Remember to think about the case where items is empty though offsetWindow = (llGetListLength(items)-1)/panelNumber; ... } }
|
|
Keelia DeCuir
Registered User
Join date: 18 Feb 2007
Posts: 19
|
03-01-2008 13:55
Thanks Hewee, that works well!
|