Jump to content

Open source F2P quester


thatguycalledrob

Recommended Posts

I'm trying to improve at Java & RS script design.

I am making a (fully) open source quester for F2P - please have a look and leave suggestions & feedback. Bugs / coding cleanliness /Constructive feedback - all are welcome.

https://github.com/thatguycalledrob/Quester-FREE

Ultimately my goal is for this to complete all F2P quests (maybe minus dragon slayer) & provide stealth training for the levels required.
This is aimed to progress my own ability in scripting for OSbot, as well as a useful script for others.

 

COMPLETES:

Sheep Shearer
Romeo & Juliet
Cook's Assistant 
Rune Mysteries
The Restless Ghost 

IN DEVELOPMENT:

Goblin Diplomacy 
Doric's Quest (in progress)
(+ option to "make the money" to buy the items)

(+ fishing & cooking the food for this) 

DEVELOPMENT PENDING:

Nice GUI for quest order selection & the like.

A simple paint.

 

CREDIT

EXPLV for his great tutorial, map tool, Conditional sleep snippets & Open source tutorial island script.

Spoiler

 

 

 

Dark Magician for his easy Entity manipulation code!

Spoiler

 

 

 

I'm sure there will be more soon

~ Rob

Edited by thatguycalledrob
  • Like 2
Link to comment
Share on other sites

23 minutes ago, TheWind said:

Looks really good so far. The only class that seems a little strange to me is your EasyEntManipulator. I guess its pretty useful for debugging, but a lot of the methods look like they make the same checks multiple times. Other than that I wish you luck in finishing the project!

Yeah its a modified version of dark magician's - I will clean them up a little before I fully release this script, but as you say, they are amazing for debugging right now!

Link to comment
Share on other sites

