Home Technical Talk

maxscript access spinner inside a function

Mrfred
polycounter lvl 4
Offline / Send Message
Mrfred polycounter lvl 4
Hey, I'm pretty sure it's pretty easy and I'm missing something easy
but i'm unable to access a spinner value inside a function
try (destroyDialog blablabla)Catch()

Rollout blablabla "Ablablabla"
(
spinner Spine_Spn "B:" range:[3,5,3] pos:[345,115] width:  50 type:#integer
fn a b = 
(
	print b
)
a Spine_Spn.value

)
CreateDialog blablabla width:  560

how can I access Spine_Spn.value inside my function. I'm using the print function to test and so far i'm only getting undefined errors. I guess it's all about declaring it at the right moment

Replies

  • monster
    Options
    Offline / Send Message
    monster polycounter
    You can't execute code in a rollout definition. It needs to be inside of an event. Like a button press, or on open.
    try (destroyDialog blablabla)Catch()
    
    Rollout blablabla "Ablablabla"
    (
    	spinner Spine_Spn "B:" range:[3,5,3] pos:[345,115] width:  50 type:#integer
    	button btnPrint "Print"
    	
    	fn a b = 
    	(
    		print b
    	)
    	
    	on blablabla open do
    	(
    		a Spine_Spn.value
    	)
    	
    	on btnPrint pressed do
    	(
    		a Spine_Spn.value
    	)
    
    )
    CreateDialog blablabla width:  560
    
  • Pathologist
    Options
    Offline / Send Message
    Pathologist polycounter lvl 4
    You can do this too:
    try (destroyDialog blablabla)Catch()
    fn a b = 
    (
    	print b
    )
    Rollout blablabla "Ablablabla"
    (
    	spinner Spine_Spn "B:" range:[3,5,3] pos:[345,115] width:  50 type:#integer
    )
    CreateDialog blablabla width:560
    
    a blablabla.Spine_Spn.value
    

    Though I recommend the method monster posted.

    Bassically what I do here is call the spiner in the rollout blablabla
Sign In or Register to comment.