ID:269648
 
I cant figure out a code to remove and add statpanels like in mystic jorney. Could someone please help me. If it is any help want it to do it when you collide with a shopkeeper it appears and when you dont it disappears.
Well you can use either vars or a list to contain the statpanel.

Since I'm lazy, I'll go with... vars! (I suggest you use a list though since vars are messy ;/)
mob
var//A few closed stat vars
closestat=0
closeinv=0
closeblah=1//default for this is closed.. see below as to why

Stat()
if(!closestat)//if closestat == 0/null (FALSE), the stat panel WILL be shown
statpanel("Statistics")
stat("Stats","")
if(!closeinv)
statpanel("Inventory")
stat("Inv","")
if(!closeblah)
statpanel("Blah")
stat("Blah","")
verb
Close_Stat_Panel()
var/iys = input("What stat panel do you wish to show/hide?","Stat Panel") as null|anything in list("Stats","Inventory","Blah")
if(!iys)return//if null[cancel]
switch(iys)
if("Stats")
closestat = !closestat //becomes either 1 or 0, depending on it's last value
src << "You [closestat?"hide":"show"] the stat panel: Stats"// X? Y:Z .. if X = TRUE, Y will be chosen.. if !X, Z will be chosen
if("Inventory")
closeinv = !closeinv
src << "You [closeinv ?"hide":"show"] the stat panel: Inventory"
if("Blah")
closeblah = !closeblah
src << "You [closeblah?"hide":"show"] the stat panel: Blah"


Obviously you can make this better
In response to GhostAnime
Thanks