Phaeton
05-13-2008, 03:11 PM
Hello, respective community.. Recently i started to learn maxscript and encountered following problem: i made script which switches (on/off) state of the lights depending on "ambient only" checkbox i.e. we have few lights in the scene, some are ambient and some aren`t. I need to switch ones off while others are on. My script is working just well but i wanted to implement it with displaying which lights are currently on, "ambient" or "normal". The problem itself is in not displaying text with such code :
gw.setTransform (Matrix3 1)
gw.Text [10,10,0] "some text" color:green
strRect = (Box2 50 50 50 50)
gw.enlargeUpdateRect strRect
gw.updateScreen()
Also I very appreciate if you place some critics and advices for the whole code
macroScript SwitchLights
category:"myScripts"
toolTip:""
(
local LightningState = ""
for l in lights do
(
if l.baseobject.ambientOnly == true then
(
if l.baseobject.Enabled == true then
(
for n in lights do
(
if n.baseobject.ambientOnly == false and n.baseobject.Enabled == false then
n.baseobject.Enabled = true; l.baseObject.Enabled = false
)
)
else if l.baseobject.Enabled == false do
(
for n in lights do
(
if n.baseobject.ambientOnly == false and n.baseobject.Enabled == true then
n.baseobject.Enabled = false; l.baseObject.Enabled = true
if l.baseobject.Enabled == true then LightningState = "ambient lightning"
if n.baseObject.Enabled == true then LightningState = "normal lightning"
)
)
)
)
gw.setTransform (Matrix3 1)
gw.Text [10,10,0] LightningState color:green
strRect = (Box2 50 50 50 50)
gw.enlargeUpdateRect strRect
gw.updateScreen()
)
P.S. Sorry for my English - it`s not my native language.
P.P.S. Oh, yes, I`ve read other threads relative to my problem, but didn`t understood, why my text isn`t working...
gw.setTransform (Matrix3 1)
gw.Text [10,10,0] "some text" color:green
strRect = (Box2 50 50 50 50)
gw.enlargeUpdateRect strRect
gw.updateScreen()
Also I very appreciate if you place some critics and advices for the whole code
macroScript SwitchLights
category:"myScripts"
toolTip:""
(
local LightningState = ""
for l in lights do
(
if l.baseobject.ambientOnly == true then
(
if l.baseobject.Enabled == true then
(
for n in lights do
(
if n.baseobject.ambientOnly == false and n.baseobject.Enabled == false then
n.baseobject.Enabled = true; l.baseObject.Enabled = false
)
)
else if l.baseobject.Enabled == false do
(
for n in lights do
(
if n.baseobject.ambientOnly == false and n.baseobject.Enabled == true then
n.baseobject.Enabled = false; l.baseObject.Enabled = true
if l.baseobject.Enabled == true then LightningState = "ambient lightning"
if n.baseObject.Enabled == true then LightningState = "normal lightning"
)
)
)
)
gw.setTransform (Matrix3 1)
gw.Text [10,10,0] LightningState color:green
strRect = (Box2 50 50 50 50)
gw.enlargeUpdateRect strRect
gw.updateScreen()
)
P.S. Sorry for my English - it`s not my native language.
P.P.S. Oh, yes, I`ve read other threads relative to my problem, but didn`t understood, why my text isn`t working...
