Jump to content

My Scripting Journey


Toxic

Recommended Posts

UPDATE END OF WEEK #1

I have been trying to use all my spare hours between class, work & fiance too get in as much information I can from all my resources to learn Java. I have been using multiple things to teach me Java as quick and efficiently as possible.

What I have been using:

  1. Code Academy - I have been looking over many threads and many scriptwriters recommended Code Academy, so I went ahead and started doing that and I am currently 50% done (Object Oriented Java) and will be resuming it starting Monday as I need a break from my week.
  2. SoloLearn - I downloaded this app on my phone and its almost exactly the same as Code Academy but phone friendly and it seems more informative then Code Academy. I have been learning lots but there is way more on this app too learn and it goes much slower. I am currently at 4/8 on the Basic Concepts and there's 6 more categories with 8 sections in each so I have a long way too go in this app.
  3. OSBOT Guide #1 - I have been reading over @Apaec "A Beginners Guide to Writing OSBOT Scripts" and it has helped me a lot, I have yet to make a script a full script that works but I am very close too, just want to be able to program the bot to bank within @Apaec script example.
  4. OSBOT Guide #2 - I have also been reading over @Explv "Explv's Scripting 101" which seems a bit more advanced and more information so I suggest you read @Apaec guide first before moving to this but it has helped me a lot as well and takes you to the next stage in a way about learning the API for OSBOT.
  5. OSBOT Open Source Script - I have been mainly looking at @kadiem "F2PChopper" but I am just trying to make it chop the tree rather then bank or anything more the just swinging an axe and dropping.

I have been trying to code a script that just takes the Jug inside of lumbridge castle, in the kitchen off the table and drops it and repeats. I have been having a slow start trying to figure this out and feel horrible because I feel like I should be able to somewhat do this but I am determined to get this obstacle out of my way and start up on the tree cutter.

Here is my code:

Spoiler

import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.api.model.RS2Object; 
 
import java.awt.*;


 
@ScriptManifest(author = "Toxic", info = "My first script", name = "Lumbridge Jug Stealer", version = 0, logo = "")
public class Main extends Script {
 
    @Override
    public void onStart() {
        log("Welcome to Toxic's Jug Stealer.");
        log("This is my first sript ever, hope you enjoy!");
    }
    
    private enum State {
        STEAL, DROP, WAIT
    };
    
    private State getState() {
        RS2Object table = getObjects().closest("Jug");
        if (!inventory.isEmpty())
            return State.DROP;
    if (table != null)
            return State.STEAL;
        return State.WAIT;
    }
 
    @Override
    public int onLoop() throws InterruptedException {
        switch (getState()) {
        case STEAL:
            RS2Object table = getObjects().closest("Jug");
            
            if (table != null) {
                    table.interact("Take");
            }
            break;
        case DROP:
                inventory.dropAll();
                break;
        case WAIT:
                sleep(random(500, 700));
                break;
        }
        return random(200, 300);
    }
 
    @Override
    public void onExit() {
        log("Thanks for running my Jug Stealer!");
    }
 
    @Override
    public void onPaint(Graphics2D g) {
        g.drawString("Hello Jugs!", 50, 50);
    }
 
}

This has been a bit of a slow start and I am kind of disappointed in myself and how hard I am struggling but I do not plan on giving up and will keep going head strong into this. If anyone has any advice...it would help me so much! Thanks for reading and see you all next weekend :D 

 

P.S. I will check this topic everday for any advice or replies!

Link to comment
Share on other sites

Wherever you're learning from, you should have an IDE open so that you can actively try out everything you've learned. Watching videos or reading a book solely isn't really sufficient.  

Be care with open source since there's a chance that it might be poorly written. 

Don't get caught up in the Osbot API. Learn how Java works then try out your skills on scripts. 

Link to comment
Share on other sites

51 minutes ago, dreameo said:

Wherever you're learning from, you should have an IDE open so that you can actively try out everything you've learned. Watching videos or reading a book solely isn't really sufficient.  

Be care with open source since there's a chance that it might be poorly written. 

Don't get caught up in the Osbot API. Learn how Java works then try out your skills on scripts. 

Got it!

- Have IDE open and try out everything while I am in these lessons

@dreameo Do you have any suggestions on a decent-good open source I can refer too?

Got it, Yea I was looking at the Osbot API and it looks like a lot hahaha

 

Thanks!!!

Link to comment
Share on other sites

4 hours ago, Apaec said:

Good luck friend! If you need any help with anything, don't hesitate to ask me / drop me a PM

... I really need to get around to finishing the re-write for the guide, I'm trying to make it as beginner friendly as possible but there's just so much to cover!

Apa

Thank you for your guide, it has helped me a lot and I have figured out a lot of different things just reading your guide. It's perfect and short :D

 

I will thank you!

  • Like 1
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...