Dynamic Book Template (version 2.1)

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

Re: Dynamic Book Template (version 2)

Postby D'Lanor » Thu Feb 14, 2008 5:05 pm

Dynamic texture maps are cool. The boards in the neighborhoods use them. They are not necessarily GUI dialogs though. With dynamic texture maps you could do something like...

Show Spoiler

Yes, that is an in-game shot. ;)
"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 2)

Postby andylegate » Sat Feb 16, 2008 8:26 pm

Now here is a WEIRD error I'm getting for some reason with the new book template. My credits book wouldn't pop up when I clicked on it, so I looked in the Log, and here is what it's telling me:

Code: Select all
(02/16 18:48:27) Someone clicked on object credits
(02/16 18:48:27) It was you
(02/16 18:48:27) Try book welcomebk with page(s) ['cbwelcomebk']
(02/16 18:48:27) Try book assignbook with page(s) ['cbassign']
(02/16 18:48:27) Try book answers with page(s) ['cbanswers']
(02/16 18:48:27) Try book credits with page(s) ['cbcredits']
(02/16 18:48:27) Match found! start opening...
(02/16 18:48:27) CampbravoDTBookGUI: IOpenBook: Page request for ['cbcredits']
(02/16 18:48:27) Traceback (most recent call last):
(02/16 18:48:27)   File ".\python\CampbravoDTBookGUI.py", line 60, in OnNotify
(02/16 18:48:27)     self.IOpenBook(a, b)
(02/16 18:48:27)   File ".\python\CampbravoDTBookGUI.py", line 106, in IOpenBook
(02/16 18:48:27)     (bkCover, bkFont, startOpen, forceOwned,) = bkParams
(02/16 18:48:27) ValueError: unpack tuple of wrong size


What the heck is a unpack tuple of wrong size???
"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

Re: Dynamic Book Template (version 2)

Postby Nadnerb » Sat Feb 16, 2008 10:15 pm

it means that bkParams doesn't have the right number of params in it. A tuple in python is an object that contains a bunch of other objects. It's a lot like a list or an array, but it behaves differently.

When we try to assign a tuple as shown in the erroring line:
Code: Select all
(bkCover, bkFont, startOpen, forceOwned,) = bkParams

it expects bkParams to be a tuple. The first object in the tuple will be put into bkCover, the second, bkFont, etc.. However, if the bkParams tuple does not have 4 objects in it, then we are "unpacking a tuple of wrong size"

bkParams is assigned from your AgeBooks dictionary in your pageDefs file, so the question is, does the tuple in the dictionary have the right number of objects?
Code: Select all
('<cover src="*YourTexture*"><margin right=32 left=32>', '<font size=12 face=Arial color=000000>', 0, 0)
or
Code: Select all
(1, 2, 3, 4)
Image
Live KI: 34914 MOULa KI: 23247 Gehn KI: 11588 Available Ages: TunnelDemo3, BoxAge, Odema
Nadnerb
 
Posts: 1057
Joined: Fri Sep 28, 2007 8:01 pm
Location: US (Eastern Time)

Re: Dynamic Book Template (version 2)

Postby andylegate » Sun Feb 17, 2008 7:32 am

If I remember right, they have dummy values as they are journals (none, none, none, none) like that. Let me go look however.

EDIT: oh duh! The problem was under the AgeBooks definitions.......I got carried away typing too fast, and forgot to seperate some of the parameters. So, Yah, the count would have been wrong!

See? This is what I get for trying to rush something just before an All Guilds meeting!!! :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

Re: Dynamic Book Template (version 2)

Postby andylegate » Sun Feb 17, 2008 8:45 am

Okay, now I've got a new error.

Books all pop up and look good with their different covers. All the journals look good and pages turn, etc, etc.

Now, I've got two linking books: One to the Cleft, and one to Gahreesen. The one to the Cleft looks good, opens up, link panel is there, and you can link.

The one to Gahreesen is where I'm having a problem. You can click on the book. The book cover pops up. You can open the book. But once it's open, it's blank, not showing a linking pannel, nor is there a hot spot to link. I'm using the default link in point for Garrison, and the linking pannel is the picture from the nexus. Here is what the Log had to say:

