Re: Dynamic Book Template (version 2)
Posted: Mon Feb 11, 2008 7:13 am
Okay, give me a few minutes, I'm going to have a look. 

Masters of the Art
https://forum.guildofwriters.org/
Code: Select all
xJournalBooks = {'Dummy': (1.0,
1.0,
xDummyJournalEnglish,),
'Sharper': (1.0,
1.0,
xSharperJournalEnglish,
'bkNotebook',),
'ClassStructure': (1.0,
1.0,
xClassStructureJournalEnglish,
'bkNotebook',),
'Pregnancy': (1.0,
1.0,
xPregnancyJournalEnglish,
'bkNotebook',),
Code: Select all
from Plasma import *
from PlasmaTypes import *
import PlasmaControlKeys
Activate = ptAttribActivator(1, ' clickable ', netForce=1)
Vignette = ptAttribString(4, 'Toggle dialog - by Name')
KeyMap = {}
KeyMap[PlasmaControlKeys.kKeyMoveForward] = PlasmaControlKeys.kKeyCamPanUp
KeyMap[PlasmaControlKeys.kKeyMoveBackward] = PlasmaControlKeys.kKeyCamPanDown
KeyMap[PlasmaControlKeys.kKeyRotateLeft] = PlasmaControlKeys.kKeyCamPanLeft
KeyMap[PlasmaControlKeys.kKeyRotateRight] = PlasmaControlKeys.kKeyCamPanRight
LocalAvatar = None
kExit = 99
class xDialogToggle(ptModifier,):
__module__ = __name__
def __init__(self):
ptModifier.__init__(self)
self.id = 5104
version = 1
self.version = version
print '__init__xDialogToggle v.',
print version
def IGetAgeFilename(self):
ageInfo = PtGetAgeInfo()
if (type(ageInfo) != type(None)):
return ageInfo.getAgeFilename()
else:
return 'GUI'
def OnFirstUpdate(self):
PtLoadDialog(Vignette.value, self.key, self.IGetAgeFilename())
def __del__(self):
PtUnloadDialog(Vignette.value)
def OnNotify(self, state, id, events):
global LocalAvatar
if (state and ((id == Activate.id) and PtWasLocallyNotified(self.key))):
LocalAvatar = PtFindAvatar(events)
self.IStartDialog()
def OnGUINotify(self, id, control, event):
if (event == kAction):
if (control.getTagID() == kExit):
self.IQuitDialog()
elif (event == kExitMode):
self.IQuitDialog()
def OnControlKeyEvent(self, controlKey, activeFlag):
PtDebugPrint(('Got controlKey event %d and its activeFlage is %d' % (controlKey,
activeFlag,)), level=kDebugDumpLevel)
if (controlKey == PlasmaControlKeys.kKeyExitMode):
self.IQuitDialog()
def IStartDialog(self):
Activate.disable()
PtLoadDialog(Vignette.value, self.key, self.IGetAgeFilename())
if PtIsDialogLoaded(Vignette.value):
PtShowDialog(Vignette.value)
print ('dialog: %s goes up' % Vignette.value)
PtGetControlEvents(true, self.key)
def IQuitDialog(self):
if ((type(Vignette.value) != type(None)) and (Vignette.value != '')):
PtHideDialog(Vignette.value)
print ('Dialog: %s goes down' % Vignette.value)
else:
print 'WTH!!!'
PtGetControlEvents(false, self.key)
Activate.enable()