ID:164981
Mar 17 2007, 5:48 am (Edited on Mar 17 2007, 11:59 pm)
|
|
I'm sure the tutorials pages are littered with guides to this sort of thing but i haven't found any yet. How do i put things on the screen? I think it's called the hud or hub or something, i'm not really sure. Also if it's a client.eye type i've never been that good with clients, so that would explain it! Thanks.
|
Mar 17 2007, 5:52 am
|
|
Yes, search for 'HUD', and look up client.screen in the DM Reference.
|
In response to Kaioken
|
|
Well, i get that it's a client.screen, and i get the "X,Y" bit, but how do i actually put an object on the client.screen?
|
In response to Adam753
|
|
obj/WhiteScreen Correct me if I am wrong please, I know I probably messed up something since it's been a long time since I opened DM <_< - GhostAnime |
In response to GhostAnime
|
|
Its fine, except-
GhostAnime wrote: screen_loc = "1,1 to EAST,NORTH" I'm not sure, but that might be invalid syntax. I use "SOUTHEAST to NORTHWEST". var/list/misc=list("white") //setting up a list of stuff to create things in which can be used to show anything to anybody without creating more than needed objects Well, you can just use a regular list here instead. If you want you can #define the index numbers so you don't have to remember them, which has the same effect of using the associative list. world/New() This part is fine, but you can use 'new'/initialize objects "at compile-time", so no need for a world/New() override for that. for(var/client/C) //This defaults to for(var/client/C in world) Actually, it doesn't. IIRC the DM Ref does say that, but if you do var/client/C in world that won't actually work. The reason is that is the same as doing var/client/C in world.contents, and world.contents contains only atoms. Rather, omitting the 'in' seems to simply loop threw all those objects that exist. for(var/client/C)Well, yeah, this is also fine, but you can make it more efficient. It takes some extra time to look-up an item in a list, so instead of doing that each iteration, you're better off doing it only once: var/obj/white_O = misc["white"] |
In response to GhostAnime
|
|
Hmm, that works awesome! I'll just post what i've got so you guys can pick holes in it.
var/list/score=list("onscreen") Yes? I keep score with a 1 counter, a 10 counter and a 100 counter. EDIT oh yeah, i just realised, how would i change the icon state of something onscreen? |
In response to Adam753
|
|
As a note, please refer to Kaio's post below if you haven't done so (which, btw, thanks for the corrections Kaio).
You simply have to locate the object and change it's icon_state: var/obj/o = locate(/obj/score/hundred) in client.screen Just remember, since you have the object stored in one place which everyone is having a reference to, I _THINK_ if you change the icon_state or do anything to the object, it'll affect everyone and not just the one person him/herself (which is not a good thing for something like a health hud). To make it individual, you would probably have to make a new instance of the object in which each individual client would have their own instance... but I am not sure to be honest <_< - GhostAnime |
In response to GhostAnime
|
|
OH, yeah. thanks!
|
In response to GhostAnime
|
|
GhostAnime wrote:
Just remember, since you have the object stored in one place which everyone is having a reference to, I _THINK_ if you change the icon_state or do anything to the object, it'll affect everyone and not just the one person him/herself (which is not a good thing for something like a health hud). Yeah, IIRC screen objects update realtime. Which is convenient, well, yeah, except for player-specific stuff such as stat bars. To make it individual, you would probably have to make a new > instance of the object in which each individual client would > have their own instance... but I am not sure to be honest <_< True, but I guess you could make global objs for that as well. ie if the bar can have 5 states, have only 5 global bar objs, each with a different icon_state. Then when updating the bar, remove the current obj and add the respective one to that player's client.screen. I think it could work well, though I haven't something like that. That way, if you have 1-5 players, well, you've wasted objects :P but if you have 20 you've saved them because all in all you have just 5 objs. |