Code: Select all
(02/17 10:39:04) CampbravoDTBookGUI: OnNotify called
(02/17 10:39:04) Someone clicked on object glink1
(02/17 10:39:04) It was you
(02/17 10:39:04) Try book welcomebk with page(s) ['cbwelcomebk']
(02/17 10:39:04) Try book assignbook with page(s) ['cbassign']
(02/17 10:39:04) Try book answers with page(s) ['cbanswers']
(02/17 10:39:04) Try book credits with page(s) ['cbcredits']
(02/17 10:39:04) Try book linkbook1 with page(s) ['CBlink1']
(02/17 10:39:04) Try book glink1 with page(s) ['GahreesenLink']
(02/17 10:39:04) Match found! start opening...
(02/17 10:39:04) CampbravoDTBookGUI: IOpenBook: Page request for ['GahreesenLink']
(02/17 10:39:04) Showing page for Garrison
(02/17 10:39:04) Linking pages created: 1
(02/17 10:39:04) CampbravoDTBookGUI: OnNotify called
(02/17 10:39:04) BookNotify  event=1, id=0
(02/17 10:39:04) Show Book
(02/17 10:39:04) Traceback (most recent call last):
(02/17 10:39:04)   File ".\python\CampbravoDTBookGUI.py", line 80, in OnNotify
(02/17 10:39:04)     PtSendKIMessage(kDisableKIandBB, 0)
(02/17 10:39:04) NameError: global name 'kDisableKIandBB' is not defined
(02/17 10:39:04) CampbravoDTBookGUI: OnNotify called
(02/17 10:39:08) CampbravoDTBookGUI: OnNotify called
(02/17 10:39:08) BookNotify  event=6, id=0
(02/17 10:39:08) Close Book
(02/17 10:39:09) CampbravoDTBookGUI: OnNotify called
(02/17 10:39:09) BookNotify  event=2, id=0


Any ideas what this is?
"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

Re: Dynamic Book Template (version 2)

Postby Trylon » Sun Feb 17, 2008 9:03 am

Code: Select all
(02/17 10:39:04) Traceback (most recent call last):
(02/17 10:39:04)   File ".\python\CampbravoDTBookGUI.py", line 80, in OnNotify
(02/17 10:39:04)     PtSendKIMessage(kDisableKIandBB, 0)
(02/17 10:39:04) NameError: global name 'kDisableKIandBB' is not defined


tells me that on line 80 in CampbravoDTBookGUI.py, there is a command "PTSendKIMessage(kDisbleKIandBB,0)", which cannot be executed because the constant "kDIsableKIandBB" isn't set to a value anywhere in the code.
One day I ran through the cleft for the fiftieth time, and found that uru held no peace for me anymore.
User avatar
Trylon
 
Posts: 1446
Joined: Fri Sep 28, 2007 11:08 pm
Location: Gone from Uru

Re: Dynamic Book Template (version 2)

Postby andylegate » Sun Feb 17, 2008 9:21 am

Well that's D'Lanor's scripting, I didn't touch that. Not sure what it's for.

But, I think I know what my problem is:

Basically, I'm trying to create a link to the beginning of Gahreesen. I WANTED to link in at the rooftop, outside where you touch the last journey cloth, but then realized that many people may not have done that yet, so I have to settle for just linking into the beginning.

Now, that's okay, and normally, it's the LinkInPointDefault for Ages. I have that defined in my PageDefs as:

Code: Select all
LinkDestinations = {'cbwelcomebk': (None, None, None, None),
'cbassign': (None, None, None, None),
'cbanswers': (None, None, None, None),
'cbcredits': (None, None, None, None),
'CBlink1': ('Cleft', 'LinkInPointDefault', Default, PtLinkingRules.kOriginalBook),
'GahreesenLink': ('Garrison', 'LinkInPointDefault', Default, PtLinkingRules.kOriginalBook)}


But of course I also needed to set the page up so I used this:

Code: Select all
BookPages = {'cbwelcomebk': (PageStart + Defwelcomebk),
'cbassign': (PageStart + Defassign),
'cbanswers': (PageStart + Defanswers),
'cbcredits': (PageStart + Defcredits),
'CBlink1': (PageStart + ImgStart + 'xLinkPanelCleftDesert*1#0.hsm' + ImgEnd + AlignCenter),
'GahreesenLink': (PageStart + ImgStart + 'xlinkpanelnexusdefault*0#3.hsm' + ImgEnd + AlignCenter)}


I'm thinking that the problem is, it's not finding the xlinkpanelnexusdefault*0#3.hsm to use as the linking panel.
As that's the case, it's failing to create the link to Gahreesen. I'm getting ready to try using a different Image, and see if it shows up, and if I then link to Gahreesen.


EDIT: Later....

Okay, dummy me realized that yes, I was using the wrong linking panel, that one up there is for the Nexus. So I put in the right one, xlinkpanelgarrisondefault*0#2.hsm

Also on a side note, setting the spawn Title to Default kills my linking books working, I set them back to None since they are the default linking books.

Okay, still no joy. Book pops up, no linking panel shown, just a blank page. Cleft book works just fine.

Looking back over the PageDefs file, I read D'Lanor's comments:
###############################################################################
# AgeBooks Dictionary Section: #
# 1 = same names as the clickable book objects! #
# 2 = book cover and margin #
# 3 = main font #
# 4 = start book open or closed. 0 closed book, 1 open book #
# 5 = force owned setting. 0 off, 1 on #
# #
# Notes: - The cover can have the same texture as the book object itself. #
# - You can set the book cover to an empty string if startOpen is 1. #
# - The main font can be changed later in the BookPages definition. #
# If you don't need a main font (because you are changing it later), #
# you can set an empty string. #
# - force owned: If set to 1 the code checks if the original book has #
# been found. A player who does not own the age will not see the #
# linking panel. If you need this restriction set force owned to 1. #
###############################################################################


Okay, my Avie HAS completed the whole game, and yes, he owns the book to Gahreesen.
And again, here is my line of code for this:

Code: Select all
AgeBooks = {'welcomebk': ('<cover src="welcomebookfront"><margin right=32 left=32>', '<font size=12 face=Arial color=000000>', 0, 0),
'assignbook': ('<cover src="assignment"><margin right=32 left=32>', '<font size=12 face=Arial color=000000', 0, 0), 'answers': ('<cover src="answerscover"><margin right=32 left=32>', '<font size=12 face=Airal color=000000>', 0, 0), 'credits': ('<cover src="welcomebookfront"><margin right=32 left=32>', '<font size=12 face=Arial color=000000>', 0, 0), 'linkbook1': ('<cover src="welcomebookfront">', '', 0, 0), 'glink1': ('<cover src="glink1cover">', '', 0, 0)}


As you can see, I have the Forced Own set to 0 for glink1, which is the linking book I'm having problems with. So even if I didn't own the book, the linking panel should still show up.
The log is still not showing an error, it says the linking page is being created........this one sure has me stumped. I'm thinking of going in and chaning to the linking panel to the same one as the cleft, just to see if it will at least show that and allow me to link. I know that you can show the wrong panel and link to somewhere it doesn't show as I used that in Night Time as a bug. I showed the top of the Kadish Pyramid, and you link to the Cleft instead.
Now, see this is a good point. This linking book is the first time I'm trying to use a linking pannel other than the ones D'Lanor had in his original template.
"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

Re: Dynamic Book Template (version 2)

Postby D'Lanor » Sun Feb 17, 2008 10:38 am

Trylon wrote:
Code: Select all
(02/17 10:39:04) Traceback (most recent call last):
(02/17 10:39:04)   File ".\python\CampbravoDTBookGUI.py", line 80, in OnNotify
(02/17 10:39:04)     PtSendKIMessage(kDisableKIandBB, 0)
(02/17 10:39:04) NameError: global name 'kDisableKIandBB' is not defined


tells me that on line 80 in CampbravoDTBookGUI.py, there is a command "PTSendKIMessage(kDisbleKIandBB,0)", which cannot be executed because the constant "kDIsableKIandBB" isn't set to a value anywhere in the code.

Oops, that must be a leftover from Prad, my test age. :oops:

Edit: Hmm, I don't see it in the code I posted here?
"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 2)

Postby andylegate » Sun Feb 17, 2008 10:44 am

Here it is. This is from line 63 to 91. I don't think that's my problem though.

Code: Select all
 else:
            for event in events:
                if (event[0] == PtEventType.kBook) and (PtWasLocallyNotified(self.key)):
                    print('BookNotify  event=%d, id=%d' % (event[1], event[2]))
                    if (event[1] == PtBookEventTypes.kNotifyImageLink):
                        if (event[2] >= xLinkingBookDefs.kFirstLinkPanelID):
                            print('BookNotify: hit linking panel %s' % event[2])
                            ourBook.hide()
                            for i in range(0, len(bkLinks)):
                                if (event[2] == bkLinks[i][0]):
                                    try:
                                        self.IlinkToAge(bkLinks[i][1], bkLinks[i][2], bkLinks[i][3], bkLinks[i][4])
                                    except Exception, detail:
                                        print('ERROR: Unable to initialize link - %s' % (detail))
                                    break
                    elif (event[1] == PtBookEventTypes.kNotifyShow):
                        print('Show Book')
                        PtSendKIMessage(kDisableKIandBB, 0)
                    elif (event[1] == PtBookEventTypes.kNotifyHide):
                        print('Hide Book')
                        PtSendKIMessage(kEnableKIandBB, 0)
                    elif (event[1] == PtBookEventTypes.kNotifyNextPage):
                        print('To Next Page %d' % (ourBook.getCurrentPage()))
                    elif (event[1] == PtBookEventTypes.kNotifyPreviousPage):
                        print('To Previous Page %d' % (ourBook.getCurrentPage()))
                    elif (event[1] == PtBookEventTypes.kNotifyCheckUnchecked):
                        print('Relto Page Toggled')
                    elif (event[1] == PtBookEventTypes.kNotifyClose):
                        print('Close Book')
"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

Re: Dynamic Book Template (version 2)

Postby D'Lanor » Sun Feb 17, 2008 10:54 am

Ah yes... Well, what happened is this. I took out this line that I thought was specific for Prad:

Code: Select all
from PlasmaKITypes import *

...but it turns out it wasn't. I will modify it in my first post.

It could be the problem since everything just aborts at an error like that. But then again others should have had problems too...
"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

PreviousNext

Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests