Could have been two rotating doors..

Help bring our custom Ages to life! Share tips and tricks, as well as code samples with other developers.

Could have been two rotating doors..

Postby Tinuviel » Sat Sep 27, 2008 2:08 pm

I'm back:-) And as always with some questions... This time I'm trying to make two rotating doors. There are probably some other and easyer way to do this, and if so: I would be very grateful for any help.
The problem is that I want to be able to press on any of the two doors and then both will open. (Not just the one I pressed.) The doors them self are the clickabol object, and I have an empty for each door, and a region for each door. The empty is also animated to follow the doors. The problem now is that when I enter my age the doors are open instead of closed and they are not clickabole. As always I guess the error on my part is something very simple, but right now I to tired to see it:-)
Here is the alcscript for one of the doors. I have the same alcskript for door two.
Code: Select all
TowerDoor1:
    animations:
      - name: TowerDoorOpen1   #name of animation
        autostart: 0
        loop: 0
    logic:
        modifiers:
            cursor: poised
            flags:
              - localelement
            activators:
              - type: objectinvolume
                remote: TowerDoorclick  #<click region>
                triggers:
                  - any
            conditions:
              - type: activator
                activators:
                  - type: picking
              - type: objectinbox
                satisfied: true
            actions:
              - type: responder
                ref: OpenBothDoors1
              - type: responder
                ref: CloseBothDoors1
        actions:
          - type: responder
            name: OpenBothDoors1
            responder:
                states:
                  - cmds:
                      - type: oneshotmsg
                        params:
                            receivers:
                              - oneshotmod:TowerButtonShot1  #<seek point name>
                            callbacks:
                              - marker: "DoorButtonTouch"
                                receiver: respondermod:OpenBothDoors1  #<responder name>
                                user: 0
                        waiton: -1
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:TowerDoor1
                            animname: TowerDoorOpen1
                            cmds:
                              - setforewards
                              - continue
                        waiton: 0
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:TowerButtonShot1
                            animname: emptyRotate1
                            cmds:
                              - setforewards
                              - continue
                        waiton: 0
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:TowerDoor2
                            animname: TowerDoorOpen2
                            cmds:
                              - setforewards
                              - continue
                        waiton: 0
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:TowerButtonShot2
                            animname: emptyRotate2
                            cmds:
                              - setforewards
                              - continue
                        waiton: 0
                    nextstate: 0
                    waittocmd:
                      - key: 0
                        msg: 0
                curstate: 0
                flags:
                  - detecttrigger
          - type: responder
            name: CloseBothDoors1
            responder:
                states:
                  - cmds:
                      - type: oneshotmsg
                        params:
                            receivers:
                              - oneshotmod:TowerButtonShot1  #<seek point name>
                            callbacks:
                              - marker: "DoorButtonTouch"  #<avatar animation marker name>
                                receiver: respondermod:CloseBothDoors  #<responder name>
                                user: 0
                        waiton: -1
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:TowerDoor1
                            animname: TowerDoorOpen1
                            cmds:
                              - setbackwards
                              - continue
                        waiton: 0
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:TowerButtonShot1
                            animname: emptyRotate1
                            cmds:
                              - setbackwards
                              - continue
                        waiton: 0
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:TowerDoor2
                            animname: TowerDoorOpen2
                            cmds:
                              - setbackwards
                              - continue
                        waiton: 0
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:TowerButtonShot2
                            animname: emptyRotate2
                            cmds:
                              - setbackwards
                              - continue
                        waiton: 0
                    nextstate: 0
                    waittocmd:
                      - key: 0
                        msg: 0
                curstate: 0
                flags:
                  - detecttrigger


TowerDoor2:
    animations:
      - name: TowerDoorOpen2
        autostart: 0
        loop: 0

TowerButtonShot1:  #<seek point object>:  #the empty
   animations:
     - name: emptyRotate1
       autostart: 0
       loop: 0
   logic:
        actions:
          - type: oneshot
            name: TowerButtonShot1
            oneshot:
                animation: DoorButtonTouch


Edit: Found some errors on my alcscript. Now my doors are clickable and they animate. But door 2 is not triggered by my clicking and the doors only open. They will not be closed. Alcscript above have been updated
«Borders? I have never seen one, but I have heard they exist in the minds of some people.»
(Thor Heyerdahl)
Tinuviel
 
Posts: 106
Joined: Wed Feb 06, 2008 10:17 am

Re: Could have been two rotating doors..

Postby Jennifer_P » Sun Sep 28, 2008 11:05 pm

Sorry I haven't been able to help out any with the alcscript yet, Tinuviel; the fact is, I haven't even been able to finish the regular assignments in my computer science class (eep!). :roll:
Jennifer_P
 
Posts: 729
Joined: Fri Sep 28, 2007 10:54 pm

Re: Could have been two rotating doors..

Postby Tinuviel » Mon Sep 29, 2008 1:05 am

Oh, thats ok:-) I know you are full up. I have now got so far that both doors open, but my avatar insist on closing them imidiatly without asking for my permision :D
«Borders? I have never seen one, but I have heard they exist in the minds of some people.»
(Thor Heyerdahl)
Tinuviel
 
Posts: 106
Joined: Wed Feb 06, 2008 10:17 am

Re: Could have been two rotating doors..

Postby boblishman » Mon Sep 29, 2008 9:29 am

Code: Select all
receiver: respondermod:CloseBothDoors  #<responder name>


should read CloseBothDoors1
when it comes to Age creation ... "DOH" seems to be my middle name...
User avatar
boblishman
 
