Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

My players direction

Featured Replies


    public enum Direction    {
        SOUTH(0),
        SOUTH_WEST(256),
        WEST(512),
        NORTH_WEST(768),
        NORTH(1024),
        NORTH_EAST(1280),
        EAST(1536),
        SOUTH_EAST(1792);
        
        private int index;
        
        Direction(int index)    {
            this.index = index;
        }
        
        public static String toString(int index)    {
            for (Direction d: values())    {
                if (index == d.index)
                    return d.name().replace("_", " ").toLowerCase();
            }
            return null;
        }
        
        public static String toString(Direction d)    {
            return d.name().replace("_", " ").toLowerCase();
        }
    }
You simply have to use my players "getRotation()"

 

example:

log("" +Direction.toString(myPlayer().getRotation()));

pictures example: it wont let me add picture sad.png

 

http://puu.sh/7nqGB

 

http://puu.sh/7nqHw

 

http://puu.sh/7nqI6

 

Edited by josedpay

  • Author

I would overload the toString and have it take a direction enum as well.

 i was actually doing that now for my script. ill add it in a bit

 

edit: added it in

Edited by josedpay

I'm not sure if your using the toString() correctly, I don't believe you should have a input in the constructor. Shouldn't it be something like:

   @Override
    public String toString() {
        final String s = super.toString().replace('_', ' ');
        return s.charAt(0) + s.substring(1,s.length()).toLowerCase();
    }

And to call toString you would simply call:

log(Direction.NORTH.toString());
//Outputs: North 

Edited by NotoriousPP

  • Author

 

I'm not sure if your using the toString() correctly, I don't believe you should have a input in the constructor. Shouldn't it be something like:

   @Override
    public String toString() {
        final String s = super.toString().replace('_', ' ');
        return s.charAt(0) + s.substring(1,s.length()).toLowerCase();
    }

And to call toString you would simply call:

log(Direction.NORTH.toString());
//Outputs: North 

if you want to be all fancy you could do that with your toString(). i was just to lazy to do that. Also, the only reason why i put an argument inside the parameter because without, you wouldnt know which direction you are facing, without using player#getRotation. That the point of having toString a static method. So when you call the enum you could use that method. With out having to choose one of the actual enum option, and since you have a argument, you could simply add in your player getRotation().

 

for example: instead of doing this

  • log(Direction.NORTH_WEST.toString());
  • log(Direction.SOUTH.toString());
  • log(Direction.EAST.toString());
  • log(Direction.NORTH.toString());

you could do 

  • log(Direction.toString(myPlayer().getRotation()));

     
Guest
This topic is now closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.