Cyber Syndicate
<center><p style='font-size:120%;'><strong>Welcome to Cyber Syndicate!<strong></p>

You are visiting as a guest; please <strong>register</strong> or <strong>log in</strong>.

Being logged in provides many benefits, including access to the useful <strong>Methods forum</strong>, posting permissions, and voting permissions.

<strong>Enjoy.</strong></center>
Cyber Syndicate
<center><p style='font-size:120%;'><strong>Welcome to Cyber Syndicate!<strong></p>

You are visiting as a guest; please <strong>register</strong> or <strong>log in</strong>.

Being logged in provides many benefits, including access to the useful <strong>Methods forum</strong>, posting permissions, and voting permissions.

<strong>Enjoy.</strong></center>
Cyber Syndicate
Would you like to react to this message? Create an account in a few clicks or log in to continue.



 
HomeLatest imagesRegisterLog in

 

 Script Trial Runs

Go down 
2 posters
AuthorMessage
b0xb0x
Administrator
Administrator



Posts : 130
Join date : 2011-02-25
Age : 28
Location : California

Script Trial Runs Empty
PostSubject: Script Trial Runs   Script Trial Runs Icon_minitimeSun Mar 13, 2011 12:09 pm

A piece of code to stop your script after X hours.

Imports:
Code:
import com.rsbuddy.script.task.LoopTask;

Variable declarations:
Code:
int killhours = 0;

In your onStart(). (X should be replaced with the number of hours to trial)
Code:
    EndTask et = new EndTask();
    getContainer().submit(et);
    killhours = X;

And your LoopTask (as a class of course):
Code:
public class EndTask extends LoopTask {
    public int loop() {
        sleep(3600000 * killhours);
        log("Your " + killhours + " hours is up; stopping script.");
        stop();
        return -1;
    }
}

Enjoy.
Back to top Go down
https://cybersyndicate.forumotion.com
Remo
Member
Member



Posts : 41
Join date : 2011-03-10

Script Trial Runs Empty
PostSubject: Re: Script Trial Runs   Script Trial Runs Icon_minitimeSun Mar 13, 2011 1:41 pm

Another amazing method by b0xb0x. But what does getContainer.submit() do?

Back to top Go down
b0xb0x
Administrator
Administrator



Posts : 130
Join date : 2011-02-25
Age : 28
Location : California

Script Trial Runs Empty
PostSubject: Re: Script Trial Runs   Script Trial Runs Icon_minitimeSun Mar 13, 2011 1:54 pm

Remo wrote:
Another amazing method by b0xb0x. But what does getContainer.submit() do?


It submits the LoopTask to the script so it runs.
Back to top Go down
https://cybersyndicate.forumotion.com
Sponsored content





Script Trial Runs Empty
PostSubject: Re: Script Trial Runs   Script Trial Runs Icon_minitime

Back to top Go down
 
Script Trial Runs
Back to top 
Page 1 of 1
 Similar topics
-
» Script skeleton
» Need Suggestions: Script Organization.
» Paint for my UniCash script

Permissions in this forum:You cannot reply to topics in this forum
Cyber Syndicate :: Development :: Methods-
Jump to: