ID:159068
 
So what im trying to do is to make a info system without the info tab. (stats,inventory,skills etc..) using the interface with grids and buttons.

now, what i have is one grid. set up under the buttons for stats,inventory and skills, how do i get it so change between stats inventory and skills upon clicking the buttons.. do i need 3 different grids to display the different information. or is there a way to make this one grid display everything(one at a time(not stats, inventory at the same time)) upon request(clicking the stats or inventory button) ?
The only way I can think of, without using the statpanel/info element, is to use the tab element. To use the tab element, you need to create 3 window elements (one for each tab you want to show), and fill each window with a grid element (don't forget to name both elements, check off is a pane for the window element and anchor the grid to 100% top left & bottom right).

And then update each grid panel when needed.

Example:

For the inventory grid, and possibly skills, update it when an item enters a /mob (via Entered())and re-output (after resizing the cells to 0) the inventory items upon the item leaving a person's content (via Exited()).

For stats... for the love of efficient programming, make generalized procedures. Ex: mob.TakeHP(); this way you can have all the stuff that happens to a mob when HP is taken off (ex: updating health HUD, death checking and outputting the current health to the stats grid), you will need it only in one place instead of a zetta amount of places (I am looking Zeta).
In response to GhostAnime
kk, thanks.. will try to do so.

if everything fails to work how i want it i'll just use the statpanel instead.
Narutostory wrote:
or is there a way to make this one grid display everything(one at a time(not stats, inventory at the same time)) upon request(clicking the stats or inventory button) ?

Of course there is. Unlike with, say, info controls, you have a great amount of control over grid controls. You can make them update when you want, and how you want. There's no reason you couldn't use one grid to do this (you could even do this with an info control, too); all you need to do is to change how you're updating it, and it will display something else... tadah! Just keep track of the player's current choice with a var on that player (don't put this somewhere like the base /mob branch as NPCs don't need it). Here's an illustration:
client
var/display_choice = 1
//the choice is kept track with number flags, i.e. \
1=stats, 2=inventory, 3=something else etc

verb/change_display(n as null|num)
//this could be called from button(s)
set hidden = 1
if(n)
src.display_choice = n
src.UpdateGrid()
proc/UpdateGrid()
switch(src.display_choice)
if(1)
display skills
if(2)
display inventory
...

mob/player/Hurt()
..()
/*when a player gets hurt (==HP changes, == a stat changed),
check if he has stats displayed, and if so, update them*/

if(src.client.display_choice == 1)
src.client.UpdateGrid()
//same thing needs to be done with inventory when it changes, etc

Note if I did something like the above I'd use #define macros to name the numbers for clarity and convenience, but I didn't want to needlessly complexify the code. That looks like this, though:
#define DISP_STATS 1
#define DISP_INV 2
client
var/display_choice = DISP_STATS
//etc