ID:1055728
 
(See the best response by Kaiochao.)
Code:
obj
FakeScience
var
opath
reqs = list()
Click()
new opath(usr)

obj
Inventory
Science
var
tlevel // Level at which the tech is acquired


Blacksmithing
Sword
tlevel = 1
Armor
tlevel = 1


Electronics
Book
tlevel = 1
icon = 'Book.dmi'
var/con
verb
Compose(t as text | null)
con += t

Biotechnology
Steroids
tlevel = 1
Poison
tlevel = 1

mob
var/scienceCells = 0
proc

list_types(stype)
var/list/stypes = typesof(stype)
stypes -= stype
return stypes
out_types(stypes, slevel, old)
var/obj/Inventory/Science/n
for(var/x in stypes)
scienceCells++
n = new x()
if(n.tlevel <= slevel)
var/obj/FakeScience/f = new()
f.icon = n.icon
f.icon_state = n.icon_state
f.opath = n.type
f.name = n.name
src << output(f, "scienceGrid:1,[scienceCells]")
pop_science()
scienceCells = 0
out_types(list_types(/obj/Inventory/Science/Blacksmithing), blk_lvl)
out_types(list_types(/obj/Inventory/Science/Electronics), ele_lvl)
out_types(list_types(/obj/Inventory/Science/Biotechnology), bio_lvl)


Problem description:

When I try to interact with the items in the grid, such as using the edit verb, I get some errors saying the obj doesn't exist in the world. I made sure to create it in the procs, but for whatever reason it isn't working as expected. Even the Click() is never ran, so whatever I'm clicking in the menu must not be /obj/FakeScience

Anyone have any clues why this is happening?
Best response
Skin Reference:
Very important: If you send an atom to a grid like you would with a statpanel, keep that object in a list or make sure it actually exists somewhere in the world. Do not use a temporary object that will be deleted when the proc ends, or it can disappear/change in the grid when a new object is created. Statpanels don't have this problem because of the way they update, but it's a good idea even there not to use temporary atoms.
Ah, so I need to make sure they're saved, since these are local they get deleted. I looked over that bit. Thanks a lot Kaiochao~
Store them in a list as part of the character, or something, that's pretty much it.
In response to Super Saiyan X
Super Saiyan X wrote:
Store them in a list as part of the character, or something, that's pretty much it.

Thats exactly what I ended up doing!