ID:157357
 
Okay so when you add an object to the screen and you add it out of the screen boundary(like if you set the screen_loc = "-5,5" for the object) it stretches the screen out to see that object with everything else that you previously could see. Is there a way to set it so that the screen stays the same and doesn't stretch out with the object still being there?
ShawnLee wrote:
Is there a way to set it so that the screen stays the same and doesn't stretch out with the object still being there?

If you want to view something that would be out of your viewable range, how would you view it without increasing the view? If I understand you correctly, what you want is not just unavailable in Byond, but it is physically impossible.

You have to translate your view area to include the location you want to see, or translate what you want to see so that its location is within your viewing area, or display what you want inside the viewing area even though it's not in that area (perhaps put it on the edge of the view area closest to where its actual location is), or increase the size of the viewing area.
In response to Loduwijk
I think he's saying your screen stretches already to include the object that would otherwise be at the negative coord?

If so, just put the object on the same coord as another, but if you don't want people seeing it, set its invisibility setting instead of throwing it off the map.

If it doesn't have to be on a certain z-level either, then you could also just have its location set to null, meaning don't set it, or set it to null explicitly.
In response to Dan0971
Dan0971 wrote:
I think he's saying your screen stretches already to include the object that would otherwise be at the negative coord?

Yes, that is how Byond handles it. If you don't do anything to change the behavior (that is, you leave the location as-is and try to display it out of bounds), the view will stretch to include the location.

This is how it handles displaying objects in the client.screen list. Since it doesn't forcibly show anything else that you couldn't normally see, there aren't any other conditions that I can think of at the moment where this behavior occurs.

This will also happen if you put an object out of the visual range on the positive side. For example, if you have a view of 5, adding an object to your client's screen list and setting screen_loc="-1,1" will display something on the bottom of your screen, but it will stretch the map view one tile to the left and display the object at the bottom of that newly-visible column of tiles. But since your view is 5, normally you have a visual range of "1,1" to "11,11" If you add an object to the screen list and set screen_loc="13,12" it will stretch the map view two tiles to the right and one tile up so you now have 2 more visible columns of tiles off to the right and 1 more visible row at the top of your view, and the newly displayed screen object will be shown at the very upper-right corner of it all.

If so, just put the object on the same coord as another, but if you don't want people seeing it, set its invisibility setting instead of throwing it off the map.

Why would you put it at the same coordinate as another object? Why would you not want someone seeing it, as that would defeat the purpose of adding it to the screen list?

If it doesn't have to be on a certain z-level either, then you could also just have its location set to null, meaning don't set it, or set it to null explicitly.

Based on the original poster's explanation, I'm not sure whether or not he has the object on the map at all. Quite often objects on the map are not also in a client's screen list, in which case its location would be null.

I think the OP needs to further clarify the problem.
Okay here is an example:

http://i257.photobucket.com/albums/hh219/leeasakura1/ Robopon2010-03-27142135.png

And if I add an object outside the boundary it'll do this

http://i257.photobucket.com/albums/hh219/leeasakura1/ Robopon2010-03-27141958.png

I want the object to still be out there, but the screen to not stretch and stay the same so it'll look like the first screenshot. If that's isn't possible then I'll just do what I was gonna do a different way.
In response to ShawnLee
ShawnLee wrote:
I want the object to still be out there, but the screen to not stretch and stay the same so it'll look like the first screenshot.

So you want the arrow to be completely off of the screen so that you can't see it. That is, you can't see it by virtue of it being out of the viewable area, but it's still in the client's screen list?

I don't think that's possible. If you want it to be this way because the arrow will move around and will eventually be in view, your best bet is to just add/remove it to/from client.screen as it enters or exits the viewable area.
clientViewable
var
x
y
obj/viewedObject

New(obj/newViewedObject, newX, newY)
setViewedObject(newViewedObject)
screen_loc(newX, newY)

// attach this to an object we want to manage
proc/setViewedObject(obj/newViewedObject)

// if changing viewedObject, we don't want to have the new object share the same screen_loc
if(viewedObject)
x = null
y = null

viewedObject = newViewedObject

// change screen_loc
proc/screen_loc(newX, newY)

// don't update if there's no viewedObject
if(!viewedObject)
return

x = newX
y = newY
update()

// separate updating to its own function so we can call it other places if need be
// we might want to use this if we change the client's view, for example; otherwise, don't use it
// supply optional view size, otherwise default to world.view
proc/update(viewSize = world.view)

// don't update if there's no viewedObject
if(!viewedObject)
return

if(x >= 1 && x <= viewSize*2+1 && y >= 1 && y <= viewSize*2+1)
viewedObject.screen_loc = "[x],[y]"
else
viewedObject.screen_loc = null

With this, you don't ever have to worry about the range. You can do stuff like the following.
proc/myProc(client/C)
var/obj/myScreenObject/O = new
var/clientViewable/V = new(O)

C.screen += O

V.screen_loc(-5, 10)

And the object just would not show up if it was out of bounds.

You could even give all objs their own variable for this.
obj
var/clientViewable/viewable

Then you could have it reference a clientViewable for any of them which were supposed to be managed by that, then you would just always call object.viewable.screen_loc(X, Y)
In response to Loduwijk
That's kewl but I just found out how to do it.

I just set the pixel off the screen and it works the way I want it too.

Thank you everyone that helped.
In response to ShawnLee
I am glad to hear you got it solved, but it sounds like you were trying to do something useless that did nothing, by you saying you changed the pixel offset to be offscreen?

If you wanted it acting per person you would add it as HUD, or as image() and just remove or add the HUD item/image as needed.

Especially if it's not often used, and only like at login or something, but it might be OK if it is used often. You would however not want the extra item, even offscreen, if it is not used after login.