1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Hey Guest, If you'd like to instant message with many other users, then join our
    Official Rune-Status Discord Server!
    Dismiss Notice
  3. Got your own Server? Looking for a Server to play right now??
    Make sure you check out the Public Server Directory!
    Dismiss Notice
  4. If you're new to the Rsps Scene and want to jump straight into learning how to Set-up and Customise your own RuneScape Private Sever then check out the Guides and Tutorials for RS2 here.
    Dismiss Notice
Dismiss Notice
Hey Guest,
Are you sure your posting in the Right Sections?
If your unsure which RuneTek version you are working with visit this page to find out.

EverythingRS Commands Installation [ANY BASE]

Discussion in 'Guides & Tutorials' started by Genesis, Feb 11, 2018.

  1. EverythingRS - Commands Installation

    EverythingRS is a free API system. Here's a quick tutorial on how to get started with commands.

    Things Included with the Commands API

    At the moment we provide 5 different commands related to search which give you quicker access to our Tools page.

    • :: sitem which is short for "searchitem" will give you results for RS2 items.
    • :: ositem short for "Old School Item" will give you results for OSRS items.
    • :: snpc short for "Search NPC" will give you results for RS2 NPCs.
    • :: osnpc short for "Old School NPC" will give you results for OSRS NPCs
    • :: osobject short for "Old School Object" will give you results for OSRS Objects

    [​IMG]

    [​IMG]


    Getting started

    • First off download our everythingrs-api.jar from Sorry you must be logged in to read this.
      Click here to log in.
      and include it into your project.
    • Also register an account at Sorry you must be logged in to read this.
      Click here to log in.
    • Remember your secret key as you will be using it in the next section

    [​IMG]


    Making the commands work with your server

    This part of the tutorial is for PI & Ruse, but can easily be changed to work with any server. If you want me to add a snippet on the thread so it can work with your framework leave a comment with the server base you want the snippet for.


    • Add the code below into Commands.java and you're all done!

    			if (playerCommand.startsWith("sitem") || playerCommand.startsWith("snpc")
    					|| playerCommand.startsWith("ositem") || playerCommand.startsWith("osnpc")
    					|| playerCommand.startsWith("osobject")) {
    				String[] args = playerCommand.split(" ");
    				final String command = playerCommand;
    				new Thread() {
    					public void run() {
    						synchronized (c) {
    							try {
    								String query = args[1];
    								com.everythingrs.commands.Search[] searchResults = com.everythingrs.commands.Search
    										.searches("secret_key", command, query);
    								if (searchResults.length > 0)
    									if (searchResults[0].message != null) {
    										c.sendMessage(searchResults[0].message);
    										return;
    									}
    								c.sendMessage("-------------------");
    								for (com.everythingrs.commands.Search search : searchResults) {
    									c.sendMessage(search.name + ":" + search.id);
    								}
    								c.sendMessage("Finished search with " + searchResults.length + " results");
    								c.sendMessage("-------------------");
    							} catch (Exception e) {
    								c.sendMessage("Api Services are currently offline. Please check back shortly");
    								e.printStackTrace();
    							}
    						}
    					}
    				}.start();
    			}
    




    In CommandPacketListener

    under

    public static void playerCommands(

    Add

    			if (command[0].equalsIgnoreCase("sitem") || command[0].equalsIgnoreCase("snpc")
    					|| command[0].equalsIgnoreCase("ositem") || command[0].equalsIgnoreCase("osnpc")
    					|| command[0].equalsIgnoreCase("osobject")) {
    
    				new Thread() {
    					public void run() {
    						synchronized (c) {
    							try {
    
    								String query = command[1];
    								com.everythingrs.commands.Search[] searchResults = com.everythingrs.commands.Search
    										.searches("secret_key", command[0], query);
    								if (searchResults.length > 0)
    									if (searchResults[0].message != null) {
    										player.getPacketSender().sendMessage(searchResults[0].message);
    										return;
    									}
    								player.getPacketSender().sendMessage("-------------------");
    								for (com.everythingrs.commands.Search search : searchResults) {
    									player.getPacketSender().sendMessage(search.name + ":" + search.id);
    								}
    								player.getPacketSender()
    										.sendMessage("Finished search with " + searchResults.length + " results");
    								player.getPacketSender().sendMessage("-------------------");
    							} catch (Exception e) {
    								player.getPacketSender()
    										.sendMessage("Api Services are currently offline. Please check back shortly");
    								e.printStackTrace();
    							}
    						}
    					}
    				}.start();
    			}

    Fin

    You are finished with the tutorial and can now search for any osrs item, rs2 item, osrs npc, rs2 npcs, or osrs object quickly. If you have any suggestions for more commands be sure to let me know ^^
     
    Tags:
Loading...
Loading...