Jump to content

Task based WC+Fish script (Just need some opinion)


flexike

Recommended Posts

Hello,

 

So I only making this topic, because I'm curious on other people's opinion. I just started to learn scripting like a week or so ago, but I didn't have too much time for it.. I've read a lot about it on this forum, and I think I learned a few things.. I think I've read all of the threads in the Snippets/Tutorials section, and I gotta say thank you to  Explv and liverare  because I learnt a lot about their stuff.

 

I made my first script for myself, just for fun.. What it does is right after tutorial island, it's gonna start training first Fishing to lvl30, and when it's done, it's gonna change to WC (Tree & Oak)
If both skill reached lvl30, the script stops.

I tested it and works flawless.

 

Can any scripter check my script, if you have some free time, please? https://github.com/drawax/AIO

If you could tell me anything about how can I improve it, I'd really appreciate that.

 

Thanks in advance guys.

 

 

  • Like 2
Link to comment
Share on other sites

@flexike

Great script, a few pointers:
1. In the walkToShrimp task, in verify, might want to change <= to just <, it will never be equal anyways because of you if statement in your main but if in the future you want to change anything it might mess it up.
2. In the walkToShrimp task, in execute, might want to think about adding a sleep after the walking event (SleepUntill(() -> ShrimpSpot.contains(myPlayer()), 2000). Again, not necessary but better safe than sorry. 

3. In LumbyFishShrimps task, in execute, I would suggest also checking if the fishing spot is within the fishing location. I would also suggest you look into the use of osBot filters.

4. In LumbyFishShrimps task, in execute, before you interact with the spot you might also want to check if it has that action you are trying to do. Again this is just to double check you got to the right place and you don't try to interact with the wrong spot.

Filter<NPC> spotFilter = new Filter<NPC>(){
        public boolean match(NPC npc){
            return npc.getName().equalsIgnoreCase("Fishing spot") && npc.hasAction(fishingType) && fishingArea.contains(npc) && script.getMap().canReach(fishingSpot);
        }
    };

5. In LumbyFishShrimps task, in execute, I dont see any reason to sleep until your inv is filled as you are not interacting with the spot if you player is animating anyways. In my opinion that sleep will only cause delay and problems.

6. In LumbyFishShrimps task, in execute, again look into filter for the fishing net, also interact and then sleep (it might spam click the pickup).
 

if(fishingNet.interact("Take")){
	Sleep.sleepUntil(() -> script.getInventory().contains("Small fishing net"), 2000);
}

 

7.In DropTask, in execute, I would sleep untill inv is empty/only contains the net.

8. In WalkToTrees, in execute, again sleep for the walk. Same with the walkToOak

9. In OakWoodCutTask, in verify, again < and not <= with the finalWcLvl, right now it will train until the final level + 1. In execute, filters xD.

10. In TreeWoodCutTask, just filters :)

11. In AIO (main), pretty sure dismissing level up msgs is pretty useless as they will stop the animation anyways and once you interact again they will auto dismiss.
 

A few tips:

- Go over as much of the API as you possibly can.

- Test your script logic with flow charts, make sure you get all of the end situations (Do them in your head like me if you can't, no one really writes them down outside of school :) )

- Test your script by running it for as long as possible with babysitting it. This will probably show you anything you missed .

- Keep writing scripts because you are a great script writer.

 

Over all, great script man. Looks like you are a natural :) .

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