Jump to content

roguehippo

Members
  • Posts

    157
  • Joined

  • Last visited

  • Feedback

    0%

Posts posted by roguehippo

  1. Hello all :) after a bit of a break from coding to due finals and stuff I am back practicing scripting. I am trying to Define an area and it just says that "The method Area(int, int, int, int) is undefined for the type main". the exact line is just this:

     

    public Area AreaName = Area(2582,9493,2594,9484); 

     

    i'm starting to wonder if the constructor for Area has been changed since i last used it. am i doing something wrong.

  2. Just a shot outta the dark... but are you initializing your GUI before the player is logged in?

     

     

    umm i think the player is ussually logged in but this happens no matter what

    I had the same issue when making my script.

    Read this thread

    http://osbot.org/forum/topic/104466-grabbing-myplayers-start-area-with-gui/ 

    ohh i think thats exactly what my problem is, i have to pass "script" in with the gui? is that as simple as just adding in the Gui(Script script) instead of gui(). How should i add the script into the gui when im calling it from onStart()?

  3. hey guys, im having a bit of a problem when it comes to accessing the players information from inside of the gui class. currently it gives me a null pointer when i use something like myPlayer().getPosition even though i have called 

     

    MethodProvider m;
    public Gui (MethodProvider m){
           this.m = m;
       } 
     
    the exact code causing a problem is here:
     
     FightArea = m.myPlayer().getArea(Integer.parseInt(TileRadius.getText()));
     
    its just making an area with a defined radius from a textfield.
     
  4. i was thinking that, should i just take requests on what items to put in them when the time comes

     

    but now that im implementing it, i see that for ammunition like arrows theres so many arrows and bolts, then multiply it by 3 because of poison and add more because of all the enchanted bolts it would just be easier for the player to enter whatever they are using 

  5. my gui class seems to not be able to use myPlayer().getlocation effectively because i always just get a null pointer when the code executes.

    this is the snippet of code

     

    JButton SetSpotButton = new JButton("Set Safe Spot");
    SetSpotButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent arg0) {
    if(CustomSpotButton.isSelected())
    {
    SafeSpot = m.myPlayer().getPosition();
    }
    }
    });
    if the button is pressed and a checkbox is checked to use the method then it tries to save the tile i am standing on.
     
    also my "m" is a global in my gui so i dont know why its not working :(
    MethodProvider m;
    public Gui(MethodProvider m){
           this.m = m;
       } 

     

  6. in the gui design window i test it and it looks fine but it wont work on osbot i tried giving the object more room and making the panel bigger but it wont work

     

    is there a max height osbot lets a gui be?

     

    edit 2: ive been messing with some stuff and when changing the layout of the Food Bank panel makes different amount of boxes show up for each layout. is there a way to fix this

     

    edit 3: after removing the "eat at" label and the percent typing box it magically works. on to the next problem

  7. hello, i have recently run into a problem with my gui not showing up and i cant seem to find out why. i dont really know where it is breaking because there are no errors. i was wondering if anyone has experienced this or would know what is going wrong.

     

    here is what it looks like now https://gyazo.com/dc5a3afa0fda0b0ba8488cbba0283130

     

    here is what it is supposed to look like https://gyazo.com/1780f74135709cc60879262acd86477f

     

    and here is what it looks like in eclipse windows builder (what im using to make it all)     https://gyazo.com/3be9359f67b70ee409933ee5963dc488

     

    i havent really made too many changes to the gui code by hand so i dont know what the problem could be. sorry if my details are too vague

     

    it also stops my program from ever starting. :(

  8. facep.gif facep.gif facep.gif facep.gif  i forgot about onPaint... i havent coded in like all summer. my b


    public class GodWarsDungeon extends Script { 
    private Position position = new Position(0,0,0); // obviously have the correct co-ordinates
    //in your onPaint do this
     
    @[member='Override']
    public void onPaint(Graphics2D g) {
    g.draw(position.getPolygon(bot));
    
    
    
    }
    

    The reason why graphics did not resolve was because by default your onPaint(Graphics2D g) is set at g so you can change that to whatever you want :P (the g part)

     

    this is a function i made to color the tiles of an area. im wondering if this is going to work, the only thing im worried about is it had me automatically set g2 = null. does it have to be something else? i havent tested it yet 

     

    public void drawArea()
    {
     
     
    if(gui.ShowOverlay == true )
            {
    Graphics2D g2 = null;
          
    g2.setColor(Color.WHITE);
    log("drawing tiles");
    for(int i = 0;i < FightArea.getPositions().size(); i++ )
       {
        Polygon poly = FightArea.getPositions().get(i).getPolygon(bot);
        g2.draw(poly);
       }
            }
     
    }
  9. what is the best way to highlight a tile. im trying to iterate through a list of positions but when i try to use g.drawPolygon (as suggested by other threads on the forum) it just gives me a red underline and sys drawpolygon is undefined. did they change how tiles are highlighted? thanks!

    edit for visibility of the real problem i need help with still :(

    ---------------------------------------------------

    my gui class seems to not be able to use myPlayer().getlocation effectively because i always just get a null pointer when the code executes.

    this is the snippet of code

     

    JButton SetSpotButton = new JButton("Set Safe Spot");
    SetSpotButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent arg0) {
    if(CustomSpotButton.isSelected())
    {
    SafeSpot = m.myPlayer().getPosition();
    }
    }
    });
    if the button is pressed and a checkbox is checked to use the method then it tries to save the tile i am standing on.
     
    also my "m" is a global in my gui so i dont know why its not working sad.png
    MethodProvider m;
    public Gui(MethodProvider m){
           this.m = m;
       } 
     

     

  10. To describe the problem i have right now, my bot is supposed to walk somewhere and then do an action. it works fine apart from the fact that it has to finish the webwalking event and then after stopping for a second it then does the action. What im trying to do is have it do the action around 5 - 0 tiles away from the object. i even have the webwalking event inside a while loop  "while(myPlayer().distance from object is greater than 5" yet it still waits for the whole event to finish. i was wondering if it is possible to stop the event around when in a certain distance from the point it is walking to.

  11. I usually spam the Scripting Help topics faster than this, the isUnderAttack() and isFighting() methods are a bit vague in my opinion and they aren't exacly what scripters expect, same for getInteracting() as when you stop interacting you are still in combat. There is, however, a more reliable method, namely Character#getCombatTime(). You will have to work with client cycles instead of raw time and instead verify for a given diference in client cycles since last hitsplat which determines if a given Character (don't forget Player extends Character, not only NPC). I know this works for ranged and melee which always yield a hitsplat onhit therefore updating the combat time of that Character instance. For magic however (range too if you want maximum accuracy), you can rely on the Projectiles class. If a projectile is sent from a Character, means that Character is definately attacking someone and their target is locked in combat.

    i will definitely look into the more in depth way instead of just using underattack as you are right they are a bit vague. thanks for the responce, hopefully i can make my script as perfect as possible for the community!

×
×
  • Create New...