Home Technical Talk
The BRAWL² Tournament Challenge has been announced!

It starts May 12, and ends Sept 12. Let's see what you got!

https://polycount.com/discussion/237047/the-brawl²-tournament

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
  1. try (destroyDialog blablabla)Catch()
  2.  
  3. Rollout blablabla "Ablablabla"
  4. (
  5. spinner Spine_Spn "B:" range:[3,5,3] pos:[345,115] width: 50 type:#integer
  6. fn a b =
  7. (
  8. print b
  9. )
  10. a Spine_Spn.value
  11.  
  12. )
  13. 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
    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.
    1. try (destroyDialog blablabla)Catch()
    2.  
    3. Rollout blablabla "Ablablabla"
    4. (
    5. spinner Spine_Spn "B:" range:[3,5,3] pos:[345,115] width: 50 type:#integer
    6. button btnPrint "Print"
    7. fn a b =
    8. (
    9. print b
    10. )
    11. on blablabla open do
    12. (
    13. a Spine_Spn.value
    14. )
    15. on btnPrint pressed do
    16. (
    17. a Spine_Spn.value
    18. )
    19.  
    20. )
    21. CreateDialog blablabla width: 560
  • Pathologist
    Offline / Send Message
    Pathologist polycounter lvl 4
    You can do this too:
    1. try (destroyDialog blablabla)Catch()
    2. fn a b =
    3. (
    4. print b
    5. )
    6. Rollout blablabla "Ablablabla"
    7. (
    8. spinner Spine_Spn "B:" range:[3,5,3] pos:[345,115] width: 50 type:#integer
    9. )
    10. CreateDialog blablabla width:560
    11.  
    12. 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.