|
| | Some functions with Tiles | |
| | Author | Message |
---|
pqqqqq Member
Posts : 5 Join date : 2011-02-27
| Subject: Some functions with Tiles Wed Mar 16, 2011 10:10 pm | |
| I saw that some of these functions wern't made and should be, so here's the list: - getTilesOnMap()
- isTileOnProperMap(Tile t) (isTileOnMap is very glitchy at times, this method is waaaay easier.)
- isInCollision(Tile t) (Note: Little credit to Jacmob, sampled something (although I should be crediting Jacmob with everything RSBuddy related i make :P)
- mapToTile(Point p)
I will update this when I make new functions P.S. please tell me if getTilesOnMap() doesn't work, I didn't really test it fully, got lazy and expected it to work The code: - Code:
-
public static final int POINT_MAP_LEFTMOST = 553; public static final int POINT_MAP_RIGHTMOST = 700; public static final int POINT_MAP_UPMOST = 13; public static final int POINT_MAP_DOWNMOST = 158; public static final Point POINT_MAP_MIDDLE = new Point(627, 85);
public Tile mapToTile(Point p) { if (Calculations.isPointOnScreen(p)) return null; if (p.equals(new Point(-1, -1))) return null; if (p.x < POINT_MAP_LEFTMOST || p.x > POINT_MAP_RIGHTMOST || p.y < POINT_MAP_UPMOST || p.y > POINT_MAP_DOWNMOST) return null; int tilex = (p.x - POINT_MAP_MIDDLE.x) / 4; int tiley = (p.y - POINT_MAP_MIDDLE.y) / 4; return(new Tile(Players.getLocal().getLocation().getX()+tilex, Players.getLocal().getLocation().getY()+tiley)); }
public boolean isTileOnProperMap(Tile t) { return(!Calculations.tileToMap(t).equals(new Point(-1, -1))); } public boolean isInCollision(Tile t) { return(Walking.getCollisionFlags(Game.getFloorLevel())[t.getX() - Game.getMapBase().getX() - Walking.getCollisionOffset(Game.getFloorLevel()).getX()][t.getY() - Game.getMapBase().getY() - Walking.getCollisionOffset(Game.getFloorLevel()).getY()] > 0); } public Tile[] getTilesOnMap() { ArrayList<Tile> aTileList = new ArrayList<Tile>(); for (int i=-17;i<=17;i++) { for (int x=-17;x<=17;x++) { if (isTileOnProperMap(new Tile(Players.getLocal().getLocation().getX()+i, Players.getLocal().getLocation().getY()+x))) aTileList.add(new Tile(Players.getLocal().getLocation().getX()+i, Players.getLocal().getLocation().getY()+x)); } } return(aTileList.toArray(new Tile[aTileList.size()])); } Enjoy! | |
| | | b0xb0x Administrator
Posts : 130 Join date : 2011-02-25 Age : 28 Location : California
| Subject: Re: Some functions with Tiles Thu Mar 17, 2011 8:07 am | |
| Pretty awesome API update? ;D | |
| | | pqqqqq Member
Posts : 5 Join date : 2011-02-27
| Subject: Re: Some functions with Tiles Sat Mar 19, 2011 4:06 pm | |
| Thanks. If anyone is smart enough, you can meddle with these commands and create a iffy AIO Walker. I updated my "infamous" rWalkerP with it at the moment, but wont release it on RSBuddy because of the soon Web Walking.
However, if you can't figure it out, I guess i can post the code... | |
| | | b0xb0x Administrator
Posts : 130 Join date : 2011-02-25 Age : 28 Location : California
| Subject: Re: Some functions with Tiles Sat Mar 19, 2011 4:39 pm | |
| You should release the AIO Walker for now just because so many leeches are asking for it and they are annoying | |
| | | pqqqqq Member
Posts : 5 Join date : 2011-02-27
| Subject: Re: Some functions with Tiles Sun Mar 20, 2011 11:37 am | |
| I wont post it on RSBuddy, but if you want, I'll post it here right now. Idc if I give source, already given most functions and base of it (on PB) out, so might as well. Remember, this isn't perfect (and it looks a lot like AIO Walker PRO for some reason) http://pastebin.com/6i6iktpqIf anyone can find another way to sort a list of tiles by distance other than looping through and getting distance then sorting, then getting what tiles are at that distance, please tell me! Thanks!
Last edited by pqqqqq on Sun Mar 20, 2011 11:41 am; edited 1 time in total (Reason for editing : Added new link, fixed a function to make more random) | |
| | | b0xb0x Administrator
Posts : 130 Join date : 2011-02-25 Age : 28 Location : California
| Subject: Re: Some functions with Tiles Sun Mar 20, 2011 3:31 pm | |
| That's awesome, it walks to ANY of those locations?? :O | |
| | | pqqqqq Member
Posts : 5 Join date : 2011-02-27
| Subject: Re: Some functions with Tiles Sun Mar 20, 2011 3:42 pm | |
| You should try it out. So far, it obviously does not work with gates, but yea, if it's proper, and there's nothing in it's way (or it can get around) it'll work. EDIT: After some help from Zachafer, I learned how to compare properly without looping twice :P. The new new code: http://paste.strictfp.com/4115?key=0719ce547acc16d1619db376346cf2de | |
| | | Sponsored content
| Subject: Re: Some functions with Tiles | |
| |
| | | | Some functions with Tiles | |
|
Similar topics | |
|
| Permissions in this forum: | You cannot reply to topics in this forum
| |
| |
| |
|