Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Script for "button content"

Turgar Nilsson
Registered User
Join date: 5 Oct 2005
Posts: 134
01-23-2009 07:04
Hi everyone...
I was wondering if anyone knew a way to script buttons in a HUD so that once they had been "clicked", and their action performed, they would then grey out and be unusable again until the HUD was reset.
Any suggestions would be hugely appreciated.
Equally, is it possible to add a script to a HUD so as it can "recognise" another similar?
Apologies if these are "amateur" questions, but totally new to scripting.
Thanks in advance.
Scott Savira
Not Scott Saliva
Join date: 10 Aug 2008
Posts: 357
01-23-2009 07:13
Definitely possible and not too difficult. All you'd need to do is something like change the texture of the button face to your "grayed out" version. Then add a check in your code that handles the click to check if it's disabled and if so, bail out. You will need to define some kind of "button enabled" variable and set that flag whenever you want to enable/disable the button.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
01-23-2009 08:53
...or change states in the script that handles the touch so that it doesn't even have a touch handler. If multiple scripts in the prim handle touches, you might want a central coordinating on that pauses the others (probably after a short delay so they can all do their thing before they're put out of commission). If that doesn't work, you might have to put logic in each of them, unfortunately.
Turgar Nilsson
Registered User
Join date: 5 Oct 2005
Posts: 134
01-23-2009 08:54
Thanks Scott, Hewee.......looks like the next step is learning how to sort variables.....actually, plunging in to learning how to SCRIPT. Appreciated.
Scott Savira
Not Scott Saliva
Join date: 10 Aug 2008
Posts: 357
01-23-2009 09:50
In that case, to get you started here are some links that are probably relevant...

http://www.lslwiki.net/lslwiki/wakka.php?wakka=llSetTexture
http://www.lslwiki.net/lslwiki/wakka.php?wakka=touch_start
Klug Kuhn
Registered User
Join date: 7 Sep 2007
Posts: 126
01-23-2009 17:02
Instead of changing to a disable texture, you could also consider simply change the color or alpha on the button prim. Just to save you another L$10 and to load another texture. :)
Turgar Nilsson
Registered User
Join date: 5 Oct 2005
Posts: 134
01-24-2009 14:01
Thanks for the suggestion Klug...but for its purpose, I need it disabled, so the script IN the button is a one use only each time.