clickable objects, again.

If you feel like you're up to the challenge of building your own Ages in Blender or 3ds Max, this is the place for you!

clickable objects, again.

Postby andylegate » Fri Dec 14, 2007 11:17 am

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?
"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: clickable objects, again.

Postby Aloys » Fri Dec 14, 2007 11:40 am

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.. :)
User avatar
Aloys
 
Posts: 1968
Joined: Sun Oct 21, 2007 7:57 pm
Location: France (GMT +1)

Re: clickable objects, again.

Postby D'Lanor » Fri Dec 14, 2007 11:54 am

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
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: clickable objects, again.

Postby Robert The Rebuilder » Fri Dec 14, 2007 12:05 pm

...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!
User avatar
Robert The Rebuilder
 
Posts: 1383
Joined: Sat Sep 29, 2007 7:24 am
Location: Virginia, US

Re: clickable objects, again.

Postby andylegate » Fri Dec 14, 2007 12:09 pm

Okay guys, I'll give it a swing and see what happens.
"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: clickable objects, again.

Postby andylegate » Fri Dec 14, 2007 4:06 pm

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:

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!"
Image
Blender Age Creation Tutorials
3DS Max Age Creation Tutorials
User avatar
andylegate
 
Posts: 2348
Joined: Mon Oct 01, 2007 7:47 am

Re: clickable objects, again.

Postby Nadnerb » Fri Dec 14, 2007 4:10 pm

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.
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: clickable objects, again.

Postby andylegate » Fri Dec 14, 2007 4:15 pm

The missing paren is there, I just didn't highlight that far.

Sigh......this sucks. not everything is in a journal......
"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: clickable objects, again.

Postby Jennifer_P » Fri Dec 14, 2007 4:43 pm

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.
Jennifer_P
 
Posts: 729
Joined: Fri Sep 28, 2007 10:54 pm

Re: clickable objects, again.

Postby Chacal » Fri Dec 14, 2007 5:45 pm

Jonae. Yes, the German team is quite advanced.
Chacal


"The weak can never forgive. Forgiveness is an attribute of the strong."
-- Mahatma Gandhi
User avatar
Chacal
 
Posts: 2515
Joined: Tue Nov 06, 2007 2:45 pm
Location: Quebec, Canada

Next

Return to Building

Who is online

Users browsing this forum: No registered users and 3 guests

cron