ID:1788984
 
(See the best response by Lummox JR.)
Essentially the code here is where I create an animated object that doesn't loop onto src.client's screen on layer 100 and another animated object that loops infinitely on layer 99, then after 20 frames it removes the first object from src.client's and 10 frames later removes the looping object from src.client's screen.
mob
Login() {
src << output(src.client);
var/obj/TitleStart/ts = new/obj/TitleStart(src.client);
del(ts);
var/obj/TitleLoop/tl = new/obj/TitleLoop(src.client);
del(tl);
var/obj/TitleStart/title = new/obj/TitleStart(src.client);
var/obj/TitleLoop/loop = new/obj/TitleLoop(src.client);
sleep(20);
title.Del(src.client);
sleep(10);
loop.Del(src.client);
}

obj
TitleStart
icon = 'Title-Start.gif';
screen_loc="1,1";
layer=100;
New(client/c) {
c.screen+=src;
}
Del(client/c) {
c.screen-=src;
}
TitleLoop
icon = 'Title-Loop.gif';
screen_loc="1,1";
layer=99;
New(client/c) {
c.screen+=src;
}
Del(client/c) {
c.screen-=src;
}


Problem description:
Compiles with no errors, yet during run-time I get this error:
runtime error: Cannot read null.screen
proc name: Del (/obj/TitleStart/Del)
usr: GameAnalysis (/mob)
src: TitleStart (/obj/TitleStart)
call stack:
TitleStart (/obj/TitleStart): Del(null)
GameAnalysis (/mob): Login()
runtime error: Cannot read null.screen
proc name: Del (/obj/TitleLoop/Del)
usr: GameAnalysis (/mob)
src: TitleLoop (/obj/TitleLoop)
call stack:
TitleLoop (/obj/TitleLoop): Del(null)
GameAnalysis (/mob): Login()
runtime error: Cannot read null.screen
proc name: Del (/obj/TitleStart/Del)
usr: null
src: TitleStart (/obj/TitleStart)
call stack:
TitleStart (/obj/TitleStart): Del(null)
GameAnalysis (/mob): Login()
runtime error: Cannot read null.screen
proc name: Del (/obj/TitleLoop/Del)
usr: null
src: TitleLoop (/obj/TitleLoop)
call stack:
TitleLoop (/obj/TitleLoop): Del(null)
GameAnalysis (/mob): Login()


Then I added that line that says:
src << output(src.client);

and on the top of my default output it gives "GameAnalysis" as the result of src.client.

I'm a bit confused on the fact that the output() function returns src.client as my BYOND key, yet the obj procs New() and Del() returns src.client as null. (I even tried replacing src with usr on everything in the file, but it still yielded the same results.)

Edit: When I searched on BYOND's website, I didn't find any relevant topic to this. Upon searching on Google I found another topic with the same issue, and it said to check if(src&&src.client) yet that seems to let me proceed onto creating the obj and gives the same runtime error.
Best response
You don't call Del() directly. You should never do that. Del() is called when you delete an object with the del() proc/keyword, and it does not take any arguments. It's basically an on-delete event handler. If you do override Del(), you should always call ..().

In this case you don't need to override Del(). Calling del(title) and del(loop) will remove both objects from client.screen for you.
In response to Lummox JR
Lummox JR wrote:
In this case you don't need to override Del(). Calling del(title) and del(loop) will remove both objects from client.screen for you.

Oh yeah I forgot about that. Thanks!