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 andylegate » Wed Apr 23, 2008 5:41 am

don't include the asterisks.

Normally it tells you what line there is a syntax error. Go to that line and look at what you have and compare it to the template. Most syntax errors are typos. If it is that line you showed in your post, what we need to see is your line you typed, not the template's.
"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 3.0)

Postby Whilyam » Wed Apr 23, 2008 7:00 am

Code: Select all
class FensBookGUI(ptModifier,):


It's identical to the template, but instead of *YourAge* it's Fens.
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 8:00 am

okay, that line looks fine. It should not be giving you a syntax error at all. Are you sure that's the line it is talking about when you get the error? Here is an example of one of my python files for Journals/Linking books, as you can see my line looks just like yours except for the name:

Code: Select all
class CampbravoBookGUI(ptModifier,):


Now here is an example of a syntax error that PlasmaShop gives me. I made this one on purpose:

Code: Select all
Compiling all uncompiled files...

Listing C:\DOCUME~1\Andy\LOCALS~1\Temp\tmp992.tmp ...
Compiling C:\DOCUME~1\Andy\LOCALS~1\Temp\tmp992.tmp\CampbravoBookGUI.py ...
  File "C:\DOCUME~1\Andy\LOCALS~1\Temp\tmp992.tmp\CampbravoBookGUI.py", line 40
    print ('%s: OnNotify called'' % self.__class__.__name__)
                                                           ^
SyntaxError: invalid token


As you can see, it says line 40. I go look at line 40 and oops, I have one to many single quotes in it:

Code: Select all
   def OnNotify(self, state, id, events):
        print ('%s: OnNotify called'' % self.__class__.__name__)
"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 3.0)

Postby Whilyam » Wed Apr 23, 2008 8:22 am

Yep, it says Line 42 is the one with the error:

Code: Select all
  class FensBookGUI(ptModifier,):
        ^
SyntaxError: invalid syntax

Is the little arrow pointing to "class" because it's the part that's wrong or because that's its default position?

Perhaps some of the code before it is bad? It goes:

Code: Select all
modPageDefs = __import__('FensPageDefs')
ageBooks = ['book']
bookPages = [['FensJournal']

class FensBookGUI(ptModifier,):


FensPageDefs being the .py file's name, "book" being the object in the age, FensJournal being the other .py file's name.

Also, if this does work, how do I want to compile this? In Python.pak or in someling like "Fens.pak" ?
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 8:25 am

bookpages is missing the closing ]
"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 8:29 am

And done! Thanks, D'lanor :D

Now, could anyone the steps to make the book clickable (I'm confused if the logic property is in the logic tab of the physical book or if it's a section of ALCscript). Also, how do I make a click region?
User avatar
Whilyam
 
Posts: 1023
Joined: Sat Sep 29, 2007 5:55 pm

Re: Dynamic Book Template (version 3.0)

Postby Robert The Rebuilder » Wed Apr 23, 2008 9:04 am

Here's some rough steps to get you going. [Note to self and others: there really should be a Wiki tutorial on this!]

To create a click region:
- Choose Scripts->Add->PyPRP, then choose "Add a (Generic) Logic Region". It will appear in layer 2.
- Select it, then move it to the place where the avatar will be standing when they attempt to click on the object
- Scale it so that it can encompass an avatar and the object that is clickable, then hit Ctrl-A to apply scale and rotation into the vertices
- Rename the object to something meaningful (e.g. MyClickRegion)
- On the Logic panel, click on Bounds, then set it to "Convex Hull Polytope"
- Click the Actor button on the Logic panel

To make an object clickable:
- Select the object
- On the Logic panel, click on Bounds, then set it to "Convex Hull Polytope"
- Click the Actor button on the Logic panel
- Add the following AlcScript entry:

Code: Select all
ObjectName:
    physical:
        pinned: true
    quickscript:
        simpleclick:
            pythonfile: myPythonFile
            region: MyClickRegion

But change "ObjectName" to your object's name, "myPythonFile" to the name of your python file, and "MyClickRegion" to the name of your click region.
Can we rebuild it? Yes, we can - here's how.

MOULagain KI# 1299

Myst Movie coming soon - spread the word!
User avatar
Robert The Rebuilder
 
Posts: 1383
Joined: Sat Sep 29, 2007 7:24 am
Location: Virginia, US

Re: Dynamic Book Template (version 3.0)

Postby andylegate » Wed Apr 23, 2008 9:43 am

I was going to post a link for Whilyam to the alcugs tutorial, but realized that it's kind of obsolete now.
"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 3.0)

Postby D'Lanor » Wed Apr 23, 2008 9:52 am

Your description would be perfect for a wiki entry, Robert. It does not seem rough at all to me but very to-the-point.

I agree that quickscripts should be in the wiki. I assumed they were in the "Beginners guide to Alcscript" article, but nope. :?


Edit: I have a question. Not all of my clickables have the pinned property and not all of them have the convex hull polytype bounds, although my books do. Are these really necessary? I know I lost clickability on an object that did not have these though...

Oh and Andy, there is nothing in the current 1.3 release that even looks for a clickfilex logic property. I did a search through all the files and it came up with nothing. It seems this is becoming an urban legend. ;)
"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 andylegate » Wed Apr 23, 2008 11:28 am

Oh and Andy, there is nothing in the current 1.3 release that even looks for a clickfilex logic property. I did a search through all the files and it came up with nothing. It seems this is becoming an urban legend. ;)


Then we really, really, REALLY need to get something in our Wiki as right now the only tutorials on making something clickable is over at Alcugs, and when new people ask on here someone might tell them to go there. And of course they'll end up back here asking what they did wrong.

I just did a search of the forum with the word "Clickables" got 36 hits (4 pages worth), not too bad.
"Journals" gave me 233 hits, 24 pages worth. I know we ask people to search, but come on guys, that's a bit much.
"Linking Books" gave me 337 hits, 34 pages (so even worse)

of course you can expand your search to narrow it down....or rather that's the THEORY. I just tried "making a clickable" and instead of 36 hits with just "clickable" I got back 129 matches, or 13 pages.

EDIT: There, I just copied Robert's Post over to the Wiki for a quick fix. Someone can make it pretty later. Now we need one for journals.. :D :D (but really, I have to say a link to your excellent template would be just as good)
"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