Thread: Converting Process() To Events

Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 36
  1. #21  
    Registered Member

    Join Date
    Feb 2007
    Posts
    1,005
    Thanks given
    2
    Thanks received
    17
    Rep Power
    93
    Quote Originally Posted by William.D View Post
    You're still doing it wrong, mate. Let's say you got this in your process:

    Code:
    if (timer > 0) {
    timer--;
    } if (timer == 0) {
    doJob();
    }
    Let's say you would set the timer to 6, which means 6x500MS that it would be executed after 3000 MS (3 seconds). Why does this suck? Because you are calling it 5 times to much, just execute an event after 3000 MS. Like this;

    Code:
    public void statRestore(final Player p) {
            EventManager.getSingleton().addEvent(3000, new Event() { 
    	    public void execute(EventContainer c) {        
    		doJob();
                            c.stop();
    	   }
    	});
        }
    Yeah exactly, you don't need timer inside a event.
    -Removed

    Advertising is not allowed.
    Reply With Quote  
     

  2. #22  
    Registered Member

    Join Date
    Feb 2007
    Posts
    1,005
    Thanks given
    2
    Thanks received
    17
    Rep Power
    93
    Code:
    public void statRestore(final Player p) {
    EventManager.getSingleton().addEvent( new Event() {
                        public void execute(EventContainer c) {
                           code here
                            c.stop();
                        }
                    }, ######);
    }
    Change the ######, to how much event waits before execution
    -Removed

    Advertising is not allowed.
    Reply With Quote  
     

  3. #23  
    Hi.

    'Mystic Flow's Avatar
    Join Date
    Nov 2007
    Posts
    7,141
    Thanks given
    256
    Thanks received
    1,247
    Rep Power
    3636
    If you guys are gonna flame him flame me cause im the one who taught him this

    [Only registered and activated users can see links. ]

    Reply With Quote  
     

  4. #24  
    Aza
    Aza is offline
    Banned

    Join Date
    May 2008
    Posts
    2,583
    Thanks given
    99
    Thanks received
    22
    Rep Power
    0
    I love you dude.
    Reply With Quote  
     

  5. #25  
    Hi.

    'Mystic Flow's Avatar
    Join Date
    Nov 2007
    Posts
    7,141
    Thanks given
    256
    Thanks received
    1,247
    Rep Power
    3636
    Quote Originally Posted by Aza View Post
    I love you dude.
    Im the one who explained so you should love me

    [Only registered and activated users can see links. ]

    Reply With Quote  
     

  6. #26  
    SERGEANT OF THE MASTER SERGEANTS MOST IMPORTANT PERSON OF EXTREME SERGEANTS TO THE MAX!

    cube's Avatar
    Join Date
    Jun 2007
    Posts
    8,881
    Thanks given
    1,854
    Thanks received
    4,741
    Rep Power
    5000
    If you want to teach something, make sure you're doing it right..



    Reply With Quote  
     

  7. #27  
    Registered Member pHametic's Avatar
    Join Date
    Nov 2006
    Posts
    637
    Thanks given
    3
    Thanks received
    1
    Rep Power
    11
    Well after you create the method for the new event where do you call it? or does it automatically get called?
    Reply With Quote  
     

  8. #28  
    Registered Member

    Join Date
    Feb 2007
    Posts
    1,005
    Thanks given
    2
    Thanks received
    17
    Rep Power
    93
    Quote Originally Posted by ramli View Post
    Well after you create the method for the new event where do you call it? or does it automatically get called?
    Common sense, No how could it automatically be called?
    call that event method where u want to start it.(Also common sense)
    -Removed

    Advertising is not allowed.
    Reply With Quote  
     

  9. #29  
    Banned

    Join Date
    Jan 2009
    Age
    28
    Posts
    2,662
    Thanks given
    66
    Thanks received
    207
    Rep Power
    0
    how do u make it get called?


    like what if you want a skull timer to go up

    that involve u clicking nothing

    how u make it go up?


    i did this it does nothing.

    Code:
    else if(command.equalsIgnoreCase("GGGG")){
    testddd = 50;
    }
    else if(command.equalsIgnoreCase("FFFF")){
    sM(""+testddd+"");
    }
    
    public void TESTDRRR(final Player p) {
    EventManager.getSingleton().addEvent( new Event() {
                        public void execute(EventContainer c) {
    if (testddd > 0) {
    testddd--;
       		   } else {
    		   	  c.stop();
    			}
                        }
                    }, 3000);
    }
    Reply With Quote  
     

  10. #30  
    Registered Member
    Unique's Avatar
    Join Date
    May 2008
    Posts
    457
    Thanks given
    0
    Thanks received
    1
    Rep Power
    164
    From what I know I think it is supposed to be like this:

    Code:
    else if(command.equalsIgnoreCase("GGGG")){
    testddd = 50;
    TESTDRRR(p);
    }
    I think the problem was you hadn't executed the event, Therefore it had no effect because the event never took place. I think I am right if not please correct me.
    Rs-kings
    Reply With Quote  
     

Page 3 of 4 FirstFirst 1234 LastLast

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
  •