Hi guys,
I'm new to this forum (and scripting in general) but decided to take the plunge and learn. I'm trying to write a script that randomly scales objects between two values, using the very basic Maxscript-knowledge I have right now.
I run into two problems:
- When the rollout opens, I'd like the default values to be set to 0.9 for 'min' and 1.1 for 'max', but can't get it to work.
- When I use the current rollout, and don't change the values, the scaling goes hopelessly wrong. Even though the spinners say 0.9 by default, it seems to be using '0.0' as a default
- Is there a way to use three digits after the komma?
Thanks a lot, I'll post the code below.
--------
MacroScript Randomize_Hanging_Product category:"Swillie's Scripts" buttonText:"Randomize Hanging Product" tooltip:"Randomize Hanging Product"
(
rollout RandomizeRollout "Randomize Hanging Product" width:226 height:150
(
spinner spn1 "Min" pos:[15,59] width:58 height:16 range:[0.9,1.1,0]
spinner spn2 "Max" pos:[15,78] width:58 height:16 range:[0.9,1.1,0]
spinner spn7 "Min" pos:[90,59] width:58 height:16 range:[0.9,1.1,0]
spinner spn8 "Max" pos:[90,78] width:58 height:16 range:[0.9,1.1,0]
spinner spn9 "Min" pos:[165,59] width:58 height:16 range:[0.9,1.1,0]
spinner spn10 "Max" pos:[165,78] width:58 height:16 range:[0.9,1.1,0]
label lbl6 "X" pos:[43,35] width:16 height:18
label lbl7 "Y" pos:[118,35] width:16 height:18
label lbl8 "Z" pos:[193,35] width:16 height:18
button btn8 "Randomize!" pos:[43,108] width:140 height:18
button btn9 "Clear" pos:[43,130] width:140 height:18
on btn8 pressed do
(
for obj in $ do
(
if (selection.count > 0) then
(
randXscale = random spn1.value spn2.value
randYscale = random spn7.value spn8.value
randZscale = random spn9.value spn10.value
scale obj [randXscale,randYscale,randZscale]
)
else
(
messagebox "Je hebt niks geselecteerd, joker!"
)
)
)
on btn9 pressed do
(
spn1.value = 0.0
spn2.value = 0.0
spn7.value = 0.0
spn8.value = 0.0
spn9.value = 0.0
spn10.value = 0.0
)
)
createDialog RandomizeRollout 226 150
)
Anubis · 2010-08-16
Graph · 2010-08-13