ID:2211537
 
(See the best response by Ter13.)
Code:
        CreateTest()
set category = "Test Verbs"
var/Item
var/Type = input ("What do you need?" , "Create") in list ("Plant","Cancel")
if(Type == "Plant") Item=input("What do you need?", "Create item") in Plant
new Item (locate(x,y,z))


Trying to figure out how to make the list say only the -names- of the objects rather than the type path, also possibly collapsing lists/tabs:

I'm currently reading the DM guide through and while I have played with dm code for awhile I never properly learned it so i'm still struggling a little with the basics. My problem with -this- bit of functioning code is i'm having trouble coming up with an idea on how to make it tell me just the -names- of objects rather than give me mob/plant/ItemName.

Interface -especially- annoys and confounds me. If you give me some code adjustments that's great but i'm fine with some tips and maybe some things to look up and read into to help me with this.

While this is up i'm gonna keep playing with the code. If I find a way to make it work or take it a step closer somehow i'll update the code.
Code:
var/list
Plant = new/list()
Plant = list()
// Plant = typesof(/obj/Basic)
Plant.Add(obj/food/apple1)
var/obj/food/apple1 = "Apple"

The associated list. Did some fussing about, tryed to make the object path equal a name so it would output the name instead but...Looking at the code now I see that it does not look right.
Best response
You can use initial() on a type to get the prototype variables of that type.

You will need to build the list manually and associate the names with the type you want to create.

var/list/l = list()
var/plant/p
for(var/v in typesof(/plant))
var/plant/p = v
l[initial(p.name)] = v
if(p = (input("herp","derp") as anything|null in l))
p = l[p]
new p()
In response to Ter13
Initial huh? Thanks, i'll give this a shot and try it tomorrow. If anybody else has any tips i'd appreciate it. (also thanks for posting a code snippet, it'll help me visualize all this.)
Alright I think I understand what Ter13 is talking about now. Still though this method seems like adding -alot- of extra code. Is there no way for me to simply add some kind of variable or something to an item that would show up on the list rather then the type? I mean i'm not lazy, i'll do the typing but i'm trying to conserve space as much as possible.

I suppose it's -also- possible to try to create some input thing, rather then make an option for -every- item make it so the user can type the name of the item and then just have an associated list of items on the page or some such.. Alot of typing still though.
This is not a lot of code. It is the minimum amount to reach your desired result.

Nor does it take much in the way of resources.
In response to Ter13
Alright, sorry for the added trouble. Thanks again.