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.
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.