I got this...
client+=new('Guns.dmi',"Colt 45",14,2)
and
client-=del('Guns.dmi',"Colt 45",14,2)
It doesn't work and I don't blame it, I made it up. Is there any easy way like so to add objects to my hud?
ID:164947
Mar 22 2007, 2:58 pm
|
|
I still can't figure out an easy way to add objects to my hud. I want it to only show up once equipped. And of course to disappear once un-equipped. I've got a random code of like I thought up but of course it doesn't work.
I got this... client+=new('Guns.dmi',"Colt 45",14,2) and client-=del('Guns.dmi',"Colt 45",14,2) It doesn't work and I don't blame it, I made it up. Is there any easy way like so to add objects to my hud? |
You need to use client.screen instead of just client. Also, the objects truly are objects, so you'd have to do something like client.screen+=new/obj/hud/something.
|
In response to CaptFalcon33035
|
|
Yeah, though you'd better have global screen objects (at least for your common always-on HUD) rather than creating an object for every single player. That way you don't only save objects, but you don't even need to call locate() to remove those screen objects later.
<small>Also, your code example isn't the simplest, you don't need to state the path twice in the locate() line and you don't even need the temp var to hold the reference first</small> |
In response to CaptFalcon33035
|
|
Thanks a lot. Just what I wanted.
|
In response to Kaioken
|
|
Kaioken wrote:
Yeah, though you'd better have global screen objects (at least for your common always-on HUD) rather than creating an object for every single player. That way you don't only save objects, but you don't even need to call locate() to remove those screen objects later. You do still need to call locate(), I'm pretty sure. Also, your code example isn't the simplest, you don't need to state the path twice in the locate() line and you don't even need the temp var to hold the reference first I believe it makes it more efficient to place it in between the parentheses in locate() so it knows exactly what to check for. However, I'm not sure about that. The temporary variable is just so he knows what it's doing. Besides, he may want to do more with the object than just remove it. |
In response to CaptFalcon33035
|
|
CaptFalcon33035 wrote:
Kaioken wrote: Eh, of course not. Did you think about it before being sure? example- obj/HUD I believe it makes it more efficient to place it in between the parentheses in locate() so it knows exactly what to check for. I believe it does just that ("places it between the parenthesis") when you compile. I think typecast statuses aren't compiled, I don't think there's any reason for them to be, anyway. |
In response to Kaioken
|
|
obj |
In response to Xx Dark Wizard xX
|
|
In short, again, that method is flawed because you'll be creating a screen object for each player that uses that HUD, while you can just create a single object and re-use it for all players.
|
In response to Kaioken
|
|
I knew you would be able to do that, Kaioken, but do you believe that anyone wants to have a bunch of variables recording their HUD objects? I don't think they would. I wouldn't. Who's to say this isn't the only object he wants removed?
|
That's the simplest way I could think of to do this.