Thread: [Ruse] Global Announcements

Results 1 to 8 of 8
  1. #1 [Ruse] Global Announcements 
    Registered Member Wintersoul's Avatar
    Join Date
    Apr 2015
    Posts
    72
    Thanks given
    23
    Thanks received
    5
    Rep Power
    11
    src\com\ruseps\world\content\Announcement.java

    Code:
    package com.ruseps.world.content;
    
    import com.ruseps.util.Misc;
    import com.ruseps.util.Stopwatch;
    import com.ruseps.world.World;
    import com.ruseps.world.entity.impl.player.Player;
    
    public class Announcement {
    
        private static final int TIME = 600000; // 600000 milliseconds = 10 Minutes
        
        private static Stopwatch timer = new Stopwatch().reset();
        
    
        public static enum AnnouncementData {
            ANNOUNCEMENT_1("Message1"),   //These are the message that will be sent globally...
            ANNOUNCEMENT_2("Message2"),
    
            private AnnouncementData(String sendMessage) {
                this.sendMessage = sendMessage;
            }
    
            public String playerPanelFrame;
            private String sendMessage;
        }
    
        public static AnnouncementData getRandom() {
            AnnouncementData announcement = AnnouncementData.values()[Misc.getRandom(AnnouncementData.values().length - 1)];
            return announcement;
        }
    
        public static void sequence() {
                if(timer.elapsed(TIME)) {
                    AnnouncementData AnnouncementData = getRandom();
                    AnnouncementData = getRandom();
                    World.sendMessage("<img=10> <shad=1><col=E51302>"+AnnouncementData.sendMessage+"!");
                                    World.savePlayers();
                    timer.reset();
                }
        }
    }
    Locate World.java and add
    Code:
    import com.ruseps.world.content.Announcement;
    find
    Code:
            ShootingStar.sequence();
    add
    Code:
            Announcement.sequence();
    Reply With Quote  
     

  2. #2  
    Software Developer

    Tyrant's Avatar
    Join Date
    Jul 2013
    Age
    24
    Posts
    1,562
    Thanks given
    678
    Thanks received
    423
    Rep Power
    1060
    Hmm dunno why would you do all that process when simply it's just sending a message from an array.


    could simply create an array of contests:

    Code:
    public static final String[] MESSAGES = {"hi world", "bye world"};
    And use the task system to run process this, rather than a stop watch, set the cycle rate to the desired amount of ticks.

    Nonetheless thanks for the contribution.
    Reply With Quote  
     

  3. #3  
    Jake from State Farm

    FKN Jake's Avatar
    Join Date
    Nov 2013
    Posts
    675
    Thanks given
    45
    Thanks received
    58
    Rep Power
    153
    Kinda based on what I released but is random. Very nice.

    https://www.rune-server.ee/runescape...ers-saves.html
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Dec 2016
    Posts
    56
    Thanks given
    19
    Thanks received
    34
    Rep Power
    0
    This is what I use:
    Code:
    package com.falador.world.content;
    
    import com.falador.util.Misc;
    import com.falador.util.Stopwatch;
    import com.falador.world.World;
    
    /*
     * @author FaladorPS
     * www.FaladorPS.com
     */
    
    public class Reminders {
    	
    	
        private static final int TIME = 600000; //10 minutes
    	private static Stopwatch timer = new Stopwatch().reset();
    	public static String currentMessage;
    	
    	/*
    	 * Random Message Data
    	 */
    	private static final String[][] MESSAGE_DATA = { 
    			{"@blu@[SERVER]@bla@ Remember to ::vote for rewards every 12 hours!"},
    			{"@blu@[SERVER]@bla@ Use the command :;drop (npcname) for drop tables"},
    			{"@blu@[SERVER]@bla@ Use the ::help command to ask staff for help"},
    			{"@blu@[SERVER]@bla@ Make sure to read the forums for information www.FaladorPS.com"},
    			{"@blu@[SERVER]@bla@ Remember to spread the word and invite your friends to play!"},
    			{"@blu@[SERVER]@bla@ Use ::commands to find a list of commands"},
    			{"@blu@[SERVER]@bla@ Donate to help the server grow! :;donate"},
    			{"@blu@[SERVER]@bla@ Toggle your client settings to your preference in the wrench tab!"},
    			{"@blu@[SERVER]@bla@ Register and post on the forums to keep them active! ::Forum"},
    			
    		
    	};
    
    	/*
    	 * Sequence called in world.java
    	 * Handles the main method
    	 * Grabs random message and announces it
    	 */
    	public static void sequence() {
    		if(timer.elapsed(TIME)) {
    			timer.reset();
    			{
    				
    			currentMessage = MESSAGE_DATA[Misc.getRandom(MESSAGE_DATA.length - 1)][0];
    			World.sendMessage(currentMessage);
    					
    					
    				}
    				
    			}
    		
    
              }
      }
    Reply With Quote  
     

  5. Thankful user:


  6. #5  
    Registered Member Wintersoul's Avatar
    Join Date
    Apr 2015
    Posts
    72
    Thanks given
    23
    Thanks received
    5
    Rep Power
    11
    Quote Originally Posted by Temperature View Post
    Kinda based on what I released but is random. Very nice.

    https://www.rune-server.ee/runescape...ers-saves.html
    I ended up running into that after I made it xD aha Kinda wish i saw it before hand.
    Reply With Quote  
     

  7. #6  
    Registered Member
    Zivik's Avatar
    Join Date
    Oct 2007
    Age
    28
    Posts
    4,421
    Thanks given
    891
    Thanks received
    1,527
    Rep Power
    3285
    Enums are pretty useless for something simple like this. Thanks for the share anyways.
    Reply With Quote  
     

  8. Thankful user:


  9. #7  
    Registered Member
    Join Date
    Jul 2012
    Posts
    12
    Thanks given
    1
    Thanks received
    2
    Rep Power
    11
    Why is everyone using the ShootingStar class to do all of their task related activities on Ruse lol... so many more creative options than using a Stopwatch.
    Grab the announcements from a website where they can be edited whenever.
    That's how I am handling my admin acp's announcements. Server grabs the next announcement from the website and then sends it using World.sendMessage(string);

    Quote Originally Posted by FaladorPS View Post
    This is what I use:
    Code:
    package com.falador.world.content;
    
    import com.falador.util.Misc;
    import com.falador.util.Stopwatch;
    import com.falador.world.World;
    
    /*
     * @author FaladorPS
     * www.FaladorPS.com
     */
    
    public class Reminders {
    	
    	
        private static final int TIME = 600000; //10 minutes
    	private static Stopwatch timer = new Stopwatch().reset();
    	public static String currentMessage;
    	
    	/*
    	 * Random Message Data
    	 */
    	private static final String[][] MESSAGE_DATA = { 
    			{"@blu@[SERVER]@bla@ Remember to ::vote for rewards every 12 hours!"},
    			{"@blu@[SERVER]@bla@ Use the command :;drop (npcname) for drop tables"},
    			{"@blu@[SERVER]@bla@ Use the ::help command to ask staff for help"},
    			{"@blu@[SERVER]@bla@ Make sure to read the forums for information www.FaladorPS.com"},
    			{"@blu@[SERVER]@bla@ Remember to spread the word and invite your friends to play!"},
    			{"@blu@[SERVER]@bla@ Use ::commands to find a list of commands"},
    			{"@blu@[SERVER]@bla@ Donate to help the server grow! :;donate"},
    			{"@blu@[SERVER]@bla@ Toggle your client settings to your preference in the wrench tab!"},
    			{"@blu@[SERVER]@bla@ Register and post on the forums to keep them active! ::Forum"},
    			
    		
    	};
    
    	/*
    	 * Sequence called in world.java
    	 * Handles the main method
    	 * Grabs random message and announces it
    	 */
    	public static void sequence() {
    		if(timer.elapsed(TIME)) {
    			timer.reset();
    			{
    				
    			currentMessage = MESSAGE_DATA[Misc.getRandom(MESSAGE_DATA.length - 1)][0];
    			World.sendMessage(currentMessage);
    					
    					
    				}
    				
    			}
    		
    
              }
      }
    disappointed in the way you handled this
    Reply With Quote  
     

  10. #8  
    AleronPS


    Join Date
    Dec 2017
    Posts
    93
    Thanks given
    99
    Thanks received
    10
    Rep Power
    73
    Thanks for this Post. Many starters will be glad to use it.
    Yours Sincerely,
    Eliyahu | Aleron

    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. [PI] Global Announcements
    By Sirius_ in forum Snippets
    Replies: 11
    Last Post: 09-19-2014, 05:32 PM
  2. Global Announcement when npc spawns,
    By Aesthetic Brah in forum Buying
    Replies: 4
    Last Post: 06-20-2014, 06:43 PM
  3. Two global server announcement questions
    By Bludstained in forum Help
    Replies: 3
    Last Post: 10-28-2012, 11:24 PM
  4. Working global objects for pimpscape!
    By wildy in forum Tutorials
    Replies: 5
    Last Post: 06-02-2007, 11:13 AM
  5. WhiteScape Global Objects
    By Santa Noobie in forum Tutorials
    Replies: 2
    Last Post: 05-29-2007, 10:51 PM
Tags for this Thread

View Tag Cloud

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •