ID:138622
 
I need to know how, if possible to implement a separate "inventory" window on the client screen. My new spell code has all abilities classified as objects rather than just procs, this allows them to be freely distributed. I tried making a var/list/abilities thing for characters but when I place the ability in it, it doesn't register on the clients screen. Is this because contents is a special variable, or am I just doing it wrong? If possible could I have a snippet, thanx!
On 5/1/00 5:24 pm DerDragon wrote:
I need to know how, if possible to implement a separate "inventory" window on the client screen. My new spell code has all abilities classified as objects rather than just procs, this allows them to be freely distributed. I tried making a var/list/abilities thing for characters but when I place the ability in it, it doesn't register on the clients screen. Is this because contents is a special variable, or am I just doing it wrong? If possible could I have a snippet, thanx!

Hmm? I don't follow...

<font size=3>mob
var
abilities[0]

Stat()
if(src.abilities.len > 0) //is there any abilities?
statpanel("Abilities") //make a new statpanel
var/obj/ability/O //create a prototype
for(O in src.abilities) //loop through them all
stat(O) //add the ability to the panel
</font>


I'm not sure if that's what you wanted... feel free to badger me... =)

To add an item to the list, just use usr.abilities += O, and it should work fine.
In response to Spuzzum
On 5/1/00 5:41 pm Spuzzum wrote:

<font size=3>mob
var
abilities[0]

Stat()
if(src.abilities.len > 0) //is there any abilities?
statpanel("Abilities") //make a new statpanel
var/obj/ability/O //create a prototype
for(O in src.abilities) //loop through them all
stat(O) //add the ability to the panel
</font>

Good solution. Note that you can also use this shorthand:

Stat()
if(src.abilities.len)
statpanel("Abilities",abilities) // will make new panel
In response to Spuzzum
<font size=3>mob
var
abilities[0]

Stat()
if(src.abilities.len > 0) //is there any abilities?
statpanel("Abilities") //make a new statpanel
var/obj/ability/O //create a prototype
for(O in src.abilities) //loop through them all
stat(O) //add the ability to the panel
</font>