How to Properly use .activate();

Discussion in 'Developer Support' started by DesignDecay, Jun 20, 2015.

  1. I'm trying to change the spell being used with the following.
    Instead of switching the spell it goes to the magic book and goes to the teleport category.
  2. @Cloud possible Client issue?
  3. Based on how hard I am wrestling with this API I would think it more likely my implementation.
  4. Possibly, but something like this would indicate a logic flaw more than a misunderstanding. Is there anywhere in your code where the teleport category would be opened?

    .activate() activates the spell if the category is open, or if it is not open, then it opens the category, which allows the next loop to select the spell.
  5. Code (Text):
    1. public class ahrim extends Task {
    2.     @Override
    3.     public boolean validate() {
    4.         return true;
    5.     }
    6.     @Override
    7.     public void execute() {
    8.         Powers.Magic.FIRE_WAVE.activate();
    9.     }
    10. }
    Not that I can see.
  6. Hmmm, true.

    Also, check up on the Java Conventions pls :p
  7. Add some debugging to make sure this is where in the code it's going. If you confirm then this is a problem to elevate to @Cloud.
  8. I come from a mostly embedded background. I know AVR and ARM assembly as well as C, but other than some Python this is my first crack at an OOL. So, please bear with me as I learn the ropes. Is there something, in particular, that's bugging you and is there a convention paper I should check out?

    Sure, is there a preferred way of doing that?
  9. You use ahrim - By java conventions, Class names are mixed case, beginning with a capital character followed by lowercase until another verb/name is hit. So it would should be public class Ahrim or public class ActivatePrayer
    DesignDecay likes this.
  10. Class names are PascalCase, variables are camelCase, constants are ALL_CAPS, resources and package names are lower_case :p
    Conventions are just a pet peeve of mine xD
  11. Fair enough. I went forward with development, but I still haven't gotten this to work properly. What debug information would be helpful to solving this?
  12. just a system out confirming that the code block is being entered, and maybe also the value that the method returns
  13. Here is a stripped down main class that exhibits the same behavior
    Code (Text):
    1. package com.designdecay.barrows;
    3. import;
    4. import com.designdecay.barrows.Ahrim;
    6. public class Barrows extends TaskScript {
    7.     @Override
    8.     public void onStart(String... args){
    9.         add(new Ahrim());
    10.     }
    11. }
    Here is the referenced class
    Code (Text):
    1. package com.designdecay.barrows;
    3. import;
    4. import;
    6. public class Ahrim extends Task {
    7.     @Override
    8.     public boolean validate() {
    9.         return true;
    10.     }
    11.     @Override
    12.     public void execute() {
    13.         Powers.Magic.FIRE_BOLT.activate();
    14.         System.out.println("Ahrim");
    15.     }
    16. }
    It reaches the code block properly, but it doesn't select the spell. I still think this is a failure on my part, but I can't for the life of me figure out how to use it properly.
  14. It may not be. We may have wired something wrong. @Cloud please investigate?
  15. Pretty sure it's a problem within the API, I had a similar problem with Magic Imbue a while back
  16. Possibly related. I can't seem to get prayer to work either.
    Code (Text):
    1. Powers.Prayer.PROTECT_FROM_MELEE.toggle();
    This opens the prayer tab and then doesn't activate the prayer.
  17. Hmmm, it sounds like it's doing half of the expected behaviour.
    Each call it either activates the prayer if it's not open, or it opens the tab if it's not.
    Try chucking the prayer on your action bar and see if that changes any thing
  18. Looks like to some extent this is my fault. One of the checks I was doing was checking interface mode instead of combat mode which resulted in some odd behavior. I'm working on making it work in modern combat mode on legacy interfaces as I type this.

    Edit: Should now work fine :)
    #18 Cloud, Jun 24, 2015
    Last edited: Jun 24, 2015
  19. Thank you. Magic is working properly, however prayer is still malfunctioning. I am testing using a modern interface and a legacy combat mode. Also, is there a preferred way of handling a duel wield wand and book? Currently, it attempts to change the spell, but doesn't select main hand or off hand.
  20. Prayers are working fine for me on that setup, you are using the normal spellbook correct? Also I'm not familiar with what you're talking about in your last sentence.

Share This Page