clickable objects, again.
- andylegate
- Posts: 2348
- Joined: Mon Oct 01, 2007 7:47 am
- MOULa KI#: 0
clickable objects, again.
Hey guys, thought I'd bring this back up as no one was able to, or had time to, or didn't see my original question:
How do you make it to where you have more than one clickable object? Let me explain:
I know how to make the Area in Blender and make it clickable, the question is not that. The question is how to make more than one object clickable in the scripting. Here is an example:
Let us say I have TWO journals that I want explorers to read. The tutorial on creating A journal is great and it works. But for adding more than one, it just says "you should repeat the code"
And that does not help at all! It doesn't say what code or how.
Next question about it. Now let's say I have other things that I want the explorer to be able to click on and either read or get a closer look. A good example of this Sharper's desk in the Baron's Office. There is a journal to read, but there are also notes, and maps, each one you can click on to bring it up to look at.
Anyone have a better idea about this yet?
How do you make it to where you have more than one clickable object? Let me explain:
I know how to make the Area in Blender and make it clickable, the question is not that. The question is how to make more than one object clickable in the scripting. Here is an example:
Let us say I have TWO journals that I want explorers to read. The tutorial on creating A journal is great and it works. But for adding more than one, it just says "you should repeat the code"
And that does not help at all! It doesn't say what code or how.
Next question about it. Now let's say I have other things that I want the explorer to be able to click on and either read or get a closer look. A good example of this Sharper's desk in the Baron's Office. There is a journal to read, but there are also notes, and maps, each one you can click on to bring it up to look at.
Anyone have a better idea about this yet?
"I'm still trying to find the plKey for Crud!"

Blender Age Creation Tutorials
3DS Max Age Creation Tutorials

Blender Age Creation Tutorials
3DS Max Age Creation Tutorials
Re: clickable objects, again.
I wrote the tutorial, but I had no idea it would be difficult to have more than one journal... Honnestly I don't even think I gave it much thought.. At any rate I have no idea, I wrote the tutorial, but I am not a Python specialist. However I am sure one of our fine codes will come with the answer before the end of the day.. 

Re: clickable objects, again.
You simply distinguish the objects by their names.
Code: Select all
....
actClickableObject = ptAttribActivator(1, 'Act: Clickable Object')
ObjectName = None
class BlahBlah(ptModifier,):
def OnFirstUpdate(self):
global ObjectName
ObjectName = self.sceneobject.getName()
def OnNotify(self, state, id, events):
if ((id == actClickableObject.id) and state):
print 'Someone clicked an object'
if (PtWasLocallyNotified(self.key)):
print 'It was you'
if (ObjectName == 'JournalA'):
....
if (ObjectName == 'JournalB'):
....
"It is in self-limitation that a master first shows himself." - Goethe
- Robert The Rebuilder
- Posts: 1383
- Joined: Sat Sep 29, 2007 7:24 am
- MOULa KI#: 1299
- Location: Virginia, US
Re: clickable objects, again.
...and make sure you indent your code properly; note in D'Lanor's example how the elipses are indented. From what I recall in your last post, Andy, it was unclear how the per-clickable-object code was indented, but it seemed as if they were at the same indent level as the 'if' clause.
Can we rebuild it? Yes, we can - here's how.
MOULagain KI# 1299
Myst Movie coming soon - spread the word!
MOULagain KI# 1299
Myst Movie coming soon - spread the word!
- andylegate
- Posts: 2348
- Joined: Mon Oct 01, 2007 7:47 am
- MOULa KI#: 0
Re: clickable objects, again.
Okay guys, I'll give it a swing and see what happens.
"I'm still trying to find the plKey for Crud!"

Blender Age Creation Tutorials
3DS Max Age Creation Tutorials

Blender Age Creation Tutorials
3DS Max Age Creation Tutorials
- andylegate
- Posts: 2348
- Joined: Mon Oct 01, 2007 7:47 am
- MOULa KI#: 0
Re: clickable objects, again.
Okay......that didn't work.
What it did was crash me to my desktop. Now, I know the code will work for a Journal, as I used it in my first little Age I did, just fine.
I wasn't sure if I was adding a second object correctly, so I put it down to one object: again, crashed to the desktop.
Now, I raised this question in my other post before: uam.showBook or uam.showNotebook. I don't know if either of those codes will work if the object is NOT a journal. I'm trying to make it to where a note pops up. There are no other tutorials.
If you look at what D'lanor put up there in the post above, he's not showing the code for anything either.
Here's the script I made:
note1 is both the name of the object, and my pictures is also note1.jpg
What it did was crash me to my desktop. Now, I know the code will work for a Journal, as I used it in my first little Age I did, just fine.
I wasn't sure if I was adding a second object correctly, so I put it down to one object: again, crashed to the desktop.
Now, I raised this question in my other post before: uam.showBook or uam.showNotebook. I don't know if either of those codes will work if the object is NOT a journal. I'm trying to make it to where a note pops up. There are no other tutorials.
If you look at what D'lanor put up there in the post above, he's not showing the code for anything either.
Here's the script I made:
Code: Select all
def OnNotify(self, state, id, events):
uam.handleNotify(state, id, events)
if (id == actClickableObject.id):
if (ObjectMsg.value == 'note1'):
uam.showBook('<img src="note1" align=center resize=no>', self.key)
note1 is both the name of the object, and my pictures is also note1.jpg
Last edited by andylegate on Fri Dec 14, 2007 4:15 pm, edited 1 time in total.
"I'm still trying to find the plKey for Crud!"

Blender Age Creation Tutorials
3DS Max Age Creation Tutorials

Blender Age Creation Tutorials
3DS Max Age Creation Tutorials
-
- Posts: 1057
- Joined: Fri Sep 28, 2007 8:01 pm
- MOULa KI#: 23247
- Location: US (Eastern Time)
- Contact:
Re: clickable objects, again.
The showBook function can't be used for anything besides books with pages and such. There currently doesn't seem to be a way to show an arbitrary texture as a GUI like you apparently want to do. I think you'd have to make a GUI file and somehow call that up, but I'm not familiar with that, and I'm not sure it's possible anyway.
Also, there's a missing close parenthesis in that last line of that code quote.
Also, there's a missing close parenthesis in that last line of that code quote.
- andylegate
- Posts: 2348
- Joined: Mon Oct 01, 2007 7:47 am
- MOULa KI#: 0
Re: clickable objects, again.
The missing paren is there, I just didn't highlight that far.
Sigh......this sucks. not everything is in a journal......
Sigh......this sucks. not everything is in a journal......
"I'm still trying to find the plKey for Crud!"

Blender Age Creation Tutorials
3DS Max Age Creation Tutorials

Blender Age Creation Tutorials
3DS Max Age Creation Tutorials
-
- Posts: 729
- Joined: Fri Sep 28, 2007 10:54 pm
Re: clickable objects, again.
Hmm...You know the one night Age where you press the hand buttons and it opens doors or displays the nebula on the ceiling (ever talk about that Age over at the GoA, Andy?)? How did the people who made that Age do it? They might be able to help you out.
Re: clickable objects, again.
Jonae. Yes, the German team is quite advanced.
Chacal
"The weak can never forgive. Forgiveness is an attribute of the strong."
-- Mahatma Gandhi
"The weak can never forgive. Forgiveness is an attribute of the strong."
-- Mahatma Gandhi