Notifications
Clear all

[Closed] How to delay in 3dsmax script

I am biggner with max script.
and also my english is not good.
I wish find out solution from someone.
I want to find object to assigne to some of material that i know name.
so i make this script.
It work good.
but state message text (— Seaching —) is very fast gone allmost same time when i push the button and run this script.

so i want to little delay before (separateLabel02.text = “— Nothing —”) this line.
how do i do?
please help me.

on SearchMatBT pressed do
(
a = #()
local FindItemNameArr = SearchMatTex.text –The material names i want to find.

       separateLabel02.text = "--- Seaching ---"
       
       for n in geometry do
       (
                 if classof n.mat == Multimaterial then
                 (
                            for m in n.mat do
                            (
                                       if m != undefined do
                                       (
                                                 
                                                 for f in FindItemNameArr do
                                                 (
                                                            
                                                            if findstrFn m.name f do append a n
                                                            
                                                 )
                                       )
                            )
                 )else
                 (
                            if n.mat != undefined do
                            (
                                       
                                       for f in FinditemArr do
                                       (
                                                 if findstrFn n.mat.name f do append a n
                                       )
                            )
                 )
       )
       
       if a.count == 0 then
       (
                 separateLabel02.text = "--- Nothing ---"
       )else
       (
                 separateLabel02.text = "--- Selected ---"
                 select a
       )

)

3 Replies

just check how long it takes to complete and sleep the rest of the time

local t1 = timeStamp()

... do some work here

diff = timeStamp() - t1
		
if diff < 200 then -- completed faster than 200ms		
(				
	time_to_sleep = (200 - diff) / 1000.0 -- ms to sec
	sleep time_to_sleep
)

wow very thank you.
it’s perfectly that i want to do and it work.
thank you ^^

Eh! How great some people live! 3DS MAX is too fast for them…