ChaosRaine Posted October 3, 2018 Share Posted October 3, 2018 (edited) I am trying to make an object usable by anybody, but only one person at a time. I've seen sales boards that will go to a busy more while one person makes a purchase. How do I set up this busy mode? Edited October 3, 2018 by ChaosRaine Link to comment Share on other sites More sharing options...
Wulfie Reanimator Posted October 3, 2018 Share Posted October 3, 2018 (edited) If you know how to make something owner-only, it's essentially the exact same thing.. just without llGetOwner. key current_user = NULL_KEY; float timeout_seconds = 180.0; default { touch_start(integer n) { if(current_user) { // This object is currently being used by someone. } else { // No one is using this object yet, set the user. current_user = llDetectedKey(0); llSetTimerEvent(timeout_seconds); } } timer() { current_user = NULL_KEY; llSetTimerEvent(0); } } You didn't specify if the object should be "released" after a set amount of time, but that's one example. You can also use the llSetTimerEvent call again to refresh the timer whenever the user takes some kind of an action. Edit; I'm looks like everybody had a great timing! Edited October 3, 2018 by Wulfie Reanimator 1 Link to comment Share on other sites More sharing options...
Lexia Moonstone Posted October 3, 2018 Share Posted October 3, 2018 (edited) key user; default { state_entry() { user = NULL_KEY; } touch_start(integer total_number) { key toucher = llDetectedKey(0); if (user == NULL_KEY) { user = toucher; llSay(0, "object was not in use toucher is now the current user"); } else if (user) llSay(0, "touched again by curent user"); else llSay(0, "object inuse wait your turn"); } } this is how i do it, has an option for it the current user retouches, adding a timer would be good to reset Edited October 3, 2018 by Lexia Moonstone 1 Link to comment Share on other sites More sharing options...
Rolig Loon Posted October 3, 2018 Share Posted October 3, 2018 Disable the touch_start event. You can do that in a number of ways. Perhaps the easiest is to set a toggle switch to be OFF as soon as someone touches the object and then becomes ON again when the transaction is complete or a specific time period has passed. touch_start (integer num) { if ( !iTouched ) { iTouched = TRUE; // Just be sure that you make iTouched a g;lobal integer variable llSetTimerEvent(15.0); // Do your sales stuff or whatever } } timer() { llSetTimerEvent(0.0); iTouched = FALSE; } Turn iTouched TRUE again in whatever event (a money event? a listen event?) handles your sales transaction too. 1 Link to comment Share on other sites More sharing options...
ChaosRaine Posted October 4, 2018 Author Share Posted October 4, 2018 Thank you everybody so much. This helped out a lot. 1 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