Bazim Posted January 12, 2008 Posted January 12, 2008 Hello i have this script -- define function to be called function delayedChat ( text ) outputChatBox ( "Delayed text: " .. text ) end -- set a timer so the function is called after 1 second setTimer ( delayedChat, 1000, 1, "Hello, World!" ) And any sec. is to do send text Delayed text: Hello, World! but there's nothing doing.
Guest Posted January 12, 2008 Posted January 12, 2008 How did you test to see if it was working? Include print()'s in the script to debug from the console.
Guest Posted January 12, 2008 Posted January 12, 2008 I did this instead, so I could test from the console, and it worked fine for me. function delayedChat ( text ) print( text ) end setTimer( delayedChat, 1000, 1, "Hello, World!" ) I have no idea why it wouldn't for you. Whatever the problem is, it's not in the code you posted.
Bazim Posted January 12, 2008 Author Posted January 12, 2008 thx, I see. That message is sending every second just once. 1) How can i set up. sending message to infinite? 2) Can be message colored?
norby89 Posted January 12, 2008 Posted January 12, 2008 thx, I see. That message is sending every second just once.1) How can i set up. sending message to infinite? 2) Can be message colored? for infinite calls use 0 in setTimer, and yes you can use colors function delayedChat ( text, showTo, r, g, b ) outputChatBox ( "Delayed text: " .. text, showTo, r, g, b ) end setTimer ( delayedChat, 1000, 0, "Hello, World!", getRootElement(), 255, 0, 0 )
[email protected] Posted January 12, 2008 Posted January 12, 2008 thx, I see. That message is sending every second just once.1) How can i set up. sending message to infinite? 2) Can be message colored? for infinite calls use 0 in setTimer, and yes you can use colors function delayedChat ( text, showTo, r, g, b ) outputChatBox ( "Delayed text: " .. text, showTo, r, g, b ) end setTimer ( delayedChat, 1000, 0, "Hello, World!", getRootElement(), 255, 0, 0 ) You can also put the timer inside the function that is called by the timer itself, and call the function simply 1 time Then everytime the function is executed, it starts the timer again, which starts the function again, etc....
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now