ID:174192
 
I am working on an advanced organization system using objs called folders. Im makeing towhere the user can store objs into the folder by placing the objs into a list. But, I have foundmyself stuck.

When the usr clicks the folder im wanting a statpanel to appear with the same name as the folder. Inside of the statpanel I want it to show the folder's list.

Anyone here know how to help me with this problem?
Texter wrote:
I am working on an advanced organization system using objs called folders. Im makeing towhere the user can store objs into the folder by placing the objs into a list. But, I have foundmyself stuck.

When the usr clicks the folder im wanting a statpanel to appear with the same name as the folder. Inside of the statpanel I want it to show the folder's list.

Whoa! Time out! Say "the player" instead; you've just made an error in terminology by saying "the usr". This is a big deal because when you unconsciously conflate the two, you're more likely to put usr in places where it's dangerous.

Common mistake:
"the player" = "the user" = usr

Not trying to get on your case or anything here; I just like to head up these issues before they creep into people's code.

Anyone here know how to help me with this problem?

As far as the folder goes, I'd give each mob a var for the active folder they're looking at. If objs go in the folder by being added to its contents, then to view the folder all you need is this:
mob
var/obj/folder

Stat()
... // other stats
if(folder)
statpanel("Folder: [folder.name]", folder.contents)
Incidentally, since it bears on what I mentioned about usr, Stat() is usr-safe; usr is the player viewing the panel, and src is the object whose Stat() proc is called (usr.client.statobj or usr, unless you call Stat() manually another way).

Lummox JR
In response to Lummox JR
Thanks for the valuable info JR :).

How would I make it towhere the use view the stapanel and close it at will?
In response to Texter
Texter wrote:
Thanks for the valuable info JR :).

How would I make it towhere the use view the stapanel and close it at will?

To view the statpanel, you'd have to set the player's folder var to a valid folder object.

To close it, set the folder var to null.

Lummox JR
In response to Lummox JR
obj/var/list/storage
obj/Folder
icon= 'Folder.dmi'
Click()
usr.folder.contents = src.storage

mob/verb/Test3()
var/obj/Folder/s = new/obj/Folder
sheet +=s //adds folder to table
var/obj/Sheet/d = new/obj/Sheet
s.storage +=d //adds sheet to folder

When I click it.. it gives me this runtime error

runtime error: Cannot modify null.contents.
proc name: Click (/obj/Folder/Click)
usr: Texter (/mob)
src: Folder (/obj/Folder)
call stack:
Folder (/obj/Folder): Click("Game")
In response to Texter
You forgot to check if usr.folder is null.

Lummox JR
In response to Lummox JR
You have been very helpful Lummox JR and greatly appreciate it.

Unfortunatly I have come across another dead in this maze.

Usually I can skim through and figure out what causes an error like this but today I cannot seem to find anything wrong.
TextMudPuddle.dm:94:error: is: missing comma ',' or right-paren ')'

TextMudPuddel.dmb - 9 errors, 0 warnings (double-click on an error to jump to it)

It highlights over the if(usr.folder is null)

Folder
icon= 'Folder.dmi'
Click()
if(usr.folder is null)
usr.folder.contents = src.storage
else
usr.folder = null
In response to Texter
if(!usr.folder)

That might work better.
In response to Jon88
runtime error: Cannot modify null.contents.
proc name: Click (/obj/Folder/Click)
usr: Texter (/mob)
src: Folder (/obj/Folder)
call stack:
Folder (/obj/Folder): Click("Game")

I still get this runtime erro when I click the obj. _-_
In response to Texter
Heh, stupid me. I meant if(usr.folder)

Doh!
In response to Jon88
Folder
icon= 'Folder.dmi'
Click()
if(usr.folder)
usr.folder.contents = src.storage
else
usr.folder = null

With if(usr.folder) it doesn't do anythign at all when I click it. This gets more puzzling.. o.o
In response to Texter
Well, that means that usr.folder is null. You need to set folder to something.
In response to Jon88
I don't think this would make any diffrence but Folder is stored on a varlist called sheet and the sheet is put into a mob/var/list/sheetsc
Table
icon= 'table.dmi'
name = "Sheets"
Click()
if(usr.sheetsc == sheet)
usr.sheetsc = ""
usr.scroll3 = "+"
else
usr.sheetsc = sheet
usr.scroll3= "--"
This is for the soul reason letting the person to be able to minimize the tabel containing sheets at will. Now here is the organiztion that has been gotten down so far.
mob
var/obj/folder
Stat()
if(folder)
statpanel("Folder""folder.name", folder.contents)

obj/Folder
icon= 'Folder.dmi'
Click()
if(!usr.folder)
usr.folder= list()
usr.folder.contents += src.storage

mob/verb/Create_Folder()
var/obj/Folder/s = new/obj/Folder
sheet +=s

mob/verb/PutinFolder(obj/o in world)
var/obj/Sheet/s = new/obj/Sheet
o.storage +=s
obj/var/list/storage
Nothing happens at all. And when I use if(!usr.folder) I get that same runtime error. Can anyone lead me through the right direction. Also.. Im wanting the user to be able to view more then one folder if theres a way to modify it towhere it can as of now im stuck here on a rock surrounded by ocean <_<.