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.

CameraEntityEvent

Featured Replies

Ok so, any ideas why this doesn't want to move the camera ?

NPC npc = getNpcs().closest(npcFitler);

CameraEntityEvent ce = new CameraEntityEvent(npc);

execute(ce);

Edited by iJodix

Ok so, any ideas why this doesn't want to move the camera ?

CameraEntityEvent ce = newCameraEntityEvent(npc);

NPC npc = getNpcs().closest(npcFitler);

maybe you should put a space between "newCameraEntityEvent"

i could be wrong dou

  • Author

maybe you should put a space between "newCameraEntityEvent"

i could be wrong dou

Oh sorry, i re-wrote the code to the thread so made a typo.

Edited by iJodix

Oh sorry, i re-wrote the code to the thread so made a typo.

 

i always had trouble with #execute(Event e);

 

my solution was: 

 

this.getBot().getEventExecutor().execute(ce);

 

Hope this helps!

 

Precise.

  • Author

i always had trouble with #execute(Event e);

 

my solution was: 

 

this.getBot().getEventExecutor().execute(ce);

 

Hope this helps!

 

Precise.

Ok, it .. kinda moves the camera ? Like few pixels ..

I don't have any issues with executing the MoveMouseEvent :/

Edited by iJodix

The camera class seems to be broken at the moment, manually setting the Yaw or using toEntity/toPosition doesn't work 99% of the time.

try this

	/*
	 * Rotate the camera to an entity; Based on angle calculations
	 */
	public void cameraToEntity(Entity e) {
		cameraToPosition(e.getPosition());
	}

	/*
	 * Rotate the camera to a Position; Based on angle calculations
	 */
	public void cameraToPosition(Position p) {
		Position pos = myPosition();
		int angle = 90 + (int) Math.toDegrees(Math.atan2(-(p.getY() - pos.getY()), p.getX() - pos.getX()));
		int yaw = angle < 0 ? Math.abs(angle) : 360 - angle;
		CameraYawEvent evt = new CameraYawEvent(yaw);
		execute(evt.setBlocking());
	}

EDIT:

or just try to set whatever camera event you're using to be blocking (Event#setBlocking) before executing it.

Edited by FrostBug

  • Author

try this

	/*
	 * Rotate the camera to an entity; Based on angle calculations
	 */
	public void cameraToEntity(Entity e) {
		cameraToPosition(e.getPosition());
	}

	/*
	 * Rotate the camera to a Position; Based on angle calculations
	 */
	public void cameraToPosition(Position p) {
		Position pos = myPosition();
		int angle = 90 + (int) Math.toDegrees(Math.atan2(-(p.getY() - pos.getY()), p.getX() - pos.getX()));
		int yaw = angle < 0 ? Math.abs(angle) : 360 - angle;
		CameraYawEvent evt = new CameraYawEvent(yaw);
		execute(evt.setBlocking());
	}

EDIT:

or just try to set whatever camera event you're using to be blocking (Event#setBlocking) before executing it.

Thank you! QwPha8E.png QwPha8E.png QwPha8E.png QwPha8E.png QwPha8E.png QwPha8E.png

Edited by iJodix

try this

	/*
	 * Rotate the camera to an entity; Based on angle calculations
	 */
	public void cameraToEntity(Entity e) {
		cameraToPosition(e.getPosition());
	}

	/*
	 * Rotate the camera to a Position; Based on angle calculations
	 */
	public void cameraToPosition(Position p) {
		Position pos = myPosition();
		int angle = 90 + (int) Math.toDegrees(Math.atan2(-(p.getY() - pos.getY()), p.getX() - pos.getX()));
		int yaw = angle < 0 ? Math.abs(angle) : 360 - angle;
		CameraYawEvent evt = new CameraYawEvent(yaw);
		execute(evt.setBlocking());
	}

EDIT:

or just try to set whatever camera event you're using to be blocking (Event#setBlocking) before executing it.

 

Been a long time since I saw the atan2 function lol.

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.