[Closed] pausing a running script until function end
Hi, I am still a newbies in maxScript and I can’ t find any solution in help files concernig this:
I am writing a script including a function (let s call the function: fn mom() ) and I want the script to wait somewhere until this function end and give me a variable
The function will prompt a UI and I will extract a variable called varName from it
for example:
function mom =
(
blablablabla
varName = (txt)
)
–and the script is something like this:
——blalalalala
on btnStart do
(
function mom()
print varName
)
I don’t know if It s clear …
but if I do this he is printing varName before function mom() end so the result is wrong.
Is there a way to avoid this or maybe a different way to write this please guys ?
ok so sorry I found it
I just needed to add the <modal: true> option un the prompted UI
this one pause the script execution until ui is closed
hope it could help someone else !
cheers !
Try this it should work.
fn mom =
(
txt = “this is a test”
varName = txt
return VarName – returns this value when function evaluates
)
on BTNstart do
(
var = mom() – assign returned value to variable
print var
)