Jump to content

Search the Community

Showing results for tags 'flags'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • OSBot
    • News & Announcements
    • Community Discussion
    • Bot Manager
    • Support Section
    • Mirror Client VIP
    • Script Factory
  • Scripts
    • Official OSBot Scripts
    • Script Factory
    • Unofficial Scripts & Applications
    • Script Requests
  • Market
    • OSBot Official Voucher Shop
    • Currency
    • Accounts
    • Services
    • Other & Membership Codes
    • Disputes
  • Graphics
    • Graphics
  • Archive

Product Groups

  • Premium Scripts
    • Combat & Slayer
    • Money Making
    • Minigames
    • Others
    • Plugins
    • Agility
    • Mining & Smithing
    • Woodcutting & Firemaking
    • Fishing & Cooking
    • Fletching & Crafting
    • Farming & Herblore
    • Magic & Prayer
    • Hunter
    • Thieving
    • Construction
    • Runecrafting
  • Donations
  • OSBot Membership
  • Backup

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


MSN


Website URL


ICQ


Yahoo


Skype


Location:


Interests

Found 1 result

  1. Here's a quick way to get key/value pairs from your CLI parameters. We can take: -script TestScript:body.green-d'hide-body.legs.preists-robes.location.varrock.mode.attack And convert it to: BODY:green d'hide body LEGS:priests robes LOCATION:varrock MODE:attack You're probably wondering 'why are the keys uppercase?', well that's to signify what the bot thinks are keys. A little debugging and you'll be able to see what your bot sees. The full-stop "." is our delimiter, and the hyphen "-" is our replacement for the space " " key. Example code + template: public class Test extends Script { Map<String, String> parameters; String mode; @Override public void onStart() throws InterruptedException { compileParameters(); mode = parameters.get("mode"); } @Override public int onLoop() throws InterruptedException { // log out the parameters for debugging purposes logger.debug(parameters); // use parameters if (mode != null && !mode.isEmpty()) { if (mode.equals("attack")) { // TODO - attack something } } return 1000; } /** * Compiles OSBot parameters into key/value pairs */ private void compileParameters() { String rawParameterString = getParameters(); String[] contents; String key; String value; parameters = new HashMap<>(); if (rawParameterString != null && !rawParameterString.isEmpty()) { logger.debug(rawParameterString); contents = rawParameterString.split("\\."); if (contents != null && contents.length > 0) { for (int i = 0; i < contents.length; i += 2) { key = contents[i]; key = key.toUpperCase(); value = (i + 1 < contents.length ? contents[i + 1] : ""); value = value.replaceAll("-", " "); parameters.put(key, value); } } } } } Have fun!
×
×
  • Create New...