WinstonEverlast Posted May 7, 2020 Share Posted May 7, 2020 I am new to scripting and trying to work things out but need some direction. I am scripting a LSD trip (basically a HUD that has moving textures, starts when you attach it and ends after a period of time). I've been able to figure out everything I need except for how to make it a "single use" object, so that the user can only wear it one time and it can't be used again. I've done some searches but haven't found anything, which tells me I'm likely looking up the wrong thing. Could someone point me in the right direction? Link to comment Share on other sites More sharing options...
Wulfie Reanimator Posted May 7, 2020 Share Posted May 7, 2020 Add a global variable to your script: integer used = FALSE; When the item is used, set it to TRUE. When the object is attached (or whenever the effect would start), first check what value that variable has. Link to comment Share on other sites More sharing options...
Rolig Loon Posted May 7, 2020 Share Posted May 7, 2020 Or, if you want to be sure that the script will never run again, let its last act be llRemoveInventory( llGetScriptName() ) 1 Link to comment Share on other sites More sharing options...
WinstonEverlast Posted May 7, 2020 Author Share Posted May 7, 2020 Thanks! I didn't know about llRemoveInventory. Looks like either of those ways would work, just depends on what my aim is. I'll play around with both and see what works best... Link to comment Share on other sites More sharing options...
Kyrah Abattoir Posted May 9, 2020 Share Posted May 9, 2020 My personal method, which completely prevents any possible re-use is to have "used" (as per @Wulfie Reanimator's example) start as true, and switch to false if during state_entry() the owner of the object is "you". This makes the script reset proof and you don't even need to set the object as no-mod as long as the script is no-copy no-mod. If they try to reset it, the item will simply become "used" Link to comment Share on other sites More sharing options...
Anna Salyx Posted May 10, 2020 Share Posted May 10, 2020 I've used state changes for that. Set the item to be given in a state called "unused" and does it things and then does a reset script at the end and the default state handles any "I can't be used anymore" messages and actions on the attach handlers and state entry. set the script to nocoy and voila. 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