Jump to content

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


Sumo

Recommended Posts

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
Link to comment
Share on other sites

"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
Link to comment
Share on other sites

 

"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!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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