Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Checking if an area contains a specified string


    UberJason

    Recommended Posts

    6 minutes ago, Nuclear Nezz said:

    You can also use the Trade api for trades.

    getTrade().acceptTrade()

    That's what I kinda want to do, but it just doesn't do anything.. It'll sit until the other account auto logs out. Here's how I'm using that:

    else if (getTrade().isOpen()) {
            	sleep(100, 300);
            	getTrade().acceptTrade();
            	sleep(100, 300);
            	getTrade().acceptTrade();

    I saw someone by the name of qbots using that, and thats where I first found that line to accept trades. I can build his example muling script and it accepts trades no problem. When I go to build my script though it doesn't work. I'm clearly doing something wrong but I don't know what. 

    Link to comment
    Share on other sites

    Idek. If anyone wants a few mill I'll be happy to pay for some help with understanding why it's not working. I understand knowledge isn't always free. Either I'm stoopid or my client doesn't like me, which would explain everything.

    Link to comment
    Share on other sites

    On 8/24/2019 at 12:53 PM, Leanche said:

    Hey,

    To check if player exists in yours area, you can iterate over every player in the area, just replace "name" with the name of a player you try to find.

    
    getPlayers().all().stream().anyMatch(player -> player != null && player.getName().equalsIgnoreCase(name))
    getPlayers().all()

    Is very demanding & you dont need to call that many functions to do a filter to find the player. Just do this.
     

    getPlayers().closest(p -> p != null && p.getName().equalsIgnoresCase(name))

     

    Link to comment
    Share on other sites

    53 minutes ago, NovaGTX said:
    
    getPlayers().all()

    Is very demanding & you dont need to call that many functions to do a filter to find the player. Just do this.
     

    
    getPlayers().closest(p -> p != null && p.getName().equalsIgnoresCase(name))

     

    Doesn't the same happen when using closests? If not, can you explain the difference?

    Link to comment
    Share on other sites

    On 8/24/2019 at 12:41 PM, 4ng1f1sh said:

    That's what I kinda want to do, but it just doesn't do anything.. It'll sit until the other account auto logs out. Here's how I'm using that:

    
    else if (getTrade().isOpen()) {
            	sleep(100, 300);
            	getTrade().acceptTrade();
            	sleep(100, 300);
            	getTrade().acceptTrade();

    I saw someone by the name of qbots using that, and thats where I first found that line to accept trades. I can build his example muling script and it accepts trades no problem. When I go to build my script though it doesn't work. I'm clearly doing something wrong but I don't know what. 

    So first of all I think your logic is just a little off.

    You have too many things happening on broad conditions.

    You have an initial two separate things. You can break it down to a single one, by going:

    if my local player is not in the grand exchange, walk to it->return (do not do anything after this statement, no point in checking anything beyond this because you're not there)

    if you make it beyond that return, you know you're in your location, now you want to look for the other player, using players.getClosest like suggested.

    if the player isn't there (null) return, because there's nothing to do after this. I'd also suggest adding in like a 2-3 second sleep, as it'll reduce the amount of times you're checking for all of this information, and if the player isn't there at all then there's a good chance it'll take more than 2 seconds for him to show up.

    Now again, if you make it beyond that check, it means your player is there. Check if the player is within your trade area

    If he's not, return, no point checking beyond that.

    If he is, then now you want to start looking at your trade stuff.

     

    If the trade is not open, trade with the player.
    Otherwise start accepting trades (unless you want to wait for certain items, then you just have more checks here)

     

    To me, that seems like it'd be a little bit more sound logic, as far as the steps go. Since you're not trying to make this anything complicated, I won't start getting into states/nodes.

    If you don't know how to translate those ideas into code, then I think you'd be better off learning a little bit more about Java itself, and how general logic in programming works. Having a solid base of programming before you start scripting will help you immensely.

    Link to comment
    Share on other sites

    17 minutes ago, Nuclear Nezz said:

    So first of all I think your logic is just a little off.

    You have too many things happening on broad conditions.

    You have an initial two separate things. You can break it down to a single one, by going:

    if my local player is not in the grand exchange, walk to it->return (do not do anything after this statement, no point in checking anything beyond this because you're not there)

    if you make it beyond that return, you know you're in your location, now you want to look for the other player, using players.getClosest like suggested.

    if the player isn't there (null) return, because there's nothing to do after this. I'd also suggest adding in like a 2-3 second sleep, as it'll reduce the amount of times you're checking for all of this information, and if the player isn't there at all then there's a good chance it'll take more than 2 seconds for him to show up.

    Now again, if you make it beyond that check, it means your player is there. Check if the player is within your trade area

    If he's not, return, no point checking beyond that.

    If he is, then now you want to start looking at your trade stuff.

     

    If the trade is not open, trade with the player.
    Otherwise start accepting trades (unless you want to wait for certain items, then you just have more checks here)

     

    To me, that seems like it'd be a little bit more sound logic, as far as the steps go. Since you're not trying to make this anything complicated, I won't start getting into states/nodes.

    If you don't know how to translate those ideas into code, then I think you'd be better off learning a little bit more about Java itself, and how general logic in programming works. Having a solid base of programming before you start scripting will help you immensely.

    Yeah, I really should learn more of Java itself first. It's simple enough, all I want to do is have it trade a given player, accept the items the player puts up and log out. I know some of what I want it to do isn't in there yet, but that's to come. I guess the fact that it seems simple enough made me think grabbing bits and pieces of information here and there would be enough to make it within the hour from little to no current knowledge. I definitely need Java not just for this but for my future career as well so I'll have to invest more time into learning it. 

    Link to comment
    Share on other sites

    On 8/26/2019 at 2:15 PM, 4ng1f1sh said:

    Yeah, I really should learn more of Java itself first. It's simple enough, all I want to do is have it trade a given player, accept the items the player puts up and log out. I know some of what I want it to do isn't in there yet, but that's to come. I guess the fact that it seems simple enough made me think grabbing bits and pieces of information here and there would be enough to make it within the hour from little to no current knowledge. I definitely need Java not just for this but for my future career as well so I'll have to invest more time into learning it. 

    Then yeah, I would definitely suggest pounding through some Java tutorials first. You'll probably learn some bad coding habits if you teach yourself through scripting. It's better to know the basics before you start going off the trails for things like this. On the other hand, once you are more comfortable with programming in general I'll be more than happy to answer any questions you have, or direct you towards threads that have information that would be beneficial for you.

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.