Nice work man! I haven't looked through it fully as I need to get back to work, but here's some things I noticed in my quick look through (Keep in mind these are coming more from experience as a general developer, not specifically for OSBot script writing as I'm new to that just like you):
 

  • Your sleeps are a bit hard to follow.  How come you switch around your sleep times so drastically and switch between calling it in the main loop and calling it in child functions (e.g. you call sleep from within ConverseWithFred, but don't call it in the main loop)  
  • As TheWind said, EasyEntManipulator is messy; but I can see why you're using it currently.  You could add a boolean (called something like VERBOSE, which is the standard name used for clarifying if you want to log extra debug messages or not) and then wrap your debug logs in a block with "if (VERBOSE)".  That way you can quickly turn off all the extra debug code (by setting VERBOSE = false), and it makes it clear for anyone else reading your code that anything inside VERBOSE blocks is simply for debugging purposes. 
     
Link to comment
Share on other sites

Thanks for the feedback! I will give what feedback I can in return if you upload any code.

20 minutes ago, Colonel_Panic said:
  • Your sleeps are a bit hard to follow.  How come you switch around your sleep times so drastically and switch between calling it in the main loop and calling it in child functions (e.g. you call sleep from within ConverseWithFred, but don't call it in the main loop)  
     
2

Yeah, my sleep's are totally messed up - definitely one for the next version! I started developing with Explv's conditional sleep classes (which I base on the maximum expected execution time of the activity), but then I hit a null pointer exception earlier in development, which hung my game window since it looped endlessly with no delay between loops (as to let me hit the big red button). I started adding sleeps all over the place to mitigate this, as well as trying to be clever and implement a normally distributed sleeping as a form of an anti-pattern, but my implementation of the whole thing is all over the place.

29 minutes ago, Colonel_Panic said:
  • As TheWind said, EasyEntManipulator is messy; but I can see why you're using it currently.  You could add a boolean (called something like VERBOSE, which is the standard name used for clarifying if you want to log extra debug messages or not) and then wrap your debug logs in a block with "if (VERBOSE)".  That way you can quickly turn off all the extra debug code (by setting VERBOSE = false), and it makes it clear for anyone else reading your code that anything inside VERBOSE blocks is simply for debugging purposes. 
     
 

Ah, great suggestion - and I was here thinking that I would just comment them all out when the time comes! will implement now :)

Link to comment
Share on other sites

30 minutes ago, thatguycalledrob said:

Thanks for the feedback! I will give what feedback I can in return if you upload any code.

Yeah, my sleep's are totally messed up - definitely one for the next version! I started developing with Explv's conditional sleep classes (which I base on the maximum expected execution time of the activity), but then I hit a null pointer exception earlier in development, which hung my game window since it looped endlessly with no delay between loops (as to let me hit the big red button). I started adding sleeps all over the place to mitigate this, as well as trying to be clever and implement a normally distributed sleeping as a form of an anti-pattern, but my implementation of the whole thing is all over the place.

Ah, great suggestion - and I was here thinking that I would just comment them all out when the time comes! will implement now :)


If you want to really up your game, you could add CLI support for parameters (check out this guide: 

)

And then you could pass in true or false as a parameter when you run the script.

I'd recommend having it default to false so if you run it without parameters, it'll still work and just not log by default.  Something like this should do the trick:

// inside yourEasyEntManipulator:
public static boolean VERBOSE = false; // default debugging to off

// put this inside your onStart method:
if (getParameters() != null)
{
    String[] params = getParameters().split(","); //split parameters around commas
    EasyEntManiupulator.VERBOSE=Boolean.parseBoolean(params[0]);
} 



Then if you want to run it with debug you can quickly do so with:

java -jar OSBot.jar -login osbotname:osbotpass -bot "Novice Quester":true

 instead of having to change VERBOSE in eclipse and export it as a new jar every time you want to turn logging on or off

Edited by Colonel_Panic
  • Like 1
Link to comment
Share on other sites

6 hours ago, Colonel_Panic said:


If you want to really up your game, you could add CLI support for parameters (check out this guide: 

)

And then you could pass in true or false as a parameter when you run the script.

I'd recommend having it default to false so if you run it without parameters, it'll still work and just not log by default.  Something like this should do the trick:


// inside yourEasyEntManipulator:
public static boolean VERBOSE = false; // default debugging to off

// put this inside your onStart method:
if (getParameters() != null)
{
    String[] params = getParameters().split(","); //split parameters around commas
    EasyEntManiupulator.VERBOSE=Boolean.parseBoolean(params[0]);
} 



Then if you want to run it with debug you can quickly do so with:


java -jar OSBot.jar -login osbotname:osbotpass -bot "Novice Quester":true

 instead of having to change VERBOSE in eclipse and export it as a new jar every time you want to turn logging on or off

Modified it to work with your VERBOSE suggestion, will implement CLI further down the road, although its a great suggestion for the "production" finish!

Also the new version includes R&J quest

Link to comment
Share on other sites

On 9/25/2017 at 8:18 PM, Colonel_Panic said:


If you want to really up your game, you could add CLI support for parameters (check out this guide: 

)

And then you could pass in true or false as a parameter when you run the script.

I'd recommend having it default to false so if you run it without parameters, it'll still work and just not log by default.  Something like this should do the trick:


// inside yourEasyEntManipulator:
public static boolean VERBOSE = false; // default debugging to off

// put this inside your onStart method:
if (getParameters() != null)
{
    String[] params = getParameters().split(","); //split parameters around commas
    EasyEntManiupulator.VERBOSE=Boolean.parseBoolean(params[0]);
} 



Then if you want to run it with debug you can quickly do so with:


java -jar OSBot.jar -login osbotname:osbotpass -bot "Novice Quester":true

 instead of having to change VERBOSE in eclipse and export it as a new jar every time you want to turn logging on or off

I don't think you will be able to split with "," cause osbot uses that, instead u can use ";"

Link to comment
Share on other sites

Just tried it, and I don't think it works properly. I started the script in Lumby castle, and first I thought it works flawless when it started to webwalk towards Fred, but when it reaches Fred's house, and as soon as it walks into the house, the script just goes #phase2 and start walking to Juliet's house.

I'm gonna copy the OSBot logger:

 

[INFO][Bot #1][10/03 02:55:11 DU]: Started script : Novice Quester


[INFO][Bot #1][10/03 02:55:11 DU]: In sheep quest
[INFO][Bot #1][10/03 02:55:11 DU]: Case 0 selected
[INFO][Bot #1][10/03 02:55:11 DU]: Trying to Begin Quest
[INFO][Bot #1][10/03 02:55:12 DU]: Walking to Freds House
[INFO][Bot #1][10/03 02:55:46 DU]: WebWalkingEvent; We have reached the final destination!
[INFO][Bot #1][10/03 02:55:47 DU]: In R&J quest
[INFO][Bot #1][10/03 02:55:47 DU]: Case 0 selected
[INFO][Bot #1][10/03 02:55:47 DU]: Walking to Juliet
[INFO][Bot #1][10/03 02:57:59 DU]: WebWalkingEvent; We have reached the final destination!
[INFO][Bot #1][10/03 02:57:59 DU]: In sheep quest
[INFO][Bot #1][10/03 02:57:59 DU]: Case 0 selected
[INFO][Bot #1][10/03 02:57:59 DU]: Trying to Begin Quest
[INFO][Bot #1][10/03 02:58:00 DU]: Walking to Freds House

Link to comment
Share on other sites

On 10/3/2017 at 2:02 PM, flexike said:

Just tried it, and I don't think it works properly. I started the script in Lumby castle, and first I thought it works flawless when it started to webwalk towards Fred, but when it reaches Fred's house, and as soon as it walks into the house, the script just goes #phase2 and start walking to Juliet's house.

I'm gonna copy the OSBot logger:

 

 

 

2

Just picking this up again now I am moved into my new place for the year.

Classic Java noob mistake, I forgot to break; my case in my switch statement. Of all the things to go wrong!

I submitted a fix just now, and am hoping to add the next quest tonight or tomorrow!

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...