Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Tutorial Making a bot that does something :D

Was this helpful to users trying to become bot authors?

  • Yes, please add more!

    Votes: 28 75.7%
  • Yes, I am well off now.

    Votes: 3 8.1%
  • No, please add more!

    Votes: 0 0.0%
  • No, it wasn't useful.

    Votes: 3 8.1%
  • No, it is too confusing.

    Votes: 4 10.8%

  • Total voters
    37
Super Bot Author
Joined
Jun 24, 2016
Messages
151
Can you please help with what I did wrong?

Gyazo - 93e620485af04d0273379b415b2fac2b.png
Read the error messages.

For the first one, you tried to make a variable, but it expected it to be in a class, interface, or an enum since variables can't just be in packages only.

For the second one it expected there to be a ")". Look around there for where you're missing one and add it. IntelliJ highlights the errors in the editor so you can find exactly where they are.
 
Learning Java
Joined
Dec 24, 2016
Messages
24
Read the error messages.

For the first one, you tried to make a variable, but it expected it to be in a class, interface, or an enum since variables can't just be in packages only.

For the second one it expected there to be a ")". Look around there for where you're missing one and add it. IntelliJ highlights the errors in the editor so you can find exactly where they are.
How do I make a class for a variable? And what info do I put in that class? I tried making a new class for the "Obj" variable but it just gave the same error "Expected to be in a class, interface, or enum."
 
Joined
Jan 20, 2017
Messages
1
How do I make a class for a variable? And what info do I put in that class? I tried making a new class for the "Obj" variable but it just gave the same error "Expected to be in a class, interface, or enum."
The line
public GameObject obj;
should come after the public class line.

On the if(obj.interact line, you are missing an ending ) right parenthesis
 
Joined
Dec 27, 2016
Messages
20
Wow, this is truly awesome @awesome123man ! I hope you plan to continue adding things to this guide. I just started a Java class and I would love to learn more!
 
Go check out new bots and give helpful feedback.
Joined
Jan 31, 2016
Messages
5,413
Wow, this is truly awesome @awesome123man ! I hope you plan to continue adding things to this guide. I just started a Java class and I would love to learn more!
I may just remove all I posted and redo it as its ugly and bad at explaining, but I'm off to bed atm, later!
 
Joined
Jan 25, 2015
Messages
121
This is always null

Code:
GameObject spot = GameObjects.newQuery().names("Fishing spot").results().nearest();

my null checking:

Code:
if (spot != null) {

    //trying click here...

    System.out.println("click");

} else {

    //GETTING NULL HERE

    System.out.println("is null");
}

Any idea to fix this problem?
 
( ͡° ͜ʖ ͡°)
Joined
Mar 30, 2015
Messages
2,410
This is always null

Code:
GameObject spot = GameObjects.newQuery().names("Fishing spot").results().nearest();

my null checking:

Code:
if (spot != null) {

    //trying click here...

    System.out.println("click");

} else {

    //GETTING NULL HERE

    System.out.println("is null");
}

Any idea to fix this problem?

Well client is currently down in OSRS support, so those may be returning null in OSRS..
 
Go check out new bots and give helpful feedback.
Joined
Jan 31, 2016
Messages
5,413
Ohh sorry, I didn't specified. I'm scripting for RS3.

There are a new method for creating a GameObject for RS3 in Spectre API?
You may need to check other types such as Npcs... i'm not sure how fishing spots work. Consider using dev toolkit bot to find out.
 
Joined
Jan 25, 2015
Messages
121
You may need to check other types such as Npcs... i'm not sure how fishing spots work. Consider using dev toolkit bot to find out.

I'm understanding. In this case is possible the spot to be another "type" of object. So I need check if it is, for example, a ground item or npc, as you said. Right?


Enviado do meu iPhone usando Tapatalk
 
Top