ScriptSpot

Forum topic · Scripts Wanted

divide stored value by two

By jsrocha · 2011-08-03

Description

Hi guys, how´s going? i need a little help, i think that´s an easy one. I create a spinner in wich a type a value. I store this value to use as a inner and outer value for shell modifier. But i need to divide this value by two, and then use it in shell. the code i´m using is this one (part of it):

button btn1 "Button" pos:[124,18] width:76 height:34
spinner xx "" pos:[13,24] width:93 height:16

on btn1 pressed do
(

modPanel.addModToSelection (Shell ()) ui:on
$.modifiers[#Shell].innerAmount = xx.value
$.modifiers[#Shell].outerAmount = xx.value

xx is the value i need to divide by two.
another quick question: spinner is the best option to catch this values? what other option can i use?
thanks in advance,

Jsrocha

Comments (3)

jsrocha · 2011-08-03

ops

br0t · 2011-08-03

well then just do so :D You might also want to give your spinner a range, default value, scale and type:


spinner xx "" pos:[13,24] width:93 height:16 range:[-9999,1,9999] scale:0.1 type:#float

--...

$.modifiers[#Shell].innerAmount = xx.value / 2.0

I think a spinner is best for this, cause you get a number from it that you can use directly. You could also use an edittext field to input values, but would have to check if the user did type in a number or a character to prevent crashes.

jsrocha · 2011-08-03

Hey br0t, thanks a lot, it worked just fine! :)
cheers,

Jsrocha