Dynamic Book Template (version 3.0)

Help bring our custom Ages to life! Share tips and tricks, as well as code samples with other developers.

Re: Dynamic Book Template (version 3.0)

Postby Whilyam » Wed Apr 23, 2008 12:06 pm

This is great! It works very nicely. The only problem nos is that the cover is not the one I (think I) referenced in the code.

Code: Select all
AgeBooks = {'book': ('<cover src="fensbook"><margin right=32 left=32>', '<font size=14 face=Nick color=000000>', 0, 0, 'bkNotebook', 0.8, 1.0)}


"fensbook" is the texture used as the book's cover as the texture covering the book object in Blender.
User avatar
Whilyam
 
Posts: 1023
Joined: Sat Sep 29, 2007 5:55 pm

Re: Dynamic Book Template (version 3.0)

Postby Whilyam » Wed Apr 23, 2008 12:35 pm

Secondly, my text appears on the second page (right hand page) now. Is there any reason why this is happening?
User avatar
Whilyam
 
Posts: 1023
Joined: Sat Sep 29, 2007 5:55 pm

Re: Dynamic Book Template (version 3.0)

Postby D'Lanor » Wed Apr 23, 2008 12:38 pm

You need to give the full name of your image file otherwise it shows the default cover. If your texture is a jpg you would use fensbook.jpg or whatever you used as the original image.

The book always starts at the second page. That is the way i set it up. If you would use multiple sections they will be separated by a blank page. You can add your own new pages with <pb>.

Edit: Actually that is not true. :oops: You can delete the first "Pagestart" from your BookPages definition to make it start at page 1.
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: Dynamic Book Template (version 3.0)

Postby Whilyam » Wed Apr 23, 2008 12:48 pm

I thought of that and put in the extension as well but it shows up the same

Code: Select all
AgeBooks = {'book': ('<cover src="fensbook.png"><margin right=62 left=62>', '<font size=12 face=Nick color=000000>', 0, 0, 'bkNotebook', 0.8, 1.0)}


Also, why start on page 2? Every other journal starts on page 1. Is there any way to set it to start on page 1?
User avatar
Whilyam
 
Posts: 1023
Joined: Sat Sep 29, 2007 5:55 pm

Re: Dynamic Book Template (version 3.0)

Postby D'Lanor » Wed Apr 23, 2008 12:54 pm

Whilyam wrote:I thought of that and put in the extension as well but it shows up the same

Code: Select all
AgeBooks = {'book': ('<cover src="fensbook.png"><margin right=62 left=62>', '<font size=12 face=Nick color=000000>', 0, 0, 'bkNotebook', 0.8, 1.0)}


Also, why start on page 2? Every other journal starts on page 1. Is there any way to set it to start on page 1?

Is that really the name of the texture? Python is case sensitive.

Reason to start on page 2: the template was originally designed for linking books and later became a combined linking book/journal template (mainly because I needed something like that myself). It can be changed. See the edit in my previous post.
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: Dynamic Book Template (version 3.0)

Postby Whilyam » Wed Apr 23, 2008 1:30 pm

Woo hoo!

Stupid me.. the texture is "fenbook.png" not "fenSbook.ong" :roll:

Thanks again! :D
User avatar
Whilyam
 
Posts: 1023
Joined: Sat Sep 29, 2007 5:55 pm

Re: Dynamic Book Template (version 3.0)

Postby Whilyam » Wed Apr 23, 2008 3:47 pm

Now this is annoying. I made a second journal and coded it and it worked. I had two journals displaying two different things. Now, though, I can click on them, but the book never pops up and the code looks fine. What is going on here?

Edit: Here's something... The python log says:

Code: Select all
(04/23 19:10:31) Traceback (most recent call last):
(04/23 19:10:31)   File "C:/Work/Ages/Fens/FensBookGUI.py", line 38, in ?
(04/23 19:10:31)     modPageDefs = __import__('FensPageDefs')
(04/23 19:10:31)   File "C:/Work/Ages/Fens/FensPageDefs.py", line 59, in ?
(04/23 19:10:31)     BookPages = {'FensJournal': ((DefFensJournal % plyrName)),
(04/23 19:10:31) TypeError: not all arguments converted
(04/23 19:10:31) Python file FensBookGUI.py was not found.
(04/23 19:10:31) __init__FensBookGUI v.3.0
(04/23 19:10:55) FensBookGUI: OnNotify called
(04/23 19:10:55) Someone clicked on object book
(04/23 19:10:55) It was you
(04/23 19:10:55) Trying book book with page(s) ['FensJournal']
(04/23 19:10:55) Match found! Start opening book...
(04/23 19:10:55) FensBookGUI: IOpenBook: Page(s) requested ['FensJournal']
(04/23 19:10:55) Traceback (most recent call last):
(04/23 19:10:55)   File "C:/Work/Ages/Fens/FensBookGUI.py", line 61, in OnNotify
(04/23 19:10:55)     self.IOpenBook(a, b)
(04/23 19:10:55)   File "C:/Work/Ages/Fens/FensBookGUI.py", line 122, in IOpenBook
(04/23 19:10:55)     if (not (bkPage in modPageDefs.LinkDestinations)):
(04/23 19:10:55) AttributeError: 'module' object has no attribute 'LinkDestinations'
(04/23 19:10:56) FensBookGUI: OnNotify called
(04/23 19:10:58) FensBookGUI: OnNotify called
(04/23 19:10:58) Someone clicked on object book
(04/23 19:10:58) It was you
(04/23 19:10:58) Trying book book with page(s) ['FensJournal']
(04/23 19:10:58) Match found! Start opening book...
(04/23 19:10:58) FensBookGUI: IOpenBook: Page(s) requested ['FensJournal']
(04/23 19:10:58) Traceback (most recent call last):
(04/23 19:10:58)   File "C:/Work/Ages/Fens/FensBookGUI.py", line 61, in OnNotify
(04/23 19:10:58)     self.IOpenBook(a, b)
(04/23 19:10:58)   File "C:/Work/Ages/Fens/FensBookGUI.py", line 122, in IOpenBook
(04/23 19:10:58)     if (not (bkPage in modPageDefs.LinkDestinations)):
(04/23 19:10:58) AttributeError: 'module' object has no attribute 'LinkDestinations'
(04/23 19:10:58) FensBookGUI: OnNotify called
User avatar
Whilyam
 
Posts: 1023
Joined: Sat Sep 29, 2007 5:55 pm

Re: Dynamic Book Template (version 3.0)

Postby D'Lanor » Wed Apr 23, 2008 4:56 pm

You need to get rid of the % plyrName. Unless you really want the journal to display the player's name. In that case you need to code a %s at the spot where you want the name to appear in the journal.
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: Dynamic Book Template (version 3.0)

Postby Whilyam » Wed Apr 23, 2008 5:14 pm

Wow. That worked. Wonder why it never stopped it before. Thanks again (I'll be back when the next thing explodes :P)
User avatar
Whilyam
 
Posts: 1023
Joined: Sat Sep 29, 2007 5:55 pm

Re: Dynamic Book Template (version 3.0)

Postby andylegate » Wed Apr 23, 2008 5:15 pm

With any kind of clickable "explode" is more often than not, so see you soon! :D :D
"I'm still trying to find the plKey for Crud!"
Image
Blender Age Creation Tutorials
3DS Max Age Creation Tutorials
User avatar
andylegate
 
Posts: 2348
Joined: Mon Oct 01, 2007 7:47 am

PreviousNext

Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests

cron