PDA

View Full Version : Alice is passing the wrong object paramter


roofy
10-24-2006, 03:16 PM
Hi there,
It is now time for me to start on my second project in my fundementals of programming class. I thought of creating a ring toss game but there is one problem I am having. When I create a mouse clicked on something event, and I pass the "mouse under the object" to my parameter of my custum event handler, alice is passing the wrong object. What I want Alice to do is say this

**********************************************
Event: when the mouse is clicked on anyobject
Event handler: prepareToss(mouse under the object)

parameter: mouseObject

do in order
if mouseObject == ringToss.bottle2 then
call ring.tossRing(mouseObject)
**********************************************

**********************************************
method ring.tossRing
parameters: mouseObject

do in order
have camera turn to face mouseObject
have ring move to mouseObject
**********************************************

now what this means, and if I am correct, is the ring.tossRing method should be called only if the clicked object is ringToss.bottle2. However, when I tested it, by clicking on bottle2, nothing happens. I then tested the parameter by putting it inside a print construction, and here I found out that no matter what bottle I click on, mouseObject parameter is always being passed as world.ringToss. So in other words, if I click on bottle1 the mouse result pass as world.ringToss, and if I click on bottle2, the mouse result would pass as world.ringToss, and so on.

So my question is, since it seems like Alice does not like passsing children of the main object, is there anyway I can have Alice to ignore the parent object and go straght to the child object?

Mr Nemo
10-24-2006, 08:51 PM
1. Select ringtoss.bottle2
2. Go to properties page for the object
3. Click on "Seldom used Properties"
4. Scroll down to "is First Class"
5. Set "is First Class" to true

Then it should work!:) :D If it doesn't you can yell at me!;)

roofy
10-24-2006, 09:50 PM
1. Select ringtoss.bottle2
2. Go to properties page for the object
3. Click on "Seldom used Properties"
4. Scroll down to "is First Class"
5. Set "is First Class" to true

Then it should work!:) :D If it doesn't you can yell at me!;)

yupper's!! that did the trick. Thanks Mr. Nemo

DrJim
10-25-2006, 07:42 PM
Wow :eek: - how did you figure that one out, Mr. Nemo?

I set "is First Class" false a lot to avoid moving stuff I don't want to when editing a sceen but never saw anything come in that way nor did I realize it would inhibit the "click on" function while the world is running (though with hindsight that's somewhat obvious).

Jim

Mr Nemo
10-25-2006, 09:06 PM
In order to manipulate second-class objects (like an arm for instance) in the add objects view, you have to check the "affect sub-parts" box. I figured that since the subparts are really just non-first class objects, turning them to first class would work for the above instance.