ID:139900
 
Hi, I was wondering why the heck this is just not working for me(All of the objects are defined, and have set+properly named icon and icon states):

mob/player/Login()
client.screen+= new screenobjects

client/New()
mob = new /mob/player
..()


mob/player/var/tmp/list/screenobjects = list(/obj/skillcards/s_one, /obj/skillcards/s_two, /obj/skillcards/s_three, /obj/skillcards/s_four, /obj/skillcards/s_four, /obj/skillcards/s_five, /obj/skillcards/s_six, /obj/skillcards/s_seven, /obj/skillcards/s_eight, /obj/skillcards/s_nine, /obj/skillcards/s_zero)

That's just a list of path types. Put new in front of them.
And though I can't see the rest of your code, having object names (or anything else) numbered like that is usually a bad idea.
You have to loop through them all and initialize them individually. All you're doing is re-initialzing the list they're in.
In response to Teh Governator
Teh Governator wrote:
You have to loop through them all and initialize them individually. All you're doing is re-initialzing the list they're in.

^ this.

for(var/a in screenobjects)
client.screen += a
Use newlist() instead of list(), which will give you a list of instanced objects from types (equivalent to just doing list(new /obj/whatever, new /obj/blah)).
Chances are that can be designed much better. You don't need to give every player new copies of what are most likely mostly-identical screen objects, and I assume you probably don't need all those repetitive types, either, and can fix it up with a loop or otherwise.
Though it looks like you still didn't and are still not willing to take your time to learn to program properly, at least in DM, so it's probably pointless to bother.
Just for future reference, since you're supposed to know that new()'s first, not-in-parentheses argument is the type path of the object to create (as you've supplied it properly in the shown client/New() - you don't need that whole part there, by the way, just use world/mob), and looking it up in the reference would tell you so as well, why are you wondering why it doesn't work when you're giving a var containing a list as that argument? A list is a list. It's not a type path. <small>(It's an object)</small>
In response to Garthor
Thanks, that's what I was looking for. I thought that having new in front of every object would be too repetetive.

You are also right Kaioken, thanks, it is a waste of space to create a new instance of the list for every mob when I can just have it be a single list which would be accessed to add the overlays onto the screen. I didn't want to use world/mob, I thought that it just seemed more complicated with having the entire world's mob defined, because I will have other mobs...I'm not sure, it just seems a bit confusing to me. <s>Does setting the mob on Client.New() use more memory?</s>(I'll check for myself at some point).

"Though it looks like you still didn't and are still not willing to take your time to learn to program properly, at least in DM, so it's probably pointless to bother." -->.> If I wasn't willing, I wouldn't be posting in the DM forums, I would hash together crappy, quick code and try to get a game running with ripped graphics, just for attention.
In response to Darkjohn66
Darkjohn66 wrote:
You are also right Kaioken, thanks, it is a waste of space to create a new instance of the list for every mob when I can just have it be a single list which would be accessed to add the overlays onto the screen. I didn't want to use world/mob, I thought that it just seemed more complicated with having the entire world's mob defined, because I will have other mobs...I'm not sure, it just seems a bit confusing to me. <s>Does setting the mob on Client.New() use more memory?</s>(I'll check for myself at some point).

Just define the variable as global. Either just not have it under /mob or define it as mob/var/global/etc.
In response to Darkjohn66
Darkjohn66 wrote:
Thanks, that's what I was looking for. I thought that having new in front of every object would be too repetetive.

You are also right Kaioken, thanks, it is a waste of space to create a new instance of the list for every mob when I can just have it be a single list which would be accessed to add the overlays onto the screen. I didn't want to use world/mob, I thought that it just seemed more complicated with having the entire world's mob defined, because I will have other mobs...I'm not sure, it just seems a bit confusing to me. <s>Does setting the mob on Client.New() use more memory?</s>(I'll check for myself at some point).

He means doing pretty much the same thing you have now except a lot easier.

var
list
player_hud=list(/obj/hud/health,/obj/hud/stamina,/obj/hud/ammo)
world
New()
..()
var/list/L=player_hud
for(var/H in L)
var/obj/hud/HUD=new H
if(isobj(HUD))
player_hud.Remove(H,null) //remove type and the null spot in the list
player_hud.Add(HUD)//add the new obj to the list
del(L)


client
New()
..()
src.screen.Add(player_hud)
In response to Teh Governator
I don't get how this relates to what I am doing.
In response to Darkjohn66
Darkjohn66 wrote:
I don't get how this relates to what I am doing.

It's related to exactly what you asked. How to put objects on a client's screen. It's an example of how to do it. O_o
In response to Teh Governator
It's also very convoluted when you can just use newlist(), as I've already said.