Lost Adventurer, Aleks Kirilenko (3D)
LC #42 Pipers Alley

View Full Version : help:script for update button

04-14-2008, 10:16 PM
i am trying to make a simple tool which creates a box of given values and also updates a box after clicking update button.it creates a box of desire but update function is not working.
here is my code.please state whats wrong in my script.

try (destroydialog updatetest)catch()
rollout updatetest "update test"
--creating interface by adding spinners buttons etc.
spinner boxheight "height" range:[0,250,10]
spinner boxwidth "width" range:[0,250,10]
spinner boxlength "length" range:[0,250,10]
button create_btn "create"
button update_btn "update"

--creates a box of givin params.
function createbox =
ht =boxheight.value
wd =boxwidth.value
lt =boxlength.value

box height:ht width:wd length:lt

--updates a existed box in scene
function updatebox =
ht =boxheight.value
wd =boxwidth.value
lt =boxlength.value

try($box* height:ht width:wd length:lt)catch()
-- events
on create_btn pressed do createbox()
on update_btn pressed do updatebox()
createdialog updatetest 150 120

04-14-2008, 11:42 PM
try($box* height:ht width:wd length:lt)catch()file:///C:/DOCUME%7E1/RICHAR%7E1/LOCALS%7E1/Temp/moz-screenshot.jpgfile:///C:/DOCUME%7E1/RICHAR%7E1/LOCALS%7E1/Temp/moz-screenshot-1.jpgfile:///C:/DOCUME%7E1/RICHAR%7E1/LOCALS%7E1/Temp/moz-screenshot-2.jpg

to something like...

$box*.height = ht
$box*.width = wd
$box*.length = lt
); catch()

The 'parameter:value' only works on construction / for functions / etc. When you're manipulating something that already exists, you'll typically have to use '.parameter = value'

You'll probably want to limit that update button to only selected boxes in the future, but that's another exercise :)

Edit: Zapped some random mozilla temp screenshot thing that got pasted in here o_O

04-14-2008, 11:58 PM
thanks ZeBoxx2 it works for me

CGTalk Moderation
04-14-2008, 11:58 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.