YY3010966
10-16-2007, 04:47 PM
hi all ,im a MaxScript beginner ,there is a short script puzzled me ,here
global foo=23,x=20
y=10
format "context level global :foo=%\n" foo
if x>y then
( local baz=foo+1
local foo=y-1
format "context level 1:foo=%\n" foo
b=box()
b.pos.x=foo
if (foo>0) then
(
local a
local foo=y-x
format "context level 2:foo=%\n" foo
a=sin foo
format "a=%\n" a
)
format "context level 1:foo=%\n" foo
)
format "context level global:foo=%\n" foo
result is :
20
10
context level global :foo=23
OK
context level 1:foo=9
context level 2:foo=-10
a=-0.173648
context level 1:foo=-10
OK
context level global:foo=-10
OK
OK
but i think the result should be
20
10
context level global :foo=23
OK
context level 1:foo=9
context level 2:foo=-10
a=-0.173648
context level 1:foo=9
OK
context level global:foo=23
OK
OK
i dont konw why......... :sad: waiting someone kind will light me ,thanks!!
global foo=23,x=20
y=10
format "context level global :foo=%\n" foo
if x>y then
( local baz=foo+1
local foo=y-1
format "context level 1:foo=%\n" foo
b=box()
b.pos.x=foo
if (foo>0) then
(
local a
local foo=y-x
format "context level 2:foo=%\n" foo
a=sin foo
format "a=%\n" a
)
format "context level 1:foo=%\n" foo
)
format "context level global:foo=%\n" foo
result is :
20
10
context level global :foo=23
OK
context level 1:foo=9
context level 2:foo=-10
a=-0.173648
context level 1:foo=-10
OK
context level global:foo=-10
OK
OK
but i think the result should be
20
10
context level global :foo=23
OK
context level 1:foo=9
context level 2:foo=-10
a=-0.173648
context level 1:foo=9
OK
context level global:foo=23
OK
OK
i dont konw why......... :sad: waiting someone kind will light me ,thanks!!
