Comments (4)
Update the issue was coming from the
BotHooks#draw(MainBufferProvider, Graphics, x, y) method
Commented out the draw method inside of the method above
// Draw the image onto the game canvas
//graphics.drawImage(image, 0, 0, bot.getCanvas());
from osrsbot.
**Unofficial Fix - Works for me
Replace your BotHooks#draw method with mine**
@Override
public void draw(MainBufferProvider mainBufferProvider, Graphics graphics, int x, int y) {
try {
//Preferably initialize the value of bot with the current bot on screen
// IE Application.getBot or similar manner.
if (graphics == null) {
return;
}
// We only want do do this once because this would MASSIVELY affect performance.
/*
if (SUPERCLASS_MAP.get(SUPERCLASS_MAP.keySet().iterator().next()) == null) {
for (Method method : this.getClass().getSuperclass().getDeclaredMethods()) {
Iterator itr = SUPERCLASS_MAP.keySet().iterator();
while (itr.hasNext()) {
String name = (String) itr.next();
if (method.getName().equals(name)) {
method.setAccessible(true);
SUPERCLASS_MAP.replace(name, null, method);
}
}
}
for (Field field : this.getClass().getSuperclass().getDeclaredFields()) {
Iterator itr = SUPERCLASS_MAP.keySet().iterator();
while (itr.hasNext()) {
String name = (String) itr.next();
if (field.getName().equals(name)) {
field.setAccessible(true);
SUPERCLASS_MAP.replace(name, null, field);
}
}
}
}*/
//We then simply invoke the method as needed here. It should perform similar to how it does in RuneLite
//final Graphics2D graphics2d = (Graphics2D) ((Method) SUPERCLASS_MAP.get(GETGRAPHICS)).invoke(this,
// mainBufferProvider);
Image image = mainBufferProvider.getImage();
// finalImage is backed by the client buffer which will change soon. make a copy
// so that callbacks can safely use it later from threads.
drawManager.processDrawComplete(() -> copy(image));
final Graphics2D g2d = (Graphics2D) bot.getCanvas().getGraphics(bot, mainBufferProvider);
// Draw the image onto the game canvas
//graphics.drawImage(image, 0, 0, bot.getCanvas());
g2d.drawImage(image, 0, 0, bot.getCanvas());
} catch (Exception e) {
e.printStackTrace();
//log.warn("Bot hooks failed to paint properly");
}
}
from osrsbot.
Looks good, I'll check in a bit to make sure it works properly. Basically what happens on
final Graphics2D g2d = (Graphics2D) bot.getCanvas().getGraphics(bot, mainBufferProvider);
is that it allows the bot canvas to be passed the MainBufferProvider for use in getBufferGraphics
It simply allows overlay from the bot to be painted onto the canvas and stores the buffer on the variable back. (Might be unnecessary, but a good bit of the code is just an inefficient port.)
Not sure what could've caused it to have any issues.
from osrsbot.
Been a bit, but I just got around to checking after porting a completely different code base to use with this.
Seems your change causes the bot to fail to display at all.
from osrsbot.
Related Issues (20)
- [FEATURE] Tempfix or Permfix for current freezing issue HOT 1
- [FEATURE] Finish implementation of multi-bot including GUI functionality. HOT 1
- [FEATURE] Finish fleshing out the CLI module to better enable headless run HOT 1
- [FEATURE] Check for latest version HOT 1
- [BUG] Bank Inventory Bug
- [REVIEW] Remove excessive and invasive implementations
- [BUG] Check on NPC getDef to ensure it is behaving correctly
- [BUG] VarcIntValues (and likely others) aren't entirely well-written
- [BUG] walking.setRun() needs updating HOT 1
- the client didn't work after the update Unknown command-line option '--bot-runelite'.
- [QUESTION] HOT 1
- [SUGGESTION] Equipment .vs Inventory signature irregularity with containsOneOf HOT 3
- [question] OSRSbot.jar
- [QUESTION] need help to run osrsbot
- [FEATURE] Add Inventory.contains note sensitive
- [FEATURE] Add zoom to Camera.java
- [BUG] New popup in bank may break banking
- [QUESTION] Can't build when importing and using gradle for this project or script template HOT 2
- [BUG] Trading players with names that contain space HOT 5
- the jar file is too old ! it that work ?![FEATURE]
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from osrsbot.