ID:271717
 
How do i make it so that when you look through binoculars you see about 15 spaces forward whichever way you are facing. Would it be something like this.

North()
usr.client.eye = loc.x += 15


I'm not very good with doing this type of code but I would like to learn so if can someone please tell me how to do it correctly. That would be great.
Since the client.eye variable is an actual object, that means you must set eye to an actual instance. You can use locate() to get the turf given the x y and z parameters. You can grab 15 tiles north of you by calculating your coordinates, and adding 15 tiles to the y.

// called on client/North(), client/South(), etc...
// setting the client's eye center to 15 tiles north
src.eye = locate(src.mob.x, src.mob.y + 15, src.mob.z)


There is one major problem with this, though. If you are less than 15 tiles away from the top of the map, your screen will black out, since nothing exists above the top of the map. What you can do is write a proc (or use a library) that doesn't let it step out of bounds. AbyssDragon's BasicMath library (http://developer.byond.com/hub/AbyssDragon/BasicMath) has a get_steps() proc that returns the turf in a given direction in a given amount of tiles.

// called on client/Move()
// using AbyssDragon's BasicMath library
src.eye = get_step(src.mob, src.mob.dir, 15)
I checked out that and i looked at it but it didn't make to much sense to me, is there anyway you can describe it differently please?