Skip 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.

g.drawModel fails silently

Featured Replies

Display d = new Display();

@Override
public void onPaint(Graphics2D g){
	log("aaaa");

	g.setColor(Color.RED);
	d.drawModel(g, myPlayer().getGridX(), myPlayer().getGridY(), myPlayer().getZ(), myPlayer().getModel());

	log("bbbb");
}

 

trying out the Display api and when I call drawModel it seems like it is throwing an exception silently as I never saw the second message being printed on the console

am I doing anything wrong here?

I am trying to draw the outline of entities and tiles on screen, searched for some older posts in the forum but no luck :(

 

EDIT: should be using getDisplay() rather than instantiating a new display class, all good now :D

Edited by Slick

  • Developer
10 hours ago, Slick said:
Display d = new Display();

@Override
public void onPaint(Graphics2D g){
	log("aaaa");

	g.setColor(Color.RED);
	d.drawModel(g, myPlayer().getGridX(), myPlayer().getGridY(), myPlayer().getZ(), myPlayer().getModel());

	log("bbbb");
}

 

trying out the Display api and when I call drawModel it seems like it is throwing an exception silently as I never saw the second message being printed on the console

am I doing anything wrong here?

I am trying to draw the outline of entities and tiles on screen, searched for some older posts in the forum but no luck :(

 

EDIT: should be using getDisplay() rather than instantiating a new display class, all good now :D

Not sure what you are trying to do with this code, but you are trying to draw the display on top of your player :D

This draws the outline of a model :)
Same works for Npc,'s or whatever you are trying to draw.

public void onPaint(Graphics2D g){
RS2Object object = ....

  if(object != null && object.isVisible()){
     g.draw(object.getModel().getArea(object.getGridX(), object.getGridY(), object.getZ()));
  }
}

Retrieving a object in the onPaint method isn't a great example though, because this will result in FPS drops. The more things you load in the onPaint the harder your FPS drops :)
the best thing is to set the object inside the onLoop
 

RS2Object object;

public int onLoop(){
	object = ...;
}


public void onPaint(Graphics2D g){

  if(object != null && object.isVisible()){
     g.draw(object.getModel().getArea(object.getGridX(), object.getGridY(), object.getZ()));
  }
}

 

Edited by Khaleesi

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

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.