ID:2275243
 
Code:
mob/verb/Test()
// Just for test
var/list/L=list("player"="Hallo",
"npc"="What are you doing?",
"sleep"=20,
"player"="Nothing",
)
//

//now how to import text from file in to the list?//

for(var/v in L)
if(v=="sleep") {sleep(L[v]);continue}
src<<"[v]: [L[v]]"
sleep(10)



Problem description:

Have you any idea how to import and include conversation text from file.txt?
I'd do something like
proc/readFile(f)
f = file2text(f)
f = replacetext(f,"\n","&")
f = replacetext(f," "," ")
f = replacetext(f," "," ")
f = replacetext(f," "," ")
. = params2list(f)


Format

npc     = You're able to use most characters here I believe.
sleep = 20
player = Okay


global.readFile("Text.txt")
Will return a list with the file's content.
Would need to allow '=' inside of strings for npc and such tho so it doesn't get converted for params2list()

[edit]
proc/readFile(f)
f = file2text(f)
f = replacetext(f,"\n","&")
f = replacetext(f," "," ")
f = replacetext(f,"="," = ")
f = replacetext(f," "," ")
f = replacetext(f," "," ")
var list/l = params2list(f)
for(. in l)
// Debug for Output
world << "([.]) = [l[.]]"
switch(.)
if("sleep ")
sleep(text2num(l[.]))
if("npc ")
// The npc talks
// l[.] = the message
if("player ")
// The player talks
// l[.] = the message

mob/Login()
readFile("SYNTAX.dm")