Jump to content

Joseph

Trade With Caution
  • Posts

    4692
  • Joined

  • Last visited

  • Feedback

    91.3%

Everything posted by Joseph

  1. Joseph

    Herb Snippet

    I know I just preferr my way because it's just me :P, but just because I posted my way doesn't mean it wrong. He didn't even know what I was up to
  2. Since the bot is down im going to update this.
  3. Joseph

    Herb Snippet

    Why do people always tell me I'm using enum wrong I know exactly what I'm doing -.- the only reason why I have it that way is so, let's say your using a combo box or a list, and they chose a herb from the list. You use getSelectedIndex() (from with or, combo box or list) which returns an int, you use the int that they chose, within the get(int index) which will return the herb the chose. Now you could simply use the other methods that use a herb argument. To return what ever you need, for example name, or ids. You could make an AIO with simply two or three lines of code. Rather Then using a for loop, switch statement, or even a nested if and else statement Which takes up a bunch of lines. Sorry for the rant, and you didn't fix anything for me you just dumbed it down for everyone else
  4. What you could do is, use client#getCurrentRegion#getObjects. Which should give you an array list of objects around your area. Use a for loop for with the array list. Then use any other for loop with the objectDefinition#getActions. And if you could reach it, and it has like a certain action that can be interacted with. You could create an empty list an add those objects into the list. And make your method return the list of rs2objects.
  5. Int getSupplyAmount(RuneSupply[]) Return the amount runes for a Spell cast are left in your inventory. im still thinking of how im could do this.
  6. We'll I'm tell you straight up that you should really use an array of tiles for that. Because it would be easier to implement.
  7. so what exactly are you looking for. To color a whole area? Tiles in an area? or what?
  8. please use the newest version. i currently updated. i left a log change on the first top so everybody knows
  9. if you get could get the an array of tiles in an area. You could use a enhance for loop, and literally do the same process above to color all the tiles in an area.
  10. O shit I didn't know I left the packages I thought I took them off. I'm remove it in a little. Also I'll fix the name too edit: i change the package name to "magic.management", hopefully its fine now. Change the following Spells to spell, Elements to element, Runes to rune, and Spells to MagicSpell.
  11. oh i forgot to mention it support staffs . So if your using an air staff, and it's checking to see if you have the required runes, and amount of rune. It will neglect the air runes.
  12. I have to give some credit to , he had the idea at first, the link to his thread. Supports: Support the usage of staffs. For example: So if your using an air staff, and it's checking to see if you have the required runes, and amount of rune. It will neglect the air runes. This Snippet contain almost all spells. The spells that aren't supported are: The one that require a different staff that arent in the enum "Staffs". Example: Magic Dart The ones that require an item in your inventory. Example: Charge orb, Teleport to ape Atoll The Lumbridge home teleport. And any other spell outside of the normal spell book. if i get much love, ill add in more methods such as: interact with spell, interact wtih spell on invetory item, or interact with spell on entity. Or even support the spells that are supported atm. Change Log: Snippet: How to initialize it: First create a new RuneManager variable. The on the onStart() you make the new variable equal the RuneManager Constructor. private RuneManager manager; @Override public void onStart() { manager = new RuneManager(this); } How to use it: if (manager.containsSuppliesFor(MagicSpell.WIND_BOLT, Staff.AIR)) { /stuff }
  13. ill work on it later
  14. are you going to do it? if not ill be able to do it
  15. Joseph

    Herb Snippet

    So i had this laying around, and i'm not working with herbs anymore so here you go. Some credits to @Kenneh public enum Herb { GUAM(3, 249, 250, 199, 200), MARRENTILL(5, 251, 252, 201, 202), TARROMIN(11, 253, 254, 203, 204), HARRALANDER(20, 255, 256, 205, 206), RANARR(25, 257, 258, 207, 208), TOADFLAX(30, 2998, 2999, 3049, 3050), IRIT(40, 259, 260, 209, 210), AVANTOE(48, 261, 262, 211, 212), KWUARM(54, 263, 264, 213, 214), SNAPDRAGON(59, 3000, 3001, 3051, 3052), CADANTINE(65, 265, 266, 215, 216), LANTADYME(67, 2481, 2482, 2485, 2486), DWARFWEED(70, 267, 268, 217, 218), TORSTOL(75, 269, 270, 219, 220); private int idLevel, unnotedCleanId, notedCleanId, unnotedGrimyId, notedGrimyId; Herb(int idLevel, int unnotedCleanId, int notedCleanId, int unnotedGrimyId, int notedGrimyId) { this.idLevel = idLevel; this.unnotedCleanId = unnotedCleanId; this.notedCleanId = notedCleanId; this.unnotedGrimyId = unnotedGrimyId; this.notedGrimyId = notedGrimyId; } public static Herb get(int index) { for (Herb h: values()) if (index == h.ordinal()) return h; return null; } public int getUnnotedGrimyId() { return unnotedGrimyId; } public int getIdLevel() { return idLevel; } public int getUnnotedCleanId() { return unnotedCleanId; } public int getNotedCleanId() { return notedCleanId; } public int getNotedGrimyId() { return notedGrimyId; } public String getName() { return name().charAt(0) + name().substring(1).toLowerCase(); } public boolean canIdHerb(int currentLevel) { return currentLevel >= idLevel; } }
  16. i don't know about threads too much. That's will be the next thing ill learn. But i'm as modify the arraylist. ill try that out later. Ill elt you know how it goes
  17. I'm trying to remove a string from an array list but I'm getting an exception. I forgot with one it was. I looked it up and they said I need to iterate it from the array list. But it doesn't seem like its what I want to do with it. Any suggestions?
  18. will do, ill let you know when im done, ill let you point out my grammar problem. and ill fix thanks
  19. my first language is Spanish. and once im done with my topic i re read and fix my grammar. I appreciate criticism
  20. i know the topic is unfinished
  21. that will be coming up next, after i finish teaching them how to create them . And also ill be teaching them like little handy tricks you could do with enums
  22. Credits to @Divinity for letting me use his enum as an example Example: (I will be using this enum through out the whole tutorial, the variable will be shorten down to make space). public enum ThievingNPC { MAN("Man", 1), FARMER("Farmer", 10), FEMALE("HAM Female", 15), MALE("HAM Male", 20), HAM_GUARD("HAM Guard", 20), WARRIOR("Al-karid Warrior", 25), ROGUE("Rogue", 32), MASTER_FARMER("Master Farmer", 38), GUARD("Guard", 40), PALADIN("Paladin", 70), GNOME("Gnome", 75), HERO("Hero", 80), ELVE("Elve", 90); private String name; private int lvl; ThievingNPC(String name, int lvl){ this.name = name; this.lvl = lvl; } public String getName(){ return name; } public int getLevel(){ return lvl; } } What’s an Enum? An Enum is a data type, just like an interface and class. Enums and Classes consist of some similar characteristics, for example: constructor and some general methods. But the most unique things about Enums would be that they allow you to pre-define constants, which then allow you to access them at any time. What’s a Data Type? So a Data Types would be consider something like: Int, String, Boolean etc.. So what I’m trying to say, is that your allowed to create methods out of an Enum. You’re allowed to use them, like you would in an argument, constructor, and even a method. Example: public void something(Enum name) { } public EnumName somethingElse() { return enumVariable } Parts of an Enum: (in order) Example: //variables //private fields //Enum constructor //setters & getters methods //your own custom methods How to create an Enum: When you want to create an Enum, you will start off with a modifier (optional). Followed by the key word “enum”, then after follows the name of the Enum. Finally end it with brackets “{ }” Example: public enum ThievingNPC { } Enum Conventions: Naming the Enum: You must capitalize the first letter in every word (no spaces ). Example: //The only reason why my enum is called ThievingNPC, and npc is in all caps is because it is an acronym ThievingEnum YouGetItNow Naming Variables: You must capitalize all letters, and you must replace all spaces with underscores (“_”). Example: ROGUE MASTER_FARMER Adding in variable (use Conventions): This is where the fun begins. Now you are allow to add in as many variables as you want. Just know that after every variable you end it with a coma “,”. But at your last variable it must end in a semicolon “;”. Example: MAN(), HAM_GUARD(); More important info about variables: Once you create your variables, if you decide not to add any predefined constants (hence the infomation in between the parenthesis after the variable name), then you dont need to addin the parenthesis. The parenthesis are meant to help organize what information goes with which variable. Example: (this is part of my Magic Manager snippet) "If you dont understand then dont worry this isnt that important". public static enum Rune { STEAM, MIST, MUD, LAVA, SMOKE, DUST, EARTH, FIRE, WATER, AIR, ASTRAL, BLOOD, BODY, CHAOS, COSMIC, DEATH, LAW, MIND, NATURE, SOUL; @Override public String toString() { return super.name().toLowerCase() +" rune"; } } How to create Constructor: Optional adding a modifier. With Enum you’re not allowed to use the “public” keyword modifier. Since Enum variables are static. Use the Enum name followed by Arguments. Your constructor Argument must match the arguments within the variables. and end with brackets “{ }”. Example: MAN("Man", 1), FARMER("Farmer", 10); ThievingNPC(String name, int lvl) { } What to do within the Constructor: You must first create some private fields. Then make your Constructor argument equal those private fields. Example of the key word this: link Example: public enum ThievingNPC { MAN("Man", 1), FARMER("Farmer", 10); private String name; private int lvl; ThievingNPC(String name, int lvl){ this.name = name; this.lvl = lvl; } } Creating Methods: Since your fields are private you need some sort of way to be able to access the values. So this is where you would create your getter methods. Also any other custom method you would need. Example: public enum ThievingNPC{ MAN("Man", 1), FARMER("Farmer", 10); private String name; private int lvl; ThievingNPC(String name, int lvl){ this.name = name; this.lvl = lvl; } //from here and below are where you put your methods at public String getName(){ return name; } public int getLevel(){ return lvl; } } Some Default Enum Methods & Returns: These are some of the default methods that Enum's come with. There's many more, but these are the important ones, and the ones i like to use . *Format: (method name, return type) //comment if any. values(), Returns: an array of your enum variables. //Static valueOf(String s), Returns: an enum variables. //Static compareTo(E o), Returns: the distance between the two enum variable, using there ordinal(). ordinal(), Returns: the index in of the enum variable. name(), Returns: the exact enum variable name. toString(), Returns: the exact enum variable name. // if toString() isnt overrided. toString(), Returns: what ever you told the method to return. // if toString() is overrided. How to access the Enum and there variables (in order): Start with, the Enum name. followed by, the variable name. then, end with the method. Which returns the method. Example: ThievingNPC.MASTER_FARMER.getLevel(); Returns: 38 End of part one, beginner guide. Link to part two: link not yet ready
  23. Joseph

    AccuXP - [API]

    its isnt really to special, especially for people who know how to code this. This is really meant for those who have trouble with painting graphic on script. They could use this to study, learn, and experiment.
×
×
  • Create New...