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
  • Code to send private messages?


    ItsPeaches

    Recommended Posts

    New to scripting, cant seem to figure out the code to grab a random online player from my friends list, and send a random message from a list of predetermined messages.

     

    Any suggestions or pointers? 

     

    thanks :)

    Link to comment
    Share on other sites

    There is a friends class that you can use to check if someone is online, but not message.

     

    You could always use widgets - this should work for the first friend slot, but you would have to adapt it to message other people too.

    getTabs().openWithMouse(Tab.FRIENDS);
    sleepUntil(() ->  getWidgets().getWidgetChild(429, 8, 2) != null, 3000);
    WidgetChild onlineFriend = getWidgets().getWidgetChild(429, 8, 2);
    if (onlineFriend != null && onlineFriend.getText().equals("Online")) {
         getWidgets().getWidgetChild(429, 8, 0).interact("Message");
         sleep(250,1000);
         //type message and press enter
    }
    
    Link to comment
    Share on other sites

    Awesome, thats what i was looking for, Thank you. 

     

    And yes I'm trying to use it to make an antiban, not because i think it'll be effective necessarily, but because I want to try and see if I can implement a variety of different unique actions which could possibly be used in one, for practice purposes.

    Link to comment
    Share on other sites

    Awesome, thats what i was looking for, Thank you. 

     

    And yes I'm trying to use it to make an antiban, not because i think it'll be effective necessarily, but because I want to try and see if I can implement a variety of different unique actions which could possibly be used in one, for practice purposes.

     

    No problem! Go to Tools > Game Debugger > Widgets and mess around with 429 -> 8 -> ... and you will find what you need. =)

    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.