ID:267922
 
I've got a plain and simple question:
How to allow players to input text and save them in a list?

mob/Topic(href,href_list[])
switch(href_list["log"])
if("add")
var/text = input("Please type in what you would like to add.") as message|null
if(!text)
return
var/obj/X = get_step(src,src.dir)
for(var/obj/computers/captaincomputer/O in X)
for(var/obj/items/id/A in O.contents)
if(A.equip == "master")
A.log.Add("[text]|")
if("remove")
var/log1
var/obj/X = get_step(src,src.dir)
for(var/obj/computers/captaincomputer/O in X)
for(var/obj/items/id/A in O.contents)
if(A.equip == "master")
log1 = A.log
var/listie[0]
for(var/Y in log1) listie+=Y
var/M=input(usr,"What would you like to delete?") as null|anything in listie
if (!M)
return
del(M)


That's my code. Everything works!

Players insert their ID card, click "Login", and select either "Add" or "Remove" from the menu.

...however when they press Add, it gives tons of runtime errors and quits...and when they press remove nothing happens (probably becouse the list is empty).

The error:
runtime error: Cannot read null.len
proc name: dd list2text (/proc/dd_list2text)
source file: TextHandling.dm,223
usr: Phoenix Man (/mob/player)
src: null
call stack:
dd list2text(null, "\|")
Phoenix Man (/mob/player): LogCPU()
Phoenix Man (/mob/player): Topic("src=\[0x3000000];log=login", /list (/list))


Any fixes?

dd list2text(null, "\|")

You're not passing a list into dd_list2text.