[Closed] toggle a script on and off
i was wondering if there was a way to toggle a script with one key? i have a simple little script that makes the light amount 0… this is to make the character i am working on completely black so i can check the silloette and make sure it reads well from a distance… now i can turn the light level back up to 1 with a new script and assign it to a different key… but i was wondering if there was way to assign it to a key that toggles the light level from 0 back to 1 again?? and info on making something toggle would be great…
Samuel,
Maybe this does what you need:
if $.multiplier == 0 then $.multiplier = 1 else $.multiplier = 0
Light
yes!
global lightstatus
if lightstatus==undefined then
(
makeeverythingdark script
lightstaus=1
) else
(
makeeverythinglight script
lightstatus=undefined
)
Does this make sense? save this script as a macroscript and assign it to a button of your choice.
bye!
Josh.
okay i cant seem to get it to work… it makes everything black… but it dosent seem turn the lights back on when i hit the key again… here is what i used… maybe i did something wrong??
global lightstatus
if lightstatus==undefined then
(
lightLevel = 0
lightstaus=1
) else
(
lightLevel = 1
lightstatus=undefined
)
You’re missing a ‘t’ in the line: “lightstaus=1” so you aren’t ever changing the value of the global variable lightstatus.
thanks… i feel dumb not seeing that… but the script still dosent work… it toggels the lights off but dosent bring them back on…
macroScript LightTools
category:"Light Tools"
toolTip:"Turn all lights on/off"
icon:#("Lights",3)
(
lightsOn = true
on execute do
(
if lightsOn then lights.enabled = false
else lights.enabled = true
lightsOn = not lightsOn
)
)
Run that and bind to a key, that should do it (hopefully! :))
Rather than using the light multiplier, which you might be adjusting to values not equal to 1, just switch the lights on and off.
macroscript lightsToggle
category:"Wahooney Tools"
tooltip:"Toggle Lights On\Off"
(
global bLightStatus = true
on execute do
(
bLightStatus = not bLightStatus
lights.on = bLightStatus
)
)
Good grief!!! I didn’t even read your post! Read the first few then posted. That’s quite shocking!