ID:136245
 
Question is simple:
How do I change the ugly black blocks used with opacity to say a nice half transparent block? I wish to use opacity but not hide the terfs/areas completely, although I still want mobs/objects to be hidden.

Answer may be harder.

Thanks,
Salarn
This should be in Newbie Central, or maybe Design Philosophy...

Well, the easiest bit is making the player able to see turfs automatically. Just change the mob/sight var:

<code>mob sight=SEE_TURFS</code>

You can look <code>sight</code> up in the reference for more options.

Darkening the turfs is probably a little harder. The easiest way to do it is by using dithers, as BYOND has no support for partial transparency. I'd recommend trying out Shadowdarke's sd_DynamicAreaLighting library; it doesn't do exactly what you want, but as long as you don't use the <code>luminosity</code> var for anything else, you could simply set the player's luminosity var to some crazily high number like 1000, and making sure everyone else's luminosity var is set to 0 (the default).

Of course, the above paragraph won't work properly if it's a multiplayer game. If it is a multiplayer game, you'll have to do some fancy messing around with images or screen (HUD) objects.
In response to Crispy
I'm not sure if you understand what he means...
He wants to change the default "black" icon that is stuck on top of turfs you can't see.
In response to Jp
From my interpretation, he means that he wants turfs out of view to be visible, but half-transparent (in other words, dithered).

If you're so sure that he meant something else, why aren't you helping him? =P

(Just by the way... if you DO want to put something else in place of the black that both surrounds the map and is placed everywhere that's out of view, create a HUD object with a layer of zero, or even with negative layer, and set it to cover the whole screen - <code>screen_loc="SOUTHWEST to NORTHEAST"</code>)
mob
proc/UpdateSight()
/*
//Sight updating proc. If there are opaque objects moving around, call this for mobs that
//will have their sight blocked by it.
*/

if(!client) return //Don't want to use client if there is none!
client.images = null //Resets the images.
for(var/turf/T in orange(src.loc,client.view+2) - oview(src.loc,client.view+2))
/*
This subtracts the turfs in view from the list of turfs that are on the screen.
loc is used instead of src, because src's sight includes all turfs, and thus, it would
result in an empty list. I use client.view+2 to give a buffer, so that people moving
at high speeds don't lose some dithers as they move (try setting it lower. You'll see).
*/

var/image/I = new('Dither50.dmi',T) // Dither50.dmi is an icon that is 50% dithered.
src << I //Send the image.
Move()
. = ..() //Sets the default return value to what it would normally be.
UpdateSight() //And then updates the sight!

sight = SEE_TURFS


Tested and commented. You can get the Dither50.dmi file from my Dithering Icons hub entry, if you're too lazy to make it yourself.
In response to Crispy
Why aren't you helping him?
because I don't know how. (sentence stared with because! Bad grammer! AHH!)

With your idea opf having a screen object from end to end, it would still be their even if it is in view. You would have to remove it from client.images if you came in view.
In response to Garthor
No, that didn't work exactly how I wanted it to, but I think it pointed me in the right direction to make it work.

To clarify for everyone what I wanted to do
http://betaquest.muchneededrest.com/images/example.JPG

Left Column:
Currently how byond handles opacity

Middle Column:
Setup for all columns

Right Column:
Goal
In response to Jp
Jp wrote:
Why aren't you helping him?
because I don't know how.

Fair enough, I suppose. =P

With your idea opf having a screen object from end to end, it would still be their even if it is in view. You would have to remove it from client.images if you came in view.

Bzzzzt! Wrong answer, thanks for playing! The screen object has a layer UNDERNEATH everything else; so it won't be displayed unless the location is out of view (or off the map). Also, screen objects are in client.screen, not client.images.
In response to Salarn
And that's exactly what my snippet does.
In response to Crispy
Bzzzzt! Wrong answer, thanks for playing! The screen >object has a layer UNDERNEATH everything else; so it won't >be displayed unless the location is out of view (or off >the map). Also, screen objects are in client.screen, not >client.images.

Thanks for clearing that up. I don't play around with client.images or client.screen much.
In response to Garthor
Oh, yeah, it does...

Heh, missed a tab when I copied it.

Salarn