ID:176760
 
I have a game where you have your various commands such as "move", "attack", and "talk" along the top of the HUD. Anyway, I have two questions and need opinions.

1)>I want to have a column of the HUD on the right edge of the map that shows status changes as they come, for instance, I have nothing special, then I gain high speed. The icon for high speed would show up on the first spot on the HUD, while at the same time someone else could have flame protection and it would come up in their first spot. also, I'd like them to move up when some leave, say I have fire protection and ice protection, and fire protection wears off, then the ice protection would move to the first spot.

and

2)>I have a HUD icon for inventory and I need it to the point where you click it, and it brings up a bunch of icons representing items the player carries. I'd like it to be scrollable, if possible.
For part 1, I'd make one generic HUD object, and stick as many of them along the right edge of the map as you need...

Give that one object an icon with an icon_state for each status change, and one blank one for when there is nothing to display... Make the blank one the default state...

When you have a status change, just switch the first available object's icon_state to whatever the ability is... The next status change, change the next one down, etc...

Then, when one wears off, simply change the icon_states for the rest of them to bump the list up accordingly... (it changes to the one below it, the one below it changes to the one below that, etc)

No need to bother with creating them at runtime and moving them around, since it sounds like a purely visual effect (just a visual reference to see what powers and effects you currently have)

And if you want them to be active objects and give them a Click() proc... Just make one generic Click() that checks a variable of the object (that is changed along with the icon_state) to see what effect it should call... Like this:

Click()
if(src.effect == "Ice Protection")
IceProtection()
if(src.effect == "Super Speed")
SuperSpeed()
etc...

Although, I'm sure there's some more efficient and simple way of doing this...lol

As for number 2, this is probably best suited to a browser pop-up... Have the inventory HUD object's Click proc build an HTML page including the user's inventory, and then display it to them as a pop-up... I've never messed with any of the HTML/browser commands, though...so don't ask me for a code example...lol I just know that it is possible to do it this way...and would give you just what you asked for... A scrollable display of your inventory...
In response to SuperSaiyanGokuX
okay that makes sense. Just a few comments: when I make the default HUD status object blank, would I do it like this?
world
obj/hud/stat = /obj/hud/stat/blank

and for the Click part, there is an easier way, like you said, and that's like this
Click()
switch(src.effect)
if(IceProtection)
IceProtection()
if(FireProtection)
FireProtection()
Ect...
and for #2, I have NEVER used html before at all, so I wouldn't know how to make browser pages.
In response to Delita12345
What I meant by making its default state blank, I was speaking in terms of icon_states...

In the icon file for the object, have one state that is just a blank picture and call it "blank" (or whatever)...

Then, in the code for the object, set its starting icon_state to "blank", so it won't be seen until you want it to (by changing it to a state with a picture when necessary)

In response to Delita12345
Delita12345 wrote:
and for #2, I have NEVER used html before at all, so I wouldn't know how to make browser pages.

A quick search on Google turns up this list:

http://www.google.com/ search?hl=en&lr=&ie=ISO-8859-1&q=HTML+tutorial

HTML is pretty easy to learn - if you can learn DM, you can certainly learn HTML! :-)

Once you've learnt HTML, check out browse() in the reference. If you want to display any images in your browse()d pages, you'll need to use browse_rsc() on each image as well.