ID:146798
 
Code:
runtime error: wrong type of value for list
proc name: Hud (/mob/proc/Hud)
source file: Procs.dm,100
usr: Motre (/mob/person)
src: Motre (/mob/person)
call stack:
Motre (/mob/person): Hud()
Motre (/mob/person): Toggle HUD()
-----------------------------------------
verb
Toggle_HUD()
if(usr.ClosedHud==0)
for(var/obj/HUD/C in usr.client.screen)
del(C)
usr.ClosedHud=1
return
if(usr.ClosedHud==1)
src.Hud()
usr.ClosedHud=0
return


Problem description:

Im made a verb for toggling the usr hud but when i click it the first time it goes away YAY like its sapose to but if i click it to come back i get that warning...
As the error message says, the problem is in the Hud() proc. Please post that proc (and indicate which line is line 100).

Also, this has no bearing on the error message, but I just have to compulsively improve your verb. Sorry. =)

    verb
Toggle_HUD()
if(usr.ClosedHud)
src.Hud()
usr.ClosedHud=0
else
for(var/obj/HUD/C in usr.client.screen)
del(C)
usr.ClosedHud=1


Using an if...else instead of two ifs is much nicer style, and just testing (usr.ClosedHud) instead of (usr.ClosedHud==1) is more robust. Plus, because of the if...else, you can now get rid of those return statements and just let the verb naturally return when it reaches its end, which makes the code shorter and (IMO) slightly more readable.
In response to Crispy
here is the hud proc

        Hud()
client.screen+= Inventory
client.screen+= Stats
client.screen+= TR
client.screen+= TL
client.screen+= BR
client.screen+= BL
client.screen+= R
client.screen+= L
client.screen+= T
client.screen+= B
client.screen+= M
client.screen+= Who
client.screen+= Save
client.screen+= Load

heres the hud proc not sure whats wrong...or if im doing it right
In response to Motre
Motre wrote:
here is the hud proc

>       Hud()
> client.screen+= Inventory
> client.screen+= Stats
> client.screen+= TR
> client.screen+= TL
> client.screen+= BR
> client.screen+= BL
> client.screen+= R
> client.screen+= L
> client.screen+= T
> client.screen+= B
> client.screen+= M
> client.screen+= Who
> client.screen+= Save
> client.screen+= Load
>

heres the hud proc not sure whats wrong...or if im doing it right



Uhhh didnt he say to specify which line is 100?