ID:150605
 
Im trying to make it where you can write books.. Im wondering how i would make something like this happen:

obj/groupable/book
icon = 'objs.dmi'
icon_state = "book"
var
author = ""
story = ""
verb
Read()
usr << "[name] by [author]:"
usr << "[story]"

obj/special/study
icon = 'objs.dmi'
icon_state = "table"
name = "Study Table"
verb
Write_Book()
set src in view(1)
var/nm = input("Name?","Name?")
var/story = input("Story?","Story:")
new/obj/groupable/book(usr.loc)
src.name = nm
src.story = story
src.author = usr.name

That code doesnt work

Thanks

~Rcet

I'm just going to do my best to edit this for ya, hope it helps.


obj/groupable/book
icon = 'objs.dmi'
icon_state = "book"
var
author = ""
story = ""
verb
Read()
usr << "[name] by [author]:"
usr << "[story]"

obj/special/study
icon = 'objs.dmi'
icon_state = "table"
name = "Study Table"
verb
Write_Book()
set src in view(1)
var/nm = input(,"Name?") as text
var/story = input(,"Story:") as text
new/obj/groupable/book(usr.loc)
src.name = nm
src.story = story
src.author = usr.name
that should be it, you were pretty close, just needed the as text part
In response to DerDragon
oops, nm more to it than that
Rcet wrote:
Im trying to make it where you can write books.. Im wondering how i would make something like this happen:

obj/groupable/book
icon = 'objs.dmi'
icon_state = "book"
var
author = ""
story = ""
verb
Read()
usr << "[name] by [author]:"
usr << "[story]"

obj/special/study
icon = 'objs.dmi'
icon_state = "table"
name = "Study Table"
verb
Write_Book()
set src in view(1)
var/nm = input("Name?","Name?")
var/story = input("Story?","Story:")
new/obj/groupable/book(usr.loc)
src.name = nm
src.story = story
src.author = usr.name

That code doesnt work

Thanks

~Rcet

Write_Book()
set src in view(1)
var/nm = input("Name?","Name?")
var/story = input("Story?","Story:")
new/obj/groupable/book(usr.loc)
src.name = nm
src.story = story
src.author = usr.name

In the above section, Write_Book() belongs to obj/special/study, which means that src = the study, not the book. You are trying to set the name, story, and author of the study, when I believe you want to set it for the book you just created.

var/obj/grouble/book/B = new(usr.loc)
B.name = nm
B.story = story
B.author = usr.name

See if that works instead. I'm only drinking half-caff today, so no promises.

/mob/skysaw