Notifications
Clear all

[Closed] How do i make a short line script?

how do i make a short line like repeated script like UI button part and action part?

For example

rollout testRollout “test”
(
button test1 “test1”
button test2 “test2”
button test3 “test3”
button test4 “test4”
button test5 “test5”
button test6 “test6”
button test7 “test7”
button test8 “test8”
button test9 “test9”
button test10 “tes10t”
button test11 “test11”
button test12 “test12”
button test13 “test13”
button test14 “test14”
button test15 “test15”
button test16 “test16”

	fn testFn num = print num
	
	on test1 pressed do testFn 1
	on test2 pressed do testFn 2
	on test3 pressed do testFn 3
	on test4 pressed do testFn 4
	on test5 pressed do testFn 5
	on test6 pressed do testFn 6
	on test7 pressed do testFn 7
	on test8 pressed do testFn 8
	on test9 pressed do testFn 9
	on test10 pressed do testFn 10
	on test11 pressed do testFn 11
	on test12 pressed do testFn 12
	on test13 pressed do testFn 13
	on test14 pressed do testFn 14
	on test15 pressed do testFn 15
	on test16 pressed do testFn 16
	
	
)createdialog testRollout

Other questions
Can I create a button using “For”?
Can multiple buttons perform a single function? (To reduce the number of lines)
For example like this : on test1~test16 do ( testFn num )

I have to make 400 button.
help me.
ㅜㅜ

2 Replies

use RolloutCreator or use smth like this:

src = StringStream()
append src "rollout roll \"test\"\n ("

for i = 1 to 10 do
(
	format "button btn_% \"btn_%\"\n" i i to:src	
	format "on btn_% pressed do SomeFunc %\n" i i to:src
)

append src ")"

execute (src as string)

If you are thinking about a user interface with 400 individual buttons, there is something wrong in your design… Because the solution is to find a single control with multi-button functionality. Possible solution is to use for example .NET and DataGridView. If you are working with modern versions of MAX, you should probably use some of the Qt controls.