Difference between executing something from a UI button and raw execution?
I have a script, as an exsample, lets say its.
for i = 0 to 10 by 1 do print i
what is the difference between running it as it is, and running it from inside a rollout button like
rollout Count "count" width: 100 height:100
(
button countbutton "count it" pos....
on countbutton pressed do
(
for i = 0 to 10 by 1 do print i
)
)
My script is a lot longer than this but if I run it raw as in the first example, it works perfectly. But if I just cut and paste it into a button only parts of the script works. I did not realize that it would behave any different.
Any ideas?

Comments
Confirmed
Yea I can literally take the hole code with variables and all and paste it into a button and it will not work the same as if I leave it outside of a rollout.
This is my signature! WOOT! Gratz to me!
debug suggestion
Try to move UIAccessor's part of the code into separate function, or the whole code, if necessary. If that not help, may move the function outside of the rollout body. But... its better to debug the code itself by inserting
print/formaton many placesses inside the code, and catch the problem.my recent MAXScripts RSS (archive here)
No.
No.
Tools and Scripts for Autodesk 3dsMax
No Toolbox
Than the scene would not work on your machine. Till Max 2014 when box 2 and 3 will be part of max by default.
But the only thing I am changing between the 2 scripts is taking the function out of the rollout and it work. I do not get an error, it just does not skin the mesh to the particles as it does when I have the script outside of the rollout.
It must somehow treat the execution of the loop differently.
This is my signature! WOOT! Gratz to me!
Can you provide the test
Can you provide the test scene?
Tools and Scripts for Autodesk 3dsMax
can you provide the test
Do you have toolbox #2?
This is my signature! WOOT! Gratz to me!
Post the code, so we can find
Post the code, so we can find where is the problem when you use the script in a rollout. May be there is a problem with the variables, may be something else. If the script is written correctly there is no difference between executing it from the rollout or raw execution.
Tools and Scripts for Autodesk 3dsMax
The Code
Code in Rollout
Does not work, but If I take it out of the rollout
it works.
This is my signature! WOOT! Gratz to me!