Posts: 882
Joined: Fri Oct 05, 2007 4:47 pm
Location: Spain

Re: Could have been two rotating doors..

Postby Tinuviel » Mon Sep 29, 2008 12:47 pm

Thanks Boblishman. As said: I'm probably just doing something stupid again. Corrected my error but I still can't get it. My avatar clicks to open the doors, they open and then my avatar moves over to click on the doors again. And therby closing them:-) And now I can't get in to my tower :lol:

I guess I have to go back to using a button again. That I managed to work. (I know it's hard to belive, but honestly I did make that work!)
«Borders? I have never seen one, but I have heard they exist in the minds of some people.»
(Thor Heyerdahl)
Tinuviel
 
Posts: 106
Joined: Wed Feb 06, 2008 10:17 am

Re: Could have been two rotating doors..

Postby D'Lanor » Mon Sep 29, 2008 4:33 pm

Hmm yes, that is exactly what you are telling it to do by adding both responders as actions for the modifier. You need a state toggling mechanism as described on the wiki.

Edit: Here you go for the alcscript.

Code: Select all
TowerDoor1:
    animations:
      - name: TowerDoorOpen1   #name of animation
        autostart: 0
        loop: 0
    logic:
        modifiers:
          - tag: ClickMe
            cursor: poised
            flags:
              - localelement
            activators:
              - type: objectinvolume
                remote: TowerDoorclick  #<click region>
                triggers:
                  - any
            conditions:
              - type: activator
                activators:
                  - type: picking
              - type: objectinbox
                satisfied: true
            actions:
              - type: pythonfile
                ref: $BoolToggle
        actions:
          - type: pythonfile
            tag: BoolToggle
            pythonfile:
                file: xAgeSDLBoolToggle
                parameters:
                  - type: activator
                    ref: logicmod:$ClickMe
                  - type: string
                    value: <SDL Name>
                  - type: skip
                  - type: skip
                  - type: string
                    value: <SDL Name>
          - type: pythonfile
            tag: BoolRespond
            pythonfile:
                file: xAgeSDLBoolRespond
                parameters:
                  - type: string
                    value: <SDL Name>
                  - type: responder
                    ref: :OpenBothDoors1
                  - type: responder
                    ref: :CloseBothDoors1
                  - type: bool
                    value: false
                  - type: bool
                    value: true
          - type: responder
            name: OpenBothDoors1
            responder:
                states:
                  - cmds:
                      - type: oneshotmsg
                        params:
                            receivers:
                              - oneshotmod:TowerButtonShot1  #<seek point name>
                            callbacks:
                              - marker: "DoorButtonTouch"
                                receiver: respondermod:OpenBothDoors1  #<responder name>
                                user: 0
                        waiton: -1
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:TowerDoor1
                            animname: TowerDoorOpen1
                            cmds:
                              - setforewards
                              - continue
                        waiton: 0
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:TowerButtonShot1
                            animname: emptyRotate1
                            cmds:
                              - setforewards
                              - continue
                        waiton: 0
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:TowerDoor2
                            animname: TowerDoorOpen2
                            cmds:
                              - setforewards
                              - continue
                        waiton: 0
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:TowerButtonShot2
                            animname: emptyRotate2
                            cmds:
                              - setforewards
                              - continue
                        waiton: 0
                    nextstate: 0
                    waittocmd:
                      - key: 0
                        msg: 0
                curstate: 0
                flags:
                  - detecttrigger
          - type: responder
            name: CloseBothDoors1
            responder:
                states:
                  - cmds:
                      - type: oneshotmsg
                        params:
                            receivers:
                              - oneshotmod:TowerButtonShot1  #<seek point name>
                            callbacks:
                              - marker: "DoorButtonTouch"  #<avatar animation marker name>
                                receiver: respondermod:CloseBothDoors  #<responder name>
                                user: 0
                        waiton: -1
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:TowerDoor1
                            animname: TowerDoorOpen1
                            cmds:
                              - setbackwards
                              - continue
                        waiton: 0
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:TowerButtonShot1
                            animname: emptyRotate1
                            cmds:
                              - setbackwards
                              - continue
                        waiton: 0
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:TowerDoor2
                            animname: TowerDoorOpen2
                            cmds:
                              - setbackwards
                              - continue
                        waiton: 0
                      - type: animcmdmsg
                        params:
                            receivers:
                              - 006D:TowerButtonShot2
                            animname: emptyRotate2
                            cmds:
                              - setbackwards
                              - continue
                        waiton: 0
                    nextstate: 0
                    waittocmd:
                      - key: 0
                        msg: 0
                curstate: 0
                flags:
                  - detecttrigger


TowerDoor2:
    animations:
      - name: TowerDoorOpen2
        autostart: 0
        loop: 0

TowerButtonShot1:  #<seek point object>:  #the empty
   animations:
     - name: emptyRotate1
       autostart: 0
       loop: 0
   logic:
        actions:
          - type: oneshot
            name: TowerButtonShot1
            oneshot:
                animation: DoorButtonTouch
"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: Could have been two rotating doors..

Postby Tinuviel » Tue Sep 30, 2008 8:17 am

Thanks again, D'Lanor. I used that script when I had the button. But I thought I HAD to use a button for it to work. So I deleted everything when I took away the button :oops:
I think I have to ask Boblishman if I can use his signature. Seems like it fits me perfectly :P
«Borders? I have never seen one, but I have heard they exist in the minds of some people.»
(Thor Heyerdahl)
Tinuviel
 
Posts: 106
Joined: Wed Feb 06, 2008 10:17 am


Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests

cron