Code:
Problem description:
I would like to put actual use to my bookshelves icons by making them a click system that allows you to write a new book or read ones other people have written.
All bookshelves can be linked or not that part can go either way, but if anyone has a little knowledge they can spend on me. I'd appreciate the help.
This way people can come up and actually write books into the library and people can also come and read them. I just feel like that would be revolutionary type awesome because sometimes its the little things that make a game feel more complete.
If anyone has coding for this sort of thing let me know.
I appreciate the help.
Jun 18 2017, 9:22 am
Best response
|
|
Tested, just needs to be given an icon.
|
In response to Kozuma3
|
|
Why are you giving 'books' a default value? You're wiping it out in world/New() anyways. You should also definitely have cancel buttons on your input()s.
You also don't need the 'm' variable at all 'usr' is perfectly acceptable in this case. |
In your professional opinion. Where should i slide the icon in. At the top or near the bottom?
Does it matter? |
So this code erases old books when a new one is being added is what you're saying?
|
No, but it's probably not a good idea to be using code that you don't understand, which is why we usually don't just give people the code and say 'good luck!' -- it does nothing to teach people.
|
I learn in a great way from an example that i know for sure is a proper working system. It's more than just copy and paste with me. I'm known for studying something i don't understand.
|
In response to Kozuma3
|
|
Thanks man i appreciate your help. You saved me bro :D
|
BookShelves These are my current Bookshelf settings. I've spent the last hour or so trying to figure out how to fuse what you've shown me with it. Can you Give me a hand? |
In response to LiquidWhip
|
|
obj |
In response to Nadrew
|
|
Nadrew wrote:
Why are you giving 'books' a default value? You're wiping it out in world/New() anyways. You should also definitely have cancel buttons on your input()s. If you remove "hud = new" in world/New() then the default book will exist if no savefile is found to be saved later, this can be used to build in default books. |
In response to Nadrew
|
|
Also I overlooked something, the modified code below under "Write" will now check to see if the book already exists with the given title, if so it'll ask again for another title. They have 3 trys.
if("Write") |
This is what i've turned up with
obj/BookShelves It's telling me this though. media\code\turf\Turf.dm:3714:error: global.books.len: undefined var media\code\turf\Turf.dm:3717:error: global.books: undefined var media\code\turf\Turf.dm:3718:error: global.books: undefined var media\code\turf\Turf.dm:3728:error: global.books: undefined var media\code\turf\Turf.dm:3716:error: : missing expression media\code\turf\Turf.dm:3707:warning: save_path: variable defined but not used media\code\turf\Turf.dm:3708:warning: books: variable defined but not used I haven't gotten to plugging in the last part yet because of these five errors. |
You're missing the global variables 'var list/books = new' & 'var save_path = "worldsave.sav"'
They shouldn't exist under the object. |
obj/BookShelves It now reads media\code\turf\Turf.dm:3707:error: 'var list/books = new': cannot find file media\code\turf\Turf.dm:3707:error: 'var save_path = "worldsave.sav"': cannot find file media\code\turf\Turf.dm:3715:error: global.books.len: undefined var media\code\turf\Turf.dm:3718:error: global.books: undefined var media\code\turf\Turf.dm:3719:error: global.books: undefined var media\code\turf\Turf.dm:3729:error: global.books: undefined var media\code\turf\Turf.dm:3707:warning: &: statement has no effect media\code\turf\Turf.dm:3717:error: : missing expression media\code\turf\Turf.dm:3708:warning: save_path: variable defined but not used media\code\turf\Turf.dm:3709:warning: books: variable defined but not used Does this mean i need to create a DM file for Books? |
Above the object itself you need to define the below.
You need to do this to define them as global variables, defining them under the object will not make them global. var list/books = new |
var list/books = new I only got one warning and that was a media\code\turf\Turf.dm:3710:warning: books: variable defined but not used I'm assuming that's because i haven't input the rest of it in yet. I don't know how i should do the indentation for that. I get a max count error everytime i try to put the bottom portion of the code in |
Ah i understand what you mean now by it won't make them global. Do i need to take out the variable list/books that i have listed under obj in the code above?
|
This is what we have so far
var list/books = new |