ID:1750993
 
Keywords: asap, badclient, badproc, help
(See the best response by FKI.)
Code:

mob/proc/Grid(list/L,obj/hair/G,update_only)
winset(src,"Grid1.Main Grid","is-list=true")
winset(src,"Grid1.Main Grid","cells=0") //clear the grid
if(!L) if(winget(src,"Grid1","is-visible")=="true") return 1
else
usr.contents += new /obj/hair/icon1
usr.contents += new /obj/hair/icon2
usr.contents += new /obj/hair/icon3
usr.contents += new /obj/hair/icon4
usr.contents += new /obj/hair/icon5
usr.contents += new /obj/hair/icon6
usr.contents += new /obj/hair/icon7
usr.contents += new /obj/hair/icon8
usr.contents += new /obj/hair/icon9
usr.contents += new /obj/hair/icon10
usr.contents += new /obj/hair/icon11
usr.contents += new /obj/hair/icon12
usr.contents += new /obj/hair/icon13
usr.contents += new /obj/hair/icon14
usr.contents += new /obj/hair/icon15
usr.contents += new /obj/hair/icon16
usr.contents += new /obj/hair/icon17
usr.contents += new /obj/hair/icon18
usr.contents += new /obj/hair/icon19
usr.contents += new /obj/hair/icon20
usr.contents += new /obj/hair/icon21
usr.contents += new /obj/hair/icon22
usr.contents += new /obj/hair/icon23
usr.contents += new /obj/hair/icon24
usr.contents += new /obj/hair/icon25
usr.contents += new /obj/hair/icon26
usr.contents += new /obj/hair/icon27
usr.contents += new /obj/hair/icon28
usr.contents += new /obj/hair/icon29
usr.contents += new /obj/hair/icon30
usr.contents += new /obj/hair/icon31
usr.contents += new /obj/hair/icon32
usr.contents += new /obj/hair/icon33
usr.contents += new /obj/hair/icon34
usr.contents += new /obj/hair/icon35
if(G&&istype(G,/obj/hair)) hair=G
var/Cell=1
for(var/obj/hair/O in L)
winset(src,"Grid1.Main Grid","current-cell=[Cell]")
src<<output(O,"Grid1.Main Grid")
Cell++
winset(src,"Grid1.Main Grid","cells=[Cell]")
winset(src,"Grid1","is-visible=true")
if(!update_only) while(src&&client&&(winget(src,"Grid1","is-visible")=="true")) sleep(1)
if(istype(G,/obj/hair)) hair=null
if(!update_only) winset(src,"Grid1.Main Grid","cells=0") //clear the grid


Problem description:
I was trying to make it show a Winset which had all the hair icons but, it says bad client and bad proc, and I don't know how to fix it. Any help would be useful , as soon as possible.


Best response
You're doing a lot prior to the call to winset, which leaves more than enough time for the client to disappear. What you want to do is add a sanity check before using winset.

Also, I'd suggest using usr.contents.Add() for all of those hair objects. There's no reason to add them separately like that.
In response to FKI
Thank you very much, is there anything else, I could do to confirm that it comes. But the real problem, is that the grid won't appear when I open it.
In response to AngelReincarnation
You mean the hair doesn't appear? Or..
In response to FKI
I'm pretty sure the hair would appear, it's just that the grid on the skin itself, won't appear for some reason. I tested it out on a mini server ( another game that I am making ) it worked perfectly but, it ain't working on this source.
In response to AngelReincarnation
You need to make sure it's set to be visible in the interface then.
In response to FKI
Apparently, the mobs aren't "client" or actual players and thus the proc won't work accordingly. I don't know why though everything should be working and I don't know how it is a "bad client"
mobs aren't client. Mobs are mobs. There's a mob/client var which is the actual client.
Your right, I'm just being dumb due to my lack of sleep ( 12 hours ) still don't know how to solve this thing >.>
In response to AngelReincarnation
Can you post the updated code and where the error occurs?
In response to FKI
mob/proc/Grid(list/L,obj/hair/G,update_only)
#define DEBUG
(!client)
usr<<"No client"
return
winset(src,"Grid1.Main Grid","is-list=true")
winset(src,"Grid1.Main Grid","cells=0") //clear the grid
if(!L) if(winget(src,"Grid1","is-visible")=="true") return 1
else
contents += new /obj/hair/icon1
contents += new /obj/hair/icon2
contents += new /obj/hair/icon3
contents += new /obj/hair/icon4
contents += new /obj/hair/icon5
contents += new /obj/hair/icon6
contents += new /obj/hair/icon7
contents += new /obj/hair/icon8
contents += new /obj/hair/icon9
contents += new /obj/hair/icon10
contents += new /obj/hair/icon11
contents += new /obj/hair/icon12
contents += new /obj/hair/icon13
contents += new /obj/hair/icon14
contents += new /obj/hair/icon15
contents += new /obj/hair/icon16
contents += new /obj/hair/icon17
contents += new /obj/hair/icon18
contents += new /obj/hair/icon19
contents += new /obj/hair/icon20
contents += new /obj/hair/icon21
contents += new /obj/hair/icon22
contents += new /obj/hair/icon23
contents += new /obj/hair/icon24
contents += new /obj/hair/icon25
contents += new /obj/hair/icon26
contents += new /obj/hair/icon27
contents += new /obj/hair/icon28
contents += new /obj/hair/icon29
contents += new /obj/hair/icon30
contents += new /obj/hair/icon31
contents += new /obj/hair/icon33
contents += new /obj/hair/icon34
contents += new /obj/hair/icon35
if(G&&istype(G,/obj/hair)) hair=G
var/Cell=1
for(var/obj/hair/O in L)
winset(src,"Grid1.Main Grid","current-cell=[Cell]")
src<<output(O,"Grid1.Main Grid")
Cell++
winset(src,"Grid1.Main Grid","cells=[Cell]")
winset(src,"Grid1","is-visible=true")
winshow(src,"Grid1.Main Grid",1)
if(!update_only) while(usr&&client(winget(src,"Grid1","is-visible")=="true")) sleep(1)
if(istype(G,/obj/hair)) hair=null
if(!update_only) winset(src,"Grid1.Main Grid","cells=0") //clear the grid


The problem occurs at the ' (!client) ' area
In response to AngelReincarnation
In the future, posting a comment
//error points to this line
will help debuggers greatly. You shouldn't be using usr in procs.

(!client) is a weird statement, do you mean if(!client)?
Oh yeah, I do, XD, It's because, I had to rewrite what I did before, quickly and copy and paste it. Ignore that, I never even compiled it like that. Btw I used usr for them but, it would still not appear, I am pretty sure, I did everything that was done in my other source.
It doesn't look like you added any checks where they'd be most effective. Much of that code still assumes src exists, which is why you're getting the 'bad client' error.

I also don't understand why you're clearing the grid, or setting is-list.