Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Advise code architecture

Featured Replies

I'm currently working on a Varrock Museum script for the 1k hunter and slayer xp :) However, I have a few problems regarding my code architecture.  

My idea is to solve the questions based on configs. For example, when config 1014 equals 2 the script should solve the Lizard questions. I think a switch statement is the best option to decide which animal to solve. 

I'm using an abstract Quiz class where most of my functions are defined, like walking to the right display position. I want to create subclasses for every animal that holds the questions, answers and the display position. So far my subclasses looks redundant, because I'm only using a constructor to pass the questions, answers and display position. Is it better to use, for example, a Enum that holds all the data?

Can someone help me out here?

It's an interesting question, naturally there's no correct answer.

I can't remeber exactly how the museum works, but I think it would be sufficient to store all the data in one big DisplayCase enum (position, config val, questions etc). Perhaps also create classes encapsulating questions and answers, and other intricacies. I'd do it this way because 1: all display cases are the same, thus there's really no need for inheritance, and 2: All the data is in one place so it's easier to manipulate when needed.

You can then, as you suggested, switch through the current config value to determine the corresponding display case, and act on the data respectively.

Good luck!

Apa

7 minutes ago, Apaec said:

It's an interesting question, naturally there's no correct answer.

I can't remeber exactly how the museum works, but I think it would be sufficient to store all the data in one big DisplayCase enum (position, config val, questions etc). Perhaps also create classes encapsulating questions and answers, and other intricacies. I'd do it this way because 1: all display cases are the same, thus there's really no need for inheritance, and 2: All the data is in one place so it's easier to manipulate when needed.

You can then, as you suggested, switch through the current config value to determine the corresponding display case, and act on the data respectively.

Good luck!

Apa

Was thinking on the exact same lines.

Put each display case data into an enum value (config, position, answers) and etc) and just grab the appropriate "enum record" in your onLoop based on the config value present.

As Apa mentioned, no real need for inheritance here.

Can also just use if/switch statements and you'll end up with one class.

  • Author

Thanks for the advise!

I'll try to implement a Enum since that sounds more logical then.

 

  • Enum for the data.
  • Custom API for everything relating to the Museum (and only the museum - which will also include the enum).
  • Task/Node or plain code for macro logic.

Edited by liverare

3 hours ago, liverare said:
  • Enum for the data.
  • Custom API for everything relating to the Museum (and only the museum - which will also include the enum).
  • Task/Node or plain code for macro logic.

This is what I did for mine in my AIO Hunter script. Also if you are wanting a free script that has been made already, there is one on the SDN. Good luck though :)

  • Author
2 hours ago, ProjectPact said:

This is what I did for mine in my AIO Hunter script. Also if you are wanting a free script that has been made already, there is one on the SDN. Good luck though :)

Thank you! I'll take a look on the SDN then :)

Edited by Hannes7337
I tried the museum script on the SDN recently. It's not working at the moment that's why I'm making one

2 hours ago, ProjectPact said:

This is what I did for mine in my AIO Hunter script. Also if you are wanting a free script that has been made already, there is one on the SDN. Good luck though :)

That script does not work.

On 3/4/2018 at 11:18 PM, killercrak said:

That script does not work.

Definitely does, I've used it many times lol

  • Author
3 hours ago, H0rn said:

Definitely does, I've used it many times lol

Have you used it recently? I tried the script like 1 month ago and it got stuck talking to Orlando

3 hours ago, Hannes7337 said:

Have you used it recently? I tried the script like 1 month ago and it got stuck talking to Orlando

Hmm, not too recently but I did use it when I created my pure about 2 weeks ago, maybe try again

7 hours ago, H0rn said:

Definitely does, I've used it many times lol

I just tried to use it on a new pure a few days ago. It did not even load at all.

  • Author
23 hours ago, killercrak said:

I just tried to use it on a new pure a few days ago. It did not even load at all.

Anyways, I'm finishing up my Museum script code and after that I need to test it on a few accounts. Too bad I need to use bonds to make them member ; p

When it's done I'll release it as a free script :)

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.