Python confusion

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!

Re: Python confusion

Postby D'Lanor » Sun Mar 15, 2009 4:39 pm

Most common cause of crashing after adding an animation: Remember to make the animated object an actor. And sdlname must be just the name not the whole line from the sdl file.

sdlname: WindowOpen
"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: Python confusion

Postby Justintime9 » Sun Mar 15, 2009 6:36 pm

well, it exported fine, but when I got to the window, it was looping: Opening, and rather than closing, starting back at the starting point. Also, the button didn't work, it was stretched, and too big.

The empty I used, I put in the button, with the Y axis pointing away from it, and the only thing I changed was the name (no logic properties), so that may be the reason for the non-clickableness.

As far is it's largeness, I recall hearing something about changing transform properties. And the looping, I don't know why this happens, for as you can see, there's a script telling it not to loop.
User avatar
Justintime9
 
Posts: 1188
Joined: Sat Sep 29, 2007 5:37 am

Re: Python confusion

Postby D'Lanor » Mon Mar 16, 2009 3:51 am

I thought it was just a forum copy/paste thing but if your Alcscript really looks like that the indentation is completely wrong. That is why it still loops. Proper indentation would be:

Code: Select all
BayWindow:
    animations:
      - name: WinOpen
        autostart: 0
        loop: 0


Press ctrl+a and apply scaling to the button. And if it has no hotspot, did you follow the tutorial for making clickables?
"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: Python confusion

Postby Justintime9 » Mon Mar 16, 2009 1:16 pm

Well, I fixed the AlcScript, made sure the Empty was in the right place, and an actor, scaled the region better, rotated it so the local Y axis is pointing away from the button, and applied Scale and rotation. When I linked in, I saw that the button was the correct size and shape, but unfortunately it wasn't clickable, and the window still loops. Everything seems to be set correctly. Any idea what could be wrong now? :P
User avatar
Justintime9
 
Posts: 1188
Joined: Sat Sep 29, 2007 5:37 am

Re: Python confusion

Postby D'Lanor » Mon Mar 16, 2009 11:42 pm

I have no idea why your animation still loops. Unless you made an error in the object reference. Did you add the ipo to an empty as a parent for the animation? Then that empty is the object you need to reference in your animation script.

And try doing the clickable without facing condition first. An error in the facing condition will break clickability.
"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: Python confusion

Postby Justintime9 » Thu Mar 19, 2009 2:45 pm

I decided to start all over, referring to Andy Legate's tutorial this time. (same quickscript you provided.) I noticed that some things were missing from the code, and I assume they were unnecessary, taken out for simplicity sake. Here's my code now:
Code: Select all
BayWindow:
    animations:
        - name: WindowAnim
          autostart: 0
          loop: 0
   
WindowButton:
    quickscript:
        stateanimation:
            objectname: BayWindow
            region: WinReg
            sdlname: WindowOpenVis
            avatar:
                animation: DoorButtonTouch
                animtarget: AvatarEmpty
            forewards:
                animation: WindowAnim
            backwards:
                animation: WindowAnim

Before I exported it, I deleted the save file of the age. I also added "Vis" after "WindowOpen (sdlname). Aparently one of these things worked, because when I linked in, the window wasn't looping and was in the closed position. However, the button still doesn't work! I have the Empty about 2 feet away from it, Y axis pointing away, it's an actor, as well as the region, button, and the window. Am I supposed to have the region's Local Y axis pointing away from the button, because if not, this may be the problem.

Edit: Perhaps it'd be easier to identify the problem if you take a look at the blendfile: http://www.mediafire.com/?sharekey=a8f7 ... 6e282a0ee8
User avatar
Justintime9
 
Posts: 1188
Joined: Sat Sep 29, 2007 5:37 am

Re: Python confusion

Postby Corvus » Fri Mar 20, 2009 12:22 am

I'm a complete layman here, but comparing your alcsript with mine for a door button I would guess you are missing this:

Code: Select all
         
WindowButton:
    physical:
        pinned: true
 
 
"To regard the imagination as metaphysics is to think of it as part of life, and to think of it as part of life is to realize the extent of artifice. We live in the mind."

-Wallace Stevens-
User avatar
Corvus
 
Posts: 204
Joined: Fri Feb 15, 2008 11:21 am
Location: Germany

Re: Python confusion

Postby Justintime9 » Fri Mar 20, 2009 3:40 am

Well, I added it to the end of the script like so:
Code: Select all
WindowButton:
    quickscript:
        stateanimation:
            objectname: BayWindow
            region: WinReg
            sdlname: WindowOpenVis
            avatar:
                animation: DoorButtonTouch
                animtarget: AvatarEmpty
            forewards:
                animation: WindowAnim
            backwards:
                animation: WindowAnim
                WindowButton:
                    physical:
                        pinned: true


(I also tried making it line up with "backwards", but neither worked.) Is it supposed to be a seperate script?
User avatar
Justintime9
 
Posts: 1188
Joined: Sat Sep 29, 2007 5:37 am

Re: Python confusion

Postby Corvus » Fri Mar 20, 2009 4:24 am

Yes, it goes separate. This is how mine looks:

Show Spoiler
"To regard the imagination as metaphysics is to think of it as part of life, and to think of it as part of life is to realize the extent of artifice. We live in the mind."

-Wallace Stevens-
User avatar
Corvus
 
Posts: 204
Joined: Fri Feb 15, 2008 11:21 am
Location: Germany

Re: Python confusion

Postby D'Lanor » Fri Mar 20, 2009 10:04 am

No, it should not be a separate script. Each object should have a single alcscript. Sometimes PyPRP appends scripts but in most cases one will override the other. You are taking a big gamble there. I think it just happens to work with Corvus' quickscript because quickscripts are usually set to append.
"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

PreviousNext

Return to Building

Who is online

Users browsing this forum: No registered users and 1 guest