ID:262052
 
I am puzzled at the problem with this code. I can compile teh game fine, but get these run-time errors.

here's a portion of the first error set:
proc name: New (/obj/hud/HUDbl/New)
usr: King Gunnerblast (/mob)
src: HUDbl (/obj/hud/HUDbl)
call stack:
HUDbl (/obj/hud/HUDbl): New(null)
King Gunnerblast (/mob): huds()
Observe (114,7,3) (/turf/Observe): Click(Observe (114,7,3) (/turf/Observe))
runtime error: Cannot read null.screen
proc name: New (/obj/hud/TiVo/New)
usr: King Gunnerblast (/mob)
src: TiVo (/obj/hud/TiVo)
call stack:


ETC (same for the rest of the HUD)...

and here's the code:

mob/proc
huds()
var/t=0
if(t==0)
client.screen+= new/obj/hud/HUDbl
client.screen+= new/obj/hud/TiVo


I must fix this or the server shuts down due to too many errors.

-please help, King Gunnerblast
what is that code supposed to do?
Clearly client is null when this error occurs. (You can tell just by reading the error message. What else would be the null in null.screen?) So put in a test for whether the client actually exists before reading those vars. Better still, just bail out of the proc from the beginning if there isn't a client.

Lummox JR
In response to Siefer
Well,
client.screen+= new/obj/hud/HUDbl
shows that it is a HUD, and, well, I made a proc so the HUD only comes up if you Click Observe.
In response to Lummox JR
Well sorry to be a bit of a n00b with client, but all I know is that
client
script = "<STYLE>BODY {background: silver; color: white}</STYLE>"
New()
..()
new/obj/hud/HUDbl(src)
new/obj/hud/HUDbottom(src)
new/obj/hud/HUDbr(src)
works. Did that help?
In response to King Gunnerblast
Everything looks seems fine, until I run the game. Then, I get a crapload of run-time errors...
In response to King Gunnerblast
Try to download hud buttons demo by straytian rouge I was working on my first game and had working HUD buttons after reading this demo it helps
In response to King Gunnerblast
What Lummox said.

Here's an example: (You don't need to use the example proc name, of course, and you shouldn't anyway because it will just confuse matters. =)

mob/proc/blajhlkhafdgh()
if (!client) return // Bail out of this proc if there is no client

// *** HUD adding code goes here ***