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.

Struggling with a bit of logic

Featured Replies

So im doing a multi location script for mining, ive added 2 locations so far for testing purpose but i is there some simplier way to make the bot listen to different locations?

at the moment im doing things like these.

Didnt look into someone else code because i dont want to paste, but if someone can give me a tip i'd appreciate it :)

//example check
if(skillgui.getOre() == "COAL" && skillgui.getArea() == "BarbVillage")
			{
				if(!getInventory().contains(item -> item.getName().contains("pickaxe")))
				{
					
					if(!coalBankArea.contains(myPlayer()))
						getWalking().webWalk(coalBankArea.getRandomPosition());	
					
					if(coalBankArea.contains(myPlayer()))
					{
					 if (!getBank().isOpen())
	                     getBank().open();
					 else
						 getBank().withdraw(item -> item.getName().contains("pickaxe"), 1);
					}
				}

//example check 2
//doing the same thing cuz my logic is shit
if(skillgui.getOre() == "TIN" && skillgui.getArea() == "OutVarrock")
			{
			if(!getInventory().contains(item -> item.getName().contains("pickaxe")))
			{
				//possible to replace bankAreaVarrock with the thing we choose in our combobox?
				
				if(!bankAreaVarrock.contains(myPlayer()))
					getWalking().webWalk(bankAreaVarrock.getRandomPosition());	
				
				if(bankAreaVarrock.contains(myPlayer()))
				{
				 if (!getBank().isOpen())
                     getBank().open();
				 else
					 getBank().withdraw(item -> item.getName().contains("pickaxe"), 1);
				}
			}

 

Edited by atoo

what if you just stored the values in a HashMap in your main code with the key being the string name ex: outVarrock, barbVillage and the value would be the Area. then you can just do

Area areaIWantTOWalkTo = hashmap.at(gui.getArea());

but im not really sure if i understood the question. are you trying to make checking which area the bot wants to mine in once or many times?

might have got some syntaxt stuff wrong but i think a hashmap would be helpful.

Edited by roguehippo

Just now, roguehippo said:

what if you just stored the values in a HashMap in your main code with the key being the string name ex: outVarrock, barbVillage and the value would be the Area. then you can just do

Area areaIWantTOWalkTo = hashmap.at(gui.getArea());

might have got some syntaxt stuff wrong but i think a hashmap would be helpful.

Hash map of String, Area would work.
You can also define a general area after the gui closes (miningArea) and use that in you check.

if you are planning on having many locations I would go with the hashmap though...

  • Author
18 minutes ago, HunterRS said:

Hash map of String, Area would work.
You can also define a general area after the gui closes (miningArea) and use that in you check.

if you are planning on having many locations I would go with the hashmap though...

Ye i want to have a lot of locations, at the moment as my poop snippet showed is that im doing the same code over and over with just a if check of what ore/area i have choosed in my comboBox.

25 minutes ago, roguehippo said:

what if you just stored the values in a HashMap in your main code with the key being the string name ex: outVarrock, barbVillage and the value would be the Area. then you can just do

Area areaIWantTOWalkTo = hashmap.at(gui.getArea());

but im not really sure if i understood the question. are you trying to make checking which area the bot wants to mine in once or many times?

might have got some syntaxt stuff wrong but i think a hashmap would be helpful.

Exactly like that, thanks.

Will look into it 

well they try something like this:
Define your hashmap

private HashMap<String, Area> miningLocationsMap = new HashMap<String, Area>();

Add values to the map in the onstart


miningLocationsMap.put("Varrock", new Area(0,0,0,0));
etc....

and finaly, define your mining location:

String locationString = skillgui.getArea();
Area miningLocation = miningLocationsMap.get(locationString);

 

2 minutes ago, atoo said:

Ye i want to have a lot of locations, at the moment as my poop snippet showed is that im doing the same code over and over with just a if check of what ore/area i have choosed in my comboBox.

 

  • Author

My game just freezes when i initialize this?

String locations = skillgui.getArea();

Area miningAreas = miningLocationsMap.get(locations);

nvm, i think i found the issue.

Edited by atoo

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.