ID:2398147
 
(See the best response by Kaiochao.)
Hey everyone!, I know this is a dumb question. but I'm trying to learn the dm language and I wrote the code for chat like this.

Code:
Mob
Verb
Say(msg as text)
World << [usr]: [msg] in oview()


But all the chat codes I have seen leaves out the oview(). So my question is this
If I funnel [usr]: [msg] to world, then the oview() wouldn't be needed?. Sorry for a silly question
Just trying to really learn the dm rather then remembering the codes.

Problem description:

Best response
The operator
A << B

is defined such that B is outputted to A.

When you see world << "[usr]: [msg]", A is world and B is the single string of text between the quotes (with the expressions inside the brackets replaced with their text equivalents).

If you want to send that string of text to oview() instead, so that only things nearby and visible to usr receive the output, simply use oview() instead of world.

There's no "chat codes" you could have seen that end with "in oview()" because that is nonsense, doesn't do what you think it does, and you should have never come up with it in the first place.

From DM References:
view proc

Format:
view(Dist=5,Center=usr)

Returns:
A list of visible objects within Dist tiles of Center.

Args:
Dist: A number.
Center: An object on the map.
A Dist of 0 includes Center, the contents of Center (normally usr.contents), its location (normally the turf a mob is standing on), and any other contents of that location. A value of 1 extends the region to the neighboring squares on the map and so on. Both arguments are optional and may be passed in any order.

The default range is actually controlled by the size of the map viewport size, which is configured with world.view. Since the default value of that variable is 5, the default range is also 5. You may use any valid view size, so an explicit view size such as "11x17" is also valid.

Example:
view() << "to all in sight of [usr]"
view(src) << "to all in sight of [src]"
view(1,src.loc) << "to all within reach of [src]"
Be aware of the following distinctions:

view(usr) //objects that usr can see
view(usr.loc) //objects visible from usr's position
view(usr.client) //objects visible to player
In many cases, the three different statements could produce the same result, but they are not identical in general. For example, the first statement takes into account the visual capabilities of usr, which might include such things as the ability to see in the dark or to see invisible objects.

The second statement, since it is from a non-mob would just do a plain visibility calculation with no special visual capabilities. In many cases, you would want to use viewers() or hearers() instead.

The third statement produces a list of visible objects as the player sees things, which might be different than how the mob sees things if client.eye and client.mob are different.


view is similar to oview except it doesn't include Center or its contents in the list.

In response to Kaiochao
I understand it sounds like nonsense to you but how I understood it was. As long as I didn't clarify the number of squares by adding a number in oview
Like "oview(4)" then it translated to showing everyone but now I know I'm mistaking, and it just shows everyone on screen. I know it was a dumb question I'm just trying to really learn this language to the best of my abilities And asking silly questions is how I do so.

Thanks for you're response.
In response to Marekssj3
Thank you so much, that will help me a lot!. I'm going to study over this.
Byond needs more people like you. Keep up the work!.