1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Resolved combat options

Discussion in 'Developer Support' started by LorM, May 25, 2019.

  1. LorM

    Joined:
    May 16, 2019
    Messages:
    18
    Likes Received:
    6
    I haven't found if this was already implemented or if I had to do it from scratch.

    It seems you can open the COMBAT_OPTIONS menu, but you can't select an attack mode or change it. For instance, change from "Stab" to "Slash" or "Defend" and such.

    I was wondering if that was already implemented or if I had to do it myself. And if it's already implemented, where is it? I can't seem to find it in the documentation, but I'm not yet very familiar with it.

    EDIT:

    I've hacked a solution, though I'm far from sure that's how it's supposed to be done. Presuming I'm not supposed to change to the tab, scan through all the interface until I find the right button, and click it.

     
    #1 LorM, May 25, 2019
    Last edited: May 25, 2019
  2. Best Answer:
    Post #4 by Jhinn, May 27, 2019
  3. Fabreze

    Fabreze #1 Fabric Cleaner

    Joined:
    Mar 18, 2017
    Messages:
    388
    Likes Received:
    106
    I believe the there is no method within the API to change combat modes but you can implement a method very easily. Just use visual developer or interface explorer to see exactly what the interfaceconainer and interfacecomponent are and do it from there. You will have to deal with interfaces at one point so it might as well be now!
     
  4. LorM

    Joined:
    May 16, 2019
    Messages:
    18
    Likes Received:
    6
    Yeah, for now I did a very hacky thing that works, but because I'm not sure of how exactly it's being implemented on the API side, I'm not even sure if it's safe. I did that quick thing just to see if it worked - it did. But yeah, if I ever feel like it's very important, I'll re-visit it and make sure I'm doing it in a safer way if possible.



    for(InterfaceComponent ic : Interfaces.getLoaded()){
    if(ic.getText() != null){
    String txt = ic.getText().trim().toLowerCase();
    if(txt.equals(mode)){
    System.out.println(mode+" FOUND");
    ic.click();
    break;​
    }​
    }​
    }


    PS: How do I write code in here without going through the pain of manually indenting it?
     
  5. Jhinn

    Joined:
    Jun 9, 2015
    Messages:
    3,646
    Likes Received:
    1,337
    Use queries to get the right interface. See here. They're easy to use and much more efficient.
     
  6. LorM

    Joined:
    May 16, 2019
    Messages:
    18
    Likes Received:
    6
    Yeah, I've used them at quite a few places so far, didn't know they worked in interface too. That solves that then. Thanks a lot!
     
    Jhinn likes this.
  7. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    I have an API for the entire combat options tab that will be going in the xapi very soon.
     
  8. LorM

    Joined:
    May 16, 2019
    Messages:
    18
    Likes Received:
    6
    Awesome! Yeah, I dealt with it in the end using the Interface API. Ended up a learning experience anyways. Thank you!
     
    Fabreze likes this.
  9. Occult

    Joined:
    Oct 8, 2017
    Messages:
    1
    Likes Received:
    0
    Wow can't wait. Must be a big update!
     
  10. Chieftain

    Chieftain The only AI bot developer

    Joined:
    Mar 26, 2016
    Messages:
    166
    Likes Received:
    43
    Grave digger.
     

Share This Page

Loading...