Thread: Efficiency.

Results 1 to 3 of 3
  1. #1 Efficiency. 
    Donator

    Join Date
    Jul 2009
    Posts
    1,452
    Thanks given
    27
    Thanks received
    13
    Rep Power
    69
    Hey man0rx :_)

    I want a void to start off the castlewars game, but I am unsure about how to do it effectively. Because I only want to loop trough the players that stand in the waiting spots, waiting to battle. I dont want to loop trhough all players in the server - how can this be done?

    This is what i currently have:
    Code:
    public void startGame() {
    		EventManager.getSingleton().addEvent(
    			new Event() {
    				public void execute(EventContainer c) {
    					if (isInZamorakRoomCW && zamorakFigtherCW == 1) {
    						//Start castlewars game, for the Zamorakian team.
    					}
    					else if (isInSaradominRoomCW && saradominFigtherCW == 1) {
    						//Start castlewars game, for the Saradomin team. 
    					}
    					// c.stop(); Not needed as we want to keep it running, and repeating.
    				}
    			}, 300000); // executes every 300,000 ms = 5 minuttes.
    	}
    but I dont know if this will loop through all players

    Any better ideas than this?


    I also need a way of counting the players within an area :_)
    Will rep !
    Reply With Quote  
     

  2. #2  
    Registered Member
    AMG A Bear's Avatar
    Join Date
    Jun 2008
    Posts
    1,157
    Thanks given
    27
    Thanks received
    87
    Rep Power
    945
    for (Player p : server.playerHandler.players) {
    client c = (client) p;
    if (c == null)
    continue;
    }

    And there is no need to do this via an event. Object oriented programming isn't that bad, just make sure its after your playerhandler process. So long as your processing is less then 600ms (which it will be), and its not IN the client or playerhandler process, just use a separate class file for processing each minigame, using player loops (playerHandler player array).
    Quote Originally Posted by The Night Life View Post
    Errm. I had a similar idea a very long time ago, about instead of current rs's gameframe, (622) making a rsps with about a 1645 or something. Make it look like you walked outside. I even gathered proffesional computer programmers to help, but bailed on the idea after i realized if we all worked on it non-stop for months at a time, we'd barely get any progress. (unless you wanted to half ass it)
    Reply With Quote  
     

  3. #3  
    Donator

    Join Date
    Jul 2009
    Posts
    1,452
    Thanks given
    27
    Thanks received
    13
    Rep Power
    69
    Quote Originally Posted by call me bear View Post
    for (Player p : server.playerHandler.players) {
    client c = (client) p;
    if (c == null)
    continue;
    }

    And there is no need to do this via an event. Object oriented programming isn't that bad, just make sure its after your playerhandler process. So long as your processing is less then 600ms (which it will be), and its not IN the client or playerhandler process, just use a separate class file for processing each minigame, using player loops (playerHandler player array).
    I dont see how this can help me to only loop throuhg the players standing in that area sorry ;S
    My minigame is handled via. a seperate class file, and I used an event because I need to change a count-down interface each minutte :-)
    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

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