Thread: Cycle-based task manager problem

Results 1 to 7 of 7
  1. #1 Cycle-based task manager problem 
    Donator


    Join Date
    Jan 2010
    Age
    29
    Posts
    4,122
    Thanks given
    274
    Thanks received
    551
    Rep Power
    738
    Fixed this
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Sep 2008
    Posts
    4,833
    Thanks given
    894
    Thanks received
    1,439
    Rep Power
    2924
    Container.stop();
    "Know thy self, know thy enemy. A thousand battles, a thousand victories." - Sun Tzu
    GitHub: https://github.com/Faris-Mckay
    Reply With Quote  
     

  3. #3  
    Donator


    Join Date
    Jan 2010
    Age
    29
    Posts
    4,122
    Thanks given
    274
    Thanks received
    551
    Rep Power
    738
    Quote Originally Posted by Faris View Post
    Container.stop();
    Yes it works while being in my files where it uses the task but outside the task like walking.java the stop(); doesnt work

    and if i make the stop void static it will null the server
    Reply With Quote  
     

  4. #4  
    Registered Member

    Join Date
    Sep 2008
    Posts
    4,833
    Thanks given
    894
    Thanks received
    1,439
    Rep Power
    2924
    Quote Originally Posted by Nighel15 View Post
    Yes it works while being in my files where it uses the task but outside the task like walking.java the stop(); doesnt work
    That's because you can't call stop from outside of the event, every client had tens of events running simultaneously so it would be a pretty dumb system if you could do it how your trying.

    Here's what you do. In wherever your trying to stop it, change a Boolean to false instead.
    Now in the main body of the event, have it check for if that Boolean is not false before continuing... If it is = false then call container.stop();
    "Know thy self, know thy enemy. A thousand battles, a thousand victories." - Sun Tzu
    GitHub: https://github.com/Faris-Mckay
    Reply With Quote  
     

  5. #5  
    Donator


    Join Date
    Jan 2010
    Age
    29
    Posts
    4,122
    Thanks given
    274
    Thanks received
    551
    Rep Power
    738
    Quote Originally Posted by Faris View Post
    That's because you can't call stop from outside of the event, every client had tens of events running simultaneously so it would be a pretty dumb system if you could do it how your trying.

    Here's what you do. In wherever your trying to stop it, change a Boolean to false instead.
    Now in the main body of the event, have it check for if that Boolean is not false before continuing... If it is = false then call container.stop();
    Code:
    		Server.getTaskScheduler().schedule(new Task(3, false) {
    			int cycle = amount;
    			@Override
    			protected void execute() {
    				if (c.disconnected) {
    					stop();
    					return;
    				}
    				if (c.isCookin = false) {
    					stop();
    					return;
    				}
    				c.startAnimation(c.playerSkillProp[7][5] == 2732 ? 897 : 896);
    				if (!c.playerHasItem(c.oldItem, 1) || !c.checkTask(task)) {
    					stop();
    					c.resetPlayerSkillVariables();
    					c.stopPlayerSkill = true;
    					return;
    				}
    				c.stopPlayerSkill = true;
    				c.deleteItem(c.oldItem, 1);
    				if (c.playerLevel[7] >= fishStopsBurning(c, c.oldItem) || Misc.random(cookChance(c)) > Misc.random(c.levelReq)) {
    					c.sM("You successfully cook the " + c.getItemName(c.oldItem).toLowerCase() + ".");
    					c.addSkillXP(c.gainXp, 7);
    					c.addItem(c.newItem2, 1);
    				} else {
    					c.sM("Oops! You accidentally burnt the " + c.getItemName(c.oldItem).toLowerCase() + "!");
    					c.addItem(c.newItem, 1);
    				}
    				cycle--;
    				if (cycle < 1) {
    					c.isCookin = false;
    					stop();
    					c.resetPlayerSkillVariables();
    					return;
    				}
    			}
    		});
    added something like you said, and the

    Code:
    if(isCookin = true) {
    isCookin = false;
    }
    and still didnt fix it

    But so there is no way i can stop a task/event away outside the task/event
    Reply With Quote  
     

  6. #6  
    Registered Member

    Join Date
    Sep 2008
    Posts
    4,833
    Thanks given
    894
    Thanks received
    1,439
    Rep Power
    2924
    Not that I know of... I could be wrong, so if there is a way. It'll be directly involving the event id
    "Know thy self, know thy enemy. A thousand battles, a thousand victories." - Sun Tzu
    GitHub: https://github.com/Faris-Mckay
    Reply With Quote  
     

  7. #7  
    Donator


    Join Date
    Jan 2010
    Age
    29
    Posts
    4,122
    Thanks given
    274
    Thanks received
    551
    Rep Power
    738
    Quote Originally Posted by Faris View Post
    Not that I know of... I could be wrong, so if there is a way. It'll be directly involving the event id
    Hmm oke, check the code if posted i think its what you ment but it still doesnt stop the event while like clicking on minimap
    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. Cycle-based Task Manager
    By Graham in forum Tutorials
    Replies: 68
    Last Post: 11-23-2013, 12:14 AM
  2. Replies: 0
    Last Post: 12-18-2011, 04:49 PM
  3. Replies: 23
    Last Post: 07-12-2011, 12:17 AM
  4. Replies: 2
    Last Post: 05-22-2011, 06:17 AM
  5. Cycle Based Event Manager
    By Mister Maggot in forum Snippets
    Replies: 23
    Last Post: 11-29-2010, 08:25 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •