Jump to content

Chorux

Members
  • Posts

    4
  • Joined

  • Last visited

  • Feedback

    0%

Profile Information

  • Gender
    Male

Chorux's Achievements

Newbie

Newbie (1/10)

2

Reputation

  1. I feel like that for small scripts, and for other small programs too, it does not matter how you organize your code as it most likely will only have some hundred lines of code. However, if your script is bigger or could eventually become bigger it's good to at least try to follow the single responsibility principle, which basically means that one class should be responsible of one functionality/feature. For example one functionality could be banking, pathing or a break manager. Not only will this help with organizing your code, but you might get some reusable modules which you can use in your other scripts. If you want to do even more or just learn what you could do, check out SOLID design principles.
  2. An API could just be a class that does the spellbook handling for you. For learning how to interact with widgets, I again recommend you Explv's guide, check out section 12. Widgets. Basically the class could have a method which would find the correct spell using widgets as demonstrated in the guide above. And then you can later extend it to be able to cast whichever spell you want, or whatever, and there you have your own API. I know from experience that creating your own api sounds very intimidating and difficult when you are a beginner programmer, but it really is nothing scary
  3. Maybe try to split the interaction part so you can debug it more. First try to find the item in your inventory, and then interact on it Item head = getInventory().getItem("Ensouled giant head"); log("Item was found"); head.hasAction("Cast"); log("Cast action was found on the item"); head.interact("Cast"); or something like that. Also as suggested, check out the conditional sleep so you don't have fiddle with finding a good sleep amount. section 9
  4. Is your osbot filename "osrs.jar"? Also, use shift+right click on the folder and and choose "Open command prompt here" and then run the bat file to see the error. E: Or if there is "Open PowerShell here" then use that and run the bat using ./filename.bat
×
×
  • Create New...