# Author: Yisc[NL] # # Lapper version needed: 7.0.4.10 or above # # # # Rotate text V1.01 15-02-20 -Initial release # ######################################################################################### CatchEvent OnLapperStart() OnLapperStart_Message_rotation(); EndCatchEvent CatchEvent OnConnect( $userName ) # Player event OnConnect_Message_rotation(); EndCatchEvent Sub OnLapperStart_Message_rotation() ### Register scheduled actions to make a call to Sub Message_rotation every 20 seconds ### RegisterScheduleAction( "0 * * * * * *", Message_rotation ); RegisterScheduleAction( "20 * * * * * *", Message_rotation ); RegisterScheduleAction( "40 * * * * * *", Message_rotation ); ### End ### ### Define GlobalVars and give them a value ### GlobalVar $welcome_message_id; $welcome_message_id=1; ### End ### EndSub Sub OnConnect_Message_rotation() ### Set start coordinates of buttons that will be displayed on screen ### $left_right_welcome=50; $top_bottom_welcome=2; ### End ### ### Define GlobalVars and give them a value ### GlobalVar $news_array; GlobalVar $Count_news_array; $news_array[1,1] = "^7This is a test"; $news_array[1,2] = "^7Have you read previous message?"; $news_array[1,3] = "^7Welcome on this server"; $news_array[1,4] = "^7Nice this rotating text system :-)"; $Count_news_array = arrayCount( $news_array ); $welcome_message_id=1; ### End ### ### Open button to be used as background and buttons to display text on ### openPrivButton( "welcome_bg",$left_right_welcome,$top_bottom_welcome,122,7,5,-1,16,"" ); openPrivButton( "welcome_news_1",$left_right_welcome+1,$top_bottom_welcome+1,15,5,5,-1,96,"^6Did you know:" ); openPrivButton( "welcome_news_2",$left_right_welcome+16,$top_bottom_welcome+1,105,5,5,-1,96,"^61/" . $Count_news_array . " - ^7" . $news_array[1,$welcome_message_id] ); ### End ### EndSub Sub Message_rotation() ### Raise $welcome_message_id by 1 ### $welcome_message_id = $welcome_message_id+1; ### End ### ### If $welcome_message_id is bigger than $Count_news_array, set it back to 1 ### IF ($welcome_message_id > $Count_news_array) THEN $welcome_message_id=1; ENDIF ### End ### ### Update text on button with ID 'welcome_news_2' ### TextPrivButtonAll( "welcome_news_2", "^6" . $welcome_message_id . "/" . $Count_news_array . " - ^7" . $news_array[1,$welcome_message_id] ); ### End ### EndSub