ID:140214
 
This problem has been solved/fixed thanks to Emasym
If some1 is interested on how it was fixed & how it's implemented into code refer to this post
http://www.byond.com/developer/forum/?id=743734

and thanks again Emasym ^.^

---------------------------------------------------------------------------
Code:
client/proc/FadeToBlack(mob/M)
M.client.screen += new/obj/Fade/black25
sleep(1)
for(var/obj/Fade/black25/o in M.client.screen)del(o)
M.client.screen += new/obj/Fade/black50
sleep(1)
for(var/obj/Fade/black50/o in M.client.screen)del(o)
M.client.screen += new/obj/Fade/black75
sleep(1)
for(var/obj/Fade/black75/o in M.client.screen)del(o)
M.client.screen += new/obj/Fade/black100
sleep(2)
client/proc/FadeToNorm(mob/M)
sleep(2)
for(var/obj/Fade/black100/o in M.client.screen)del(o)
M.client.screen += new/obj/Fade/black75
sleep(1)
for(var/obj/Fade/black75/o in M.client.screen)del(o)
M.client.screen += new/obj/Fade/black50
sleep(1)
for(var/obj/Fade/black50/o in M.client.screen)del(o)
M.client.screen += new/obj/Fade/black25
sleep(1)
for(var/obj/Fade/black25/o in M.client.screen)del(o)


obj/Fade
icon='HUD.dmi';name=""
black100
icon_state="black100"
layer = MOB_LAYER +1000
screen_loc="0,0 to 15,10"
black75
icon_state="black75"
layer = MOB_LAYER +1000
screen_loc="0,0 to 15,10"
black50
icon_state="black50"
layer = MOB_LAYER +1000
screen_loc="0,0 to 15,10"
black25
icon_state="black25"
layer = MOB_LAYER +1000
screen_loc="0,0 to 15,10"


Problem description:
If I put the "M.client.screen += new/obj/Fade/black25" and such directly in the code and not in a proc it works alright, but I can't figure out how to make the proc to be able to be able to be called.

If i set it to "mob/proc/FadeToBlack()" and then go "M.FadeToBlack()" in the call it runs but comes up with an error when triggered.

How do I get it to where I can just call a "FadeToBlack()" proc instead of repeating what I have in the proc in multiple areas?
Delete all the "M." (so M.client.screen becomes client.screen) and call the proc doing client.FadeToBlack()
In response to Emasym
Emasym wrote:
Delete all the "M." (so M.client.screen becomes client.screen) and call the proc doing client.FadeToBlack()
----------------------------------------------------------------------

Ok, now I have this but i'm still with problems...
client/proc/FadeToBlack()
client.screen += new/obj/Fade/black25
sleep(1)
for(var/obj/Fade/black25/o in client.screen)del(o)
client.screen += new/obj/Fade/black50
sleep(1)
for(var/obj/Fade/black50/o in client.screen)del(o)
client.screen += new/obj/Fade/black75
sleep(1)
for(var/obj/Fade/black75/o in client.screen)del(o)
client.screen += new/obj/Fade/black100
sleep(2)
client/proc/FadeToNorm()
sleep(2)
for(var/obj/Fade/black100/o in client.screen)del(o)
client.screen += new/obj/Fade/black75
sleep(1)
for(var/obj/Fade/black75/o in client.screen)del(o)
client.screen += new/obj/Fade/black50
sleep(1)
for(var/obj/Fade/black50/o in client.screen)del(o)
client.screen += new/obj/Fade/black25
sleep(1)
for(var/obj/Fade/black25/o in client.screen)del(o)

obj/Fade
icon='HUD.dmi';name=""
black100
icon_state="black100"
layer = MOB_LAYER +1000
screen_loc="0,0 to 15,10"
black75
icon_state="black75"
layer = MOB_LAYER +1000
screen_loc="0,0 to 15,10"
black50
icon_state="black50"
layer = MOB_LAYER +1000
screen_loc="0,0 to 15,10"
black25
icon_state="black25"
layer = MOB_LAYER +1000
screen_loc="0,0 to 15,10"


I call them using "client.FadeToBlack()" & " client.FadeToNorm()"

Now I'm getting a
"error: client.screen: undefined var"
in each of the places that client.screen is used in the procs, &
"client.FadeToBlack: undefined var" & "client.FadeToNorm: undefined var" when I try to call thoes 2 procs.
In response to ElderKain
Show where you are calling them. The errors indicate you're calling them somewhere in other datums than /mob, which of course errors, as turfs/objects/... can't have a client.
In response to Emasym
Emasym wrote:
Show where you are calling them. The errors indicate you're calling them somewhere in other datums than /mob, which of course errors, as turfs/objects/... can't have a client.
------------------------------------------------------------------------
well the
client/proc/FadeToBlack()
client.screen += new/obj/Fade/black25
sleep(1)
for(var/obj/Fade/black25/o in client.screen)del(o)
client.screen += new/obj/Fade/black50
sleep(1)
for(var/obj/Fade/black50/o in client.screen)del(o)
client.screen += new/obj/Fade/black75
sleep(1)
for(var/obj/Fade/black75/o in client.screen)del(o)
client.screen += new/obj/Fade/black100
sleep(2)
client/proc/FadeToNorm()
sleep(2)
for(var/obj/Fade/black100/o in client.screen)del(o)
client.screen += new/obj/Fade/black75
sleep(1)
for(var/obj/Fade/black75/o in client.screen)del(o)
client.screen += new/obj/Fade/black50
sleep(1)
for(var/obj/Fade/black50/o in client.screen)del(o)
client.screen += new/obj/Fade/black25
sleep(1)
for(var/obj/Fade/black25/o in client.screen)del(o)

itself brings up a long list of errors itself.

I think I can fix the Fades on the proc call by doing
turf/Ports/Exits/TruckExit
name="";
Enter(mob/M)
M.movement=0
M.client.FadeToBlack()
M.loc=locate(3,3,1)
M.client.FadeToNorm()
M.movement=1

That gets rid of the proc calling message, but I still am getting swamped by "error: client.screen: undefined var" messages from the procs themselves.
In response to ElderKain
Wow, my bad, missed that. Because it's a /client proc, there's no need to type client. everywhere, because that's what it defaults to. Just screen will do.
In response to Emasym
Emasym wrote:
Wow, my bad, missed that. Because it's a /client proc, there's no need to type client. everywhere, because that's what it defaults to. Just screen will do.

YAY! It all works fine now ^.^
Thanks ^.^

Edit:
Here is what I have now. I took out some of the redundancies in the objects of the HUD Objects as well, and the extra parts of the HUD removal for each fade parts which was like "for(var/obj/Fade/black25/o in screen)del(o)" before, so I canged them to "for(var/obj/Fade/o in screen)del(o)" since it will remove any that;s in the obj/fade anywyas since (o) is defined as any object that's in the /obj/Fade/ object line.

Also I made the coding for the HUD objects much more simplified so they take up less space too.
client/proc/FadeToBlack()
screen += new/obj/Fade/black25
sleep(1)
for(var/obj/Fade/o in screen)del(o)
screen += new/obj/Fade/black50
sleep(1)
for(var/obj/Fade/o in screen)del(o)
screen += new/obj/Fade/black75
sleep(1)
for(var/obj/Fade/o in screen)del(o)
screen += new/obj/Fade/black100
sleep(2)
client/proc/FadeToNorm()
sleep(2)
for(var/obj/Fade/o in screen)del(o)
screen += new/obj/Fade/black75
sleep(1)
for(var/obj/Fade/o in screen)del(o)
screen += new/obj/Fade/black50
sleep(1)
for(var/obj/Fade/o in screen)del(o)
screen += new/obj/Fade/black25
sleep(1)
for(var/obj/Fade/o in screen)del(o)

obj/Fade
icon='HUD.dmi';name="";
layer = MOB_LAYER +1000; screen_loc="0,0 to 15,10"
black100{icon_state="black100"}
black75{icon_state="black75"}
black50{icon_state="black50"}
black25{icon_state="black25"}

Then I call it using this for a step into teleporter pad
turf/Ports/Exits/TruckExit
name="";
Enter(mob/M)
M.movement=0
M.client.FadeToBlack()
M.loc=locate(3,3,1)
M.client.FadeToNorm()
M.movement=1

the "M.movement=0" and "M.movement=1" is so the player can't move while it's fading, I controlled that by using this
mob/var/movement=1

mob/Move()
if(!movement)return
..()