Cyber Syndicate
<center><p style='font-size:120%;'><strong>Welcome to Cyber Syndicate!<strong></p>

You are visiting as a guest; please <strong>register</strong> or <strong>log in</strong>.

Being logged in provides many benefits, including access to the useful <strong>Methods forum</strong>, posting permissions, and voting permissions.

<strong>Enjoy.</strong></center>
Cyber Syndicate
<center><p style='font-size:120%;'><strong>Welcome to Cyber Syndicate!<strong></p>

You are visiting as a guest; please <strong>register</strong> or <strong>log in</strong>.

Being logged in provides many benefits, including access to the useful <strong>Methods forum</strong>, posting permissions, and voting permissions.

<strong>Enjoy.</strong></center>
Cyber Syndicate
Would you like to react to this message? Create an account in a few clicks or log in to continue.



 
HomeLatest imagesRegisterLog in

 

 Some functions with Tiles

Go down 
2 posters
AuthorMessage
pqqqqq
Member
Member



Posts : 5
Join date : 2011-02-27

Some functions with Tiles Empty
PostSubject: Some functions with Tiles   Some functions with Tiles Icon_minitimeWed 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 Smile
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!
Back to top Go down
b0xb0x
Administrator
Administrator



Posts : 130
Join date : 2011-02-25
Age : 28
Location : California

Some functions with Tiles Empty
PostSubject: Re: Some functions with Tiles   Some functions with Tiles Icon_minitimeThu Mar 17, 2011 8:07 am

Pretty awesome Smile API update? ;D
Back to top Go down
https://cybersyndicate.forumotion.com
pqqqqq
Member
Member



Posts : 5
Join date : 2011-02-27

Some functions with Tiles Empty
PostSubject: Re: Some functions with Tiles   Some functions with Tiles Icon_minitimeSat 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...
Back to top Go down
b0xb0x
Administrator
Administrator



Posts : 130
Join date : 2011-02-25
Age : 28
Location : California

Some functions with Tiles Empty
PostSubject: Re: Some functions with Tiles   Some functions with Tiles Icon_minitimeSat 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 Very Happy
Back to top Go down
https://cybersyndicate.forumotion.com
pqqqqq
Member
Member



Posts : 5
Join date : 2011-02-27

Some functions with Tiles Empty
PostSubject: Re: Some functions with Tiles   Some functions with Tiles Icon_minitimeSun 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/6i6iktpq

If 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)
Back to top Go down
b0xb0x
Administrator
Administrator



Posts : 130
Join date : 2011-02-25
Age : 28
Location : California

Some functions with Tiles Empty
PostSubject: Re: Some functions with Tiles   Some functions with Tiles Icon_minitimeSun Mar 20, 2011 3:31 pm

That's awesome, it walks to ANY of those locations?? :O
Back to top Go down
https://cybersyndicate.forumotion.com
pqqqqq
Member
Member



Posts : 5
Join date : 2011-02-27

Some functions with Tiles Empty
PostSubject: Re: Some functions with Tiles   Some functions with Tiles Icon_minitimeSun 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
Back to top Go down
Sponsored content





Some functions with Tiles Empty
PostSubject: Re: Some functions with Tiles   Some functions with Tiles Icon_minitime

Back to top Go down
 
Some functions with Tiles
Back to top 
Page 1 of 1
 Similar topics
-
» So you need some id's, tiles, paths, npcs, objects?

Permissions in this forum:You cannot reply to topics in this forum
Cyber Syndicate :: Development :: Methods-
Jump to: