In Memoriam: Tai'lahr
OpenUru.org, along with the rest of the Mystonline community, is mourning the loss of Tai'lahr on October 16th, 2019.
Rest in Peace, friend.
Difference between revisions of "Making Linking Books and Journals In Max"
Andylegate (talk | contribs) (Created page with "One of the main differences between Cyan's Plugin and PyPRP for Blender, is the fact that with Cyan's Plugin, it's all point and click for your Age, where as in Blender with PyPR...") |
m (Remove HR) |
||
(One intermediate revision by one other user not shown) | |||
Line 215: | Line 215: | ||
Then go over to the Utils Tab and click on Component Utils. Select your Python component, and look at the roll outs: | Then go over to the Utils Tab and click on Component Utils. Select your Python component, and look at the roll outs: | ||
− | http://assets.openuru.org/wiki/andy/MaxTutPics1/ | + | http://assets.openuru.org/wiki/andy/MaxTutPics1/journals6.jpg |
As you can see you have a nothing but a drop down box. Click on it, and scroll down the list until you see your BookGUI python file. | As you can see you have a nothing but a drop down box. Click on it, and scroll down the list until you see your BookGUI python file. | ||
Line 221: | Line 221: | ||
If you don't see it, then you need to go back and make sure you modified the Python file correctly. Specifically where I told you to modify the Version number, etc. | If you don't see it, then you need to go back and make sure you modified the Python file correctly. Specifically where I told you to modify the Version number, etc. | ||
− | http://assets.openuru.org/wiki/andy/MaxTutPics1/ | + | http://assets.openuru.org/wiki/andy/MaxTutPics1/journals6.jpg |
As you can see from the picture, you'll have your Python BookGUI file showing. You also have a button to select the clickable for the Book. This is what tells your python file to run. So click on it and select your Clickable for your book. | As you can see from the picture, you'll have your Python BookGUI file showing. You also have a button to select the clickable for the Book. This is what tells your python file to run. So click on it and select your Clickable for your book. | ||
Line 231: | Line 231: | ||
And that's pretty much it. As for putting in Journal Content, or Linking panels, etc, etc. All that is pretty much the same as my Blender tutorial. | And that's pretty much it. As for putting in Journal Content, or Linking panels, etc, etc. All that is pretty much the same as my Blender tutorial. | ||
− | |||
{{ALTutorials}} | {{ALTutorials}} |
Latest revision as of 15:49, 29 July 2011
One of the main differences between Cyan's Plugin and PyPRP for Blender, is the fact that with Cyan's Plugin, it's all point and click for your Age, where as in Blender with PyPRP you have to use ALCscripting.
Some like one way over the other. I personally like the point and click, but I know people that really like using scripting better. With this subject, adding a Journal or a Linking Book actually IS easier with Blender and PyPRP.
Here is why:
With Blender and the PyPRP plugin, you type in the scripting for adding a python file to an object. Any variables are typed in by you. You just have to make sure your python file reflects those variables. D'Lanor's template makes doing all this even easier.
But with Cyan's Plugin, it needs to see your python file (where as in Blender, you can just go ahead and type it all in, and worry about the python file later), BEFORE you do anything in Max! The reason for this is Cyan's Plugin will have buttons and boxes that you have to click on to assign your variables, and it gets these from your Python file.
Just slapping D'Lanor's template file in there will not work either I'm afraid. His template has to be modified slightly before Cyan's Plugin will recognize it (don't ask me why, I just know it has to be done this way, else you won't see your python file in the drop down box when you assign the Python Component to your book).
So first things first: Let's do some Python editing!
Python, the Sssssssss in programing!
First you are going to need D'Lanor's templates. If you don't have his latest that's handy, here is a link:
GoW Forum Link where you can read about it, and copy and paste the code from there.
Now that you have the files, open them up in whatever program you like to edit Python files with. I use Plasma Shop, some people like to use Urupython, but it's really up to you.
Open up the BookGUI python file first. Later you will save this file as YourAgeNameBookGUI.py
When you open it up, you will see this at the beginning of the file:
###########################################
# #
# Dynamic Book Template v4.1 by D'Lanor #
# #
###########################################
# Change each occurrence of *YourAge* to the actual name of your age.
# Do the same with the file names.
from Plasma import *
from PlasmaTypes import *
from PlasmaKITypes import *
from PlasmaNetConstants import *
import xLinkingBookDefs
actClickableObject = ptAttribActivator(1, 'Act: Clickable Object')
strObject = ptAttribString(2, 'Object String')
Behavior = ptAttribBehavior(3, 'Avatar link animation (optional)')
### DO NOT CHANGE THESE VARIABLES/CONSTANTS! ###
ourBook = None
bkLinks = []
ageLinkStruct = None
kLinkID = 1
publicAges = []
kPublicAgeLink = 6
kPublicAgesMOUL = ['city',
'Neighborhood',
'Neighborhood02',
'GreatTreePub',
'GuildPub-Cartographers',
'GuildPub-Greeters',
'GuildPub-Maintainers',
'GuildPub-Messengers',
'GuildPub-Writers',
'philRelto',
'Kveer']
### CHANGE THE GLOBAL CONSTANTS BELOW TO FIT YOUR AGE ######################################
# #
# modPageDefs: Replace *YourAge*PageDefs with the name of the module that contains your #
# page definitions. #
# ageBooks These are your clickable objects. They must be defined in *YourAge*PageDefs #
# in the AgeBooks Dictionary Section by the same name(s). #
# bookPages Names in bookPages must be defined in the *YourAge*PageDefs file under #
# BookPages. An ageBook can have multiple bookPages as long as they are #
# enclosed together between the same square brackets. #
# Always keep the nesting structure [[double square brackets]] intact! #
# parentAge If you are using the kChildAgeBook linking rule you can set a parent age. #
# Child ages are only useful for ages which have multiple owners (currently #
# only Neighborhood!). All parent age owners share the same instance of the #
# child age. Using any other parent age than Neighborhood makes no sense. #
# kLinkDelay Delay for the optional avatar link animation to finish. You may have to #
# tweak it since 3.5 is an estimate. #
# vOpenSource For future Uru Open Source support. For now keep this set to false. #
# #
# If there are multiple books in an age the code will find the right one automagically. #
# You can add as many books as you like. Just define them in the global variables ageBooks #
# and bookPages. The order is important here. The first book will be matched to the first #
# page list, the second book to the second page list etc. #
############################################################################################
modPageDefs = '*YourAge*PageDefs'
ageBooks = ['Journal01', 'Journal02']
bookPages = [['PradJournal', 'CleftSpecial'], ['FontTest']]
parentAge = 'Neighborhood'
kLinkDelay = 3.5
vOpenSource = false
class *YourAge*BookGUI(ptModifier,):
def __init__(self):
ptModifier.__init__(self)
self.version = '4.1'
self.me = self.__class__.__name__
self.PageDefs = __import__(modPageDefs)
print ('__init__%s v.%s' % (self.me, self.version))
As you can see, D'Lanor was kind enough to put instructions in these files, so I will not be going into a lot of depth as far as what you are suppose to put where, when he has already done this. What I am going to ask you to do, is scroll down to where you see:
class *YourAge*BookGUI(ptModifier,):
def __init__(self):
ptModifier.__init__(self)
self.version = '4.1'
self.me = self.__class__.__name__
self.PageDefs = __import__(modPageDefs)
print ('__init__%s v.%s' % (self.me, self.version))
You need to change this. Yes, you need to change "*YourAge*BookGUI" to the name of you Age (like mine is NeolbahBookGUI), but you are going to have to change the def below it. Cyan's plugin does not like this, and if you leave it like it is, your python file WILL NOT SHOW UP IN THE DROP DOWN BOX IN MAX!
Here is what you should change it to:
class NeolbahBookGUI(ptModifier,):
__module__ = __name__
def __init__(self):
ptModifier.__init__(self)
self.id = 5112002
version = 27
minor = 4
self.version = version
self.me = self.__class__.__name__
self.PageDefs = __import__(modPageDefs)
PtDebugPrint(('__init__NeolbahBookGUI v%d.%d' % (version,
minor)))
The self.id number you can make up. I normally just take my Age's sequence number and tack on 3 digits after that, in this case it was 002. However the version number and minor number ARE important. Use EXACTLY what I have. Cyan's Plugin looks at version numbers and if you use something other than what I have up here, it's going to get VERY upset with you.
Okay, now go in and follow D'Lanor's instructions on the rest of the file, mod or add the things he tells you to.
"But Andy, I've not made any of those things in Max yet!" you say. And I say: "Then WRITE THEM DOWN, and use them later when you DO create those things in Max".
Okay, now you can save the file as YourAgeNameBookGUI and you are done with it for now.
Now you have to open up D'Lanor's PageDefs template in your python editor. You will be having to do things in here according to D'Lanor's instructions. Again, he has put instructions that tell you what to do.
However, and this is VERY IMPORTANT, there is one line we need to change. Let me show you:
# For each occurrence of *YourAge* and *YourTexture* you have to replace this with
# the actual name of your age and your textures.
from Plasma import *
from PlasmaNetConstants import *
# Due to their length journal texts are usually stored in external Python files.
# The line below imports them. Remove this line if you do not use external journals.
from NeolbahJournals import *
kPublicAgeLink = 6
# Variables that can be used in BookPages:
PageStart = '<pb>'
ImgStart = '<img src="'
TransImgStart = '<img opacity=0.7 src="'
ImgEnd = '" align=center link=%d blend=alpha>'
ImgEndNoLink = '" align=center blend=alpha>'
ImgEndNoResize = '" align=center link=%d blend=alpha resize=no>'
ImgEndNoLinkNoResize = '" align=center blend=alpha resize=no>'
AlignCenter = '<p align=center>'
AlignLeft = '<p align=left>'
AlignRight = '<p align=right>'
# Variables for animated linking panels. See BikTest. Does NOT work with UU!
MovieLinkStart = '<movie src="avi\\'
MovieLinkEnd = '.bik" align=center link=%d resize=yes>'
# Retrieve local player name in case you want to fake a "personal" note
plyrName = PtGetLocalPlayer().getPlayerName()
Go down to the last line where it says "plyrName = PtGetLocalPlayer().getPlayerName()" and put at "#" symbol in front of it so now it looks like this:
#plyrName = PtGetLocalPlayer().getPlayerName()
That's all you need to do other than D'Lanor's instructions. I know, such a small thing. But if you don't MAX WILL CRASH HORRIBLY WHEN IT GOES TO LOAD!
I mean you'll hear it scream, smoke will come out of your computer........well okay, maybe I'm exagertating a bit here, but yah, Max will crash while it's trying to load Cyan's Plugin. You'll get some ugly .dll error. I'm not sure why this line causes it, but it does.
So if you wanted to have the player's name show up in a journal, forget it. At least you're not going to be able to do it this way.
Okay, now you are pretty much done with the Python files. You need to go ahead and save them, then pack them into the pak file, then extract them again. This is because you need to have the complied and uncompiled versions in your Python folders for Plasma Test. So that's the next thing, copy your BookGUI and PageDefs files over to where you have your Python files for Max (both the .py and .pyc versions.).
EDIT: Make SURE you copy and paste over ALL THREE files! Your BookGUI, your PageDefs, and if you have one, your Journal python files to your Export Python folder for Max. If you do not, your BookGUI file will NOT show up in the drop down box.
Now load up Max (and if it crashes, go back over what I told you to do!)
Load up your Age, and let's get to work:
What You Do In Max
Okay, now if you have not already, you need to create your Journal or Linking book in Max, put it where you want it and texture it. You also need to make a clickable for it. For how to do that, please see my other tutorials on this.
Now you're ready to tell it what to do when you click on it. Open up the Component Manager and click on New > Logic > Python and attach the python to the book. Rename it to something useful other than Python02 or whatever.
Then go over to the Utils Tab and click on Component Utils. Select your Python component, and look at the roll outs:
http://assets.openuru.org/wiki/andy/MaxTutPics1/journals6.jpg
As you can see you have a nothing but a drop down box. Click on it, and scroll down the list until you see your BookGUI python file.
If you don't see it, then you need to go back and make sure you modified the Python file correctly. Specifically where I told you to modify the Version number, etc.
http://assets.openuru.org/wiki/andy/MaxTutPics1/journals6.jpg
As you can see from the picture, you'll have your Python BookGUI file showing. You also have a button to select the clickable for the Book. This is what tells your python file to run. So click on it and select your Clickable for your book.
You also have a Text Box that says "Object String". In here you type in the name of you used in "agebook" from your BookGUI python file.
And last you have a button for Avatar Animation. If you don't have one for this book, just leave it alone. If you do, click on it and select the One Shot that you used for the animation of this book.
And that's pretty much it. As for putting in Journal Content, or Linking panels, etc, etc. All that is pretty much the same as my Blender tutorial.
Return To: 3DS Max Plugin Tutorials
A copy of the license is included in the section entitled "GNU Free Documentation License".