[Closed] How do you deduct from a slider.value?
Hi all,
I’m having a little difficulty trying to deduct a value from a slider.value input.
Essentially I have a set of sliders set to create a box lets say 1200 wide by 1000 long
I want to be able to deduct a set value from the length of 47 for example. How do I do this?
spinner ‘BoxWidth’ “Width:” pos:[291,198] width:90 height:16 enabled:true range:[0,10000,1000] align:#left
spinner ‘BoxLength’ “Length:” pos:[287,218] width:90 height:16 enabled:true range:[0,10000,1200] align:#left
fn (
BottomCentreBox = box width:BoxWidth.value length:BoxLength.value-47 height:18 pos:[0,0,0]
)
Thanks
note the space in the script
length:BoxLength.value-47 == length:(BoxLength.value – 47) != length:BoxLength.value – 47
length:BoxLength.value-47
is a wrong syntax ,another thing to note , it means the attribute named “value-47 ” , if it is a variable , it is a right syntax .
your code is wrong, a function without name and equals.
there are quite a few syntax errors
try this and see if you can use it to fit your needs
try destroydialog SpinnerBox catch()
rollout SpinnerBox "Spinner subtraction" (
spinner Bw "Width:" width:90 height:16 enabled:true range:[0,10000,1000] align:#left
spinner Bl "Length:" width:90 height:16 enabled:true range:[0,10000,1200] align:#left
local thebox
fn BottomCentreBox= (
thebox = box width:Bw.value length:Bl.value height:18 pos:[0,0,0] selected:true
)
on bl entered do (
thebox.length = Bl.value-47
original = Bl.value as string
new = thebox.length as string
difference = abs(Bl.value-thebox.length) as string
format "original value: %\nnew value: %\ndifference: %\n" original new difference
)
on SpinnerBox open do (BottomCentreBox())
)
createDialog SpinnerBox -- 150 150