Bazim Posted January 12, 2008 Share 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. Link to comment
Guest Posted January 12, 2008 Share 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. Link to comment
Guest Posted January 12, 2008 Share 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. Link to comment
Bazim Posted January 12, 2008 Author Share 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? Link to comment
norby89 Posted January 12, 2008 Share 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 ) Link to comment
[email protected] Posted January 12, 2008 Share 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.... Link to comment
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