Jump to content

[VIDEO] Tutorial to create your first script! |Introduction to task based scripts|


Recommended Posts

Posted (edited)

This guide is basically for you who never created a script before, I want to show you that its possible to create a simple script without almost no Java knowledge at all. Basically I just want to introduce more people into scripting.

 

First video:

 

 

 

Alright so my name is William and I've been playing around with Java and OSBots api for some months now. I feel that teaching is one of the best ways of learning so thats why I am creating this guide. I will try to upload atleast 1-2 clips per day and as soon as I am done with the "Create your first script" Series I will create a new series where Ill teach you how to "improve" your script, add a GUI, add some cool paint and much more.

 

As I am fairly new to scripting, you ( who are experienced) probably have better solutions than I do, please share them with us! I would be great if you could leave a comment (in the youtube video) with some suggestion. Dont just comment ("you suck"), tell me what I can do better!

 

 

 

Thank you for reading this and I really hope you will learn something!

 

Please watch the video on youtube so you can also leave a comment or just drop a like if you feel that you learned something!

Edited by Sumo
  • Like 3
Posted (edited)

"with no java knowledge at all" so basically you are encouraging skidding, right? doge.png

Plus, fairly bad code design you are showing for the plebs sad.png

 

You could have done:

public abstract class Task{
    protected Script script;
    public Task(Script script){
        this.script = script;
    }
 
    public abstract boolean active();
    public abstract void execute();
 
    public void run(){
        if (active())
            execute();
    }
} 

and just in the main class did:

public int onLoop(){
tasks.forEach(task -> task.run());
return 100;
}
Edited by Vilius
  • Like 1
Posted

 

"with no java knowledge at all" so basically you are encouraging skidding, right? doge.png

Plus, fairly bad code design you are showing for the plebs sad.png

 

You could have done:

public abstract class Task{
    protected Main script;
    public Task(Main script){
        this.script = script;
    }
 
    public abstract boolean active();
    public abstract void execute();
 
    public void run(){
        if (active())
            execute();
    }
} 

and just in the main class did:

public int onLoop(){
tasks.forEach(task -> task.run());
return 100;
}

 

Brilliant! Thats the type of feedback im looking for, thank you very much!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...