Hello,
i have a simple question, i am a little bit lost with maxscript, so, if you can help it will be so nice ;)
i think its probably really simple, my question is: Do you know an alternative to "execute" to do this stuff :
fn LogoPreset1 = ( print "logo1" )
fn LogoPreset2 = ( print "logo2" )
fn LogoPreset3 = ( print "logo3" )
rollout testrollout "test" width:272 height:120 (
dropdownlist dd items:#("hello","hello world","hello you") height:6
button addb "add logo" pos:[50,35] width:125 height:32
fn w =
(
z = dd.selection as string
execute("LogoPreset"+z+"()")
)
on addb pressed do (
w()
)
)
createDialog testrollout
Because of "execute" i have to put fn before the rollout, but doing that complicate some other part of my main script.
so its why i'm looking for an alternative
thank you for your help.
Comments (14)
Comment policy
.
Glad to help. :)
.
Is this is what you want?
If this is not, give us an example of what have to be printed in the edittext boxes when you change the ddl selection.
Don't use so many global variables when you can use local variables.
omg!
yes!
I making so many mistake! thanks for advice
I think it's exactly what i needed!
Just the time to understand how it work and I'll include it in my script.. it will be probably ok
many thanks for your disponibility.
more code :
totally approximative but ...
Workaround
Use one function for the all ei.
-- if you use this form place this function after rollout controls definitions
fn printLogos num:dd.selection =
(
format "Logo%\n" num
)
printLogos()
--or you can use this form and put fn above roll definition
fn printLogos num: = format "Logo%\n" num
printLogos num:dd.selection
Thank you for the answer that was fast! ;)
it work, but in fact i want to make a more complicated fn than just format or print some thing.
Thank you very much for the lead, i am working on it..
i will be back soon ;)
I know that you have more comlicated question ;)
Post what you have to see the problem.
so...
Another one example of what i want to do.. really sorry for my first question i didn't know how to explain my goal, ihope this one is more accurate.
i think it' probably really easy to do... but i'am stucked
more code :
totally approximative but ...
First of all you not need to use globals in this case also you convert string to string and array to array. Look et this example
try (destroydialog ::testrollout) catch()
rollout testrollout "test"
(
local items = #(
#("Roger","here","hello world 01"), \
#("Henry","anywhere","hello world 02"), \
#("Jack","somewhere","hello world 03")
)
dropdownlist dd height:6 items:(for i in items collect i[1]) selection:2
editText nametxt "Place:" pos:[16,60] width:238 height:15
editText placetxt "Description:" pos:[16,80] width:238 height:15
on dd selected itm do (placetxt.text = items[itm][2] ; nametxt.text = items[itm][3])
on testrollout open do (placetxt.text = items[dd.selection][2] ; nametxt.text = items[dd.selection][3])
)
createDialog testrollout 272 120 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)
Hi Kostadin,
This does not apply to you :)
BTW Romeh your last example is a total mess :) No hard feelings. ;)
hehe, yeah that was a big mess :)
Thank you barigazy & miaou
Two different methods, seem to exist so many ways to do the same thing in maxscript...
I'll see it tomorrow, i think it will be probably ok
thanks
Yup. In MXS can do same things in few different ways. That's the power of this scripting languade. But only GOD knows which way is the best :)
Just keep it simple that's the basic rule.