Second enterregion subworld

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: Second enterregion subworld

Postby Frits » Sun Oct 12, 2008 5:15 am

Ok, I have just symplified the problem,
Two buttons used to open one door;
Code: Select all
BtnOSP1:
    logic:
        actions:
          - type: oneshot
            name: BtnOSP1
            oneshot:
                animation: ButtonTouch
   

BtnOSP2:
    logic:
        actions:
          - type: oneshot
            name: BtnOSP2
            oneshot:
                animation: ButtonTouch

BtnSndEm1:
   type: soundemit
   sound:
      flags:
        - is3dsound
      file: switch
      volume: 0.55
      minfdist: 5
      maxfdist: 50
      type: SoundFX
         
BtnSndEm2:
   type: soundemit
   sound:
      flags:
        - is3dsound
      file: switch
      volume: 0.55
      minfdist: 5
      maxfdist: 50
      type: SoundFX
         
Door5:
   animations:
     - name: AnimDoor5
      autostart: 0
      loop: 0

Button1:
   logic:
        modifiers:
        - cursor: poised
            flags:
              - localelement
            activators:
              - type: objectinvolume
                remote: BtnRgn1
                triggers:
                  - any
            conditions:
              - type: activator
                activators:
                  - type: picking
              - type: objectinbox
                satisfied: true
            actions:
              - type: responder
                ref: :MoveDoor
      actions:
        - type: responder
         name: MoveDoor
         responder:
            states:
              - cmds:
                 - type: oneshotmsg
                  params:
                     receivers:
                       - oneshotmod:BtnOSP1
                     callbacks:
                       - marker: TouchButton
                        receiver: respondermod:MoveDoor
                        user: 0
                  waiton: -1
                 - type: animcmdmsg
                  params:
                     receivers:
                       - 006D:Door5
                     animname: AnimDoor5
                     cmds:
                       - setforewards 
                            - continue
                  waiton: 0
                 - type: soundmsg
                  params:
                     receivers:
                       - 0011:BtnSndEm1
                     cmds:
                       - play
                       - setvolume
                     volume: 1
                  waiton: -1
               nextstate: 1
               waittocmd:
                 - key: 0
                  msg: 0
              - cmds:
                 - type: oneshotmsg
                  params:
                     receivers:
                       - oneshotmod:BtnOSP1
                     callbacks:
                       - marker: TouchButton
                        receiver: respondermod:MoveDoor
                        user: 0
                  waiton: -1
                 - type: animcmdmsg
                  params:
                     receivers:
                       - 006D:Door5
                     animname: AnimDoor5
                     cmds:
                       - setbackwards 
                            - continue
                  waiton: 0
                 - type: soundmsg
                  params:
                     receivers:
                       - 0011:BtnSndEm1
                     cmds:
                       - play
                       - setvolume
                     volume: 1
                  waiton: -1
               nextstate: 0
               waittocmd:
                 - key: 0
                  msg: 0
            curstate: 0
            flags:
              - detecttrigger

Button2:
   logic:
        modifiers:
        - cursor: poised
            flags:
              - localelement
            activators:
              - type: objectinvolume
                remote: BtnRgn2
                triggers:
                  - any
            conditions:
              - type: activator
                activators:
                  - type: picking
              - type: objectinbox
                satisfied: true
            actions:
              - type: responder
                ref: :MoveDoor
      actions:
        - type: responder
         name: MoveDoor
         responder:
            states:
              - cmds:
                 - type: oneshotmsg
                  params:
                     receivers:
                       - oneshotmod:BtnOSP2
                     callbacks:
                       - marker: TouchButton
                        receiver: respondermod:MoveDoor
                        user: 0
                  waiton: -1
                 - type: animcmdmsg
                  params:
                     receivers:
                       - 006D:Door5
                     animname: AnimDoor5
                     cmds:
                       - setforewards 
                            - continue
                  waiton: 0
                 - type: soundmsg
                  params:
                     receivers:
                       - 0011:BtnSndEm2
                     cmds:
                       - play
                       - setvolume
                     volume: 1
                  waiton: -1
               nextstate: 1
               waittocmd:
                 - key: 0
                  msg: 0
              - cmds:
                 - type: oneshotmsg
                  params:
                     receivers:
                       - oneshotmod:BtnOSP2
                     callbacks:
                       - marker: TouchButton
                        receiver: respondermod:MoveDoor
                        user: 0
                  waiton: -1
                 - type: animcmdmsg
                  params:
                     receivers:
                       - 006D:Door5
                     animname: AnimDoor5
                     cmds:
                       - setbackwards 
                            - continue
                  waiton: 0
                 - type: soundmsg
                  params:
                     receivers:
                       - 0011:BtnSndEm2
                     cmds:
                       - play
                       - setvolume
                     volume: 1
                  waiton: -1
               nextstate: 0
               waittocmd:
                 - key: 0
                  msg: 0
            curstate: 0
            flags:
              - detecttrigger


When I click on the left button the avatar goes to the right button and does his animation and the door opens.
When I click on the left button again, the same thing happens, only the door closes, ergo the left button is never used.
Now that's the problem.

Regards,
Frits

EDIT: I have figured something out, I have to change the ref: MoveDoor also for each button. Now the avatar stays near the button I have clicked on.
But now I have to use an SDL var to know the position of the door (or maybe the state of the button?), here I need some help. I know how to create an SDL file and a PAK file, but how must I change the script to implement the SDL var?
And the PAK file, can it be just a 'standard' file?
Frits
 
Posts: 132
Joined: Sun Feb 10, 2008 7:00 am

Re: Second enterregion subworld

Postby Frits » Tue Oct 14, 2008 5:07 am

Someone, please?

Regards,
Frits
Frits
 
Posts: 132
Joined: Sun Feb 10, 2008 7:00 am

Re: Second enterregion subworld

Postby D'Lanor » Tue Oct 14, 2008 6:57 am

If people had any examples for what you want I am sure they would post it. Those who boldly go where no man has gone before will not find easy answers I am afraid.

This wiki page shows how to use global Python files to save sdl states.

The main problem is that you have both door states inside one responder while the global Python files require separate responders for opening and closing.

I can try to rewrite your alcscript if you post your latest working version.
"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: Second enterregion subworld

Postby Frits » Tue Oct 14, 2008 8:52 am

Thanks D'Lanor, I thought that I always receive an answer, good or bad, like in real life but in fora it is different I think.
But ok, I have taken the script belonging to the first example;
A subworld with a button and outside the subworld two buttons to call the platform when it is not there;
Code: Select all
CallLiftOSP1:
    logic:
        actions:
          - type: oneshot
            name: PushBtn1
            oneshot:
                animation: ButtonTouch
   

CallLiftOSP2:
    logic:
        actions:
          - type: oneshot
            name: PushBtn2
            oneshot:
                animation: ButtonTouch

LiftButtonSndEm:
   physical:
      subworld: Lift
   type: soundemit
   sound:
      flags:
        - is3dsound
      file: switch
      volume: 0.55
      minfdist: 5
      maxfdist: 50
      type: SoundFX

CallLiftBtnSndEm1:
   type: soundemit
   sound:
      flags:
        - is3dsound
      file: switch
      volume: 0.55
      minfdist: 5
      maxfdist: 50
      type: SoundFX

CallLiftBtnSndEm2:
   type: soundemit
   sound:
      flags:
        - is3dsound
      file: switch
      volume: 0.55
      minfdist: 5
      maxfdist: 50
      type: SoundFX
         
LiftEnterRegion:
   type: region
   regiontype: subworld
   region:
      subworld: Lift

LiftEnterRegion2:
   type: region
   regiontype: subworld
   region:
      subworld: Lift

LiftExitRegion:
   type: region
   regiontype: subworld
   region:
      onexit: 1
   physical:
      subworld: Lift

LiftExtern:
   physical:
      subworld: Lift

LiftButtonColumn:
   physical:
      subworld: Lift
                        
LiftButtonOSP:
   physical:
      subworld: Lift
    logic:
        actions:
          - type: oneshot
            name: PushTheButton
            oneshot:
                animation: ButtonTouch
            smartseek: false
   
LiftButtonRegion:
   physical:
      subworld: Lift
         

Lift:
   type: subworld
   animations:
     - name: AnimLift
      autostart: 0
      loop: 0
   
LiftFloor:
   physical:
      subworld: Lift

LiftDoor1:
   animations:
     - name: AnimLiftDoor1
      autostart: 0
      loop: 0

LiftDoor2:
   animations:
     - name: AnimLiftDoor2
      autostart: 0
      loop: 0



LiftButton:
   physical:
      subworld: Lift
   logic:
        modifiers:
        - cursor: poised
            flags:
              - localelement
            activators:
              - type: objectinvolume
                remote: LiftButtonRegion
                triggers:
                  - any
            conditions:
              - type: activator
                activators:
                  - type: picking
              - type: objectinbox
                satisfied: true
            actions:
              - type: responder
                ref: :Move1Lift
      actions:
        - type: responder
         name: Move1Lift
         responder:
            states:
              - cmds:
                 - type: oneshotmsg
                  params:
                     receivers:
                       - oneshotmod:PushTheButton
                     callbacks:
                       - marker: TouchButton
                        receiver: respondermod:Move1Lift
                        user: 0
                  waiton: -1
                 - type: animcmdmsg
                  params:
                     receivers:
                       - 006D:Lift
                     animname: AnimLift
                     cmds:
                       - setforewards 
                            - continue
                  waiton: 0
                 - type: animcmdmsg
                  params:
                     receivers:
                       - 006D:LiftDoor1
                     animname: AnimLiftDoor1
                     cmds:
                       - setforewards 
                            - continue
                  waiton: -1
                 - type: animcmdmsg
                  params:
                     receivers:
                       - 006D:LiftDoor2
                     animname: AnimLiftDoor2
                     cmds:
                       - setforewards 
                            - continue
                  waiton: -1
                 - type: soundmsg
                  params:
                     receivers:
                       - 0011:LiftButtonSndEm
                     cmds:
                       - play
                       - setvolume
                     volume: 1
                  waiton: -1
               nextstate: 1
               waittocmd:
                 - key: 0
                  msg: 0
              - cmds:
                 - type: oneshotmsg
                  params:
                     receivers:
                       - oneshotmod:PushTheButton
                     callbacks:
                       - marker: TouchButton
                        receiver: respondermod:Move1Lift
                        user: 0
                  waiton: -1
                 - type: animcmdmsg
                  params:
                     receivers:
                       - 006D:Lift
                     animname: AnimLift
                     cmds:
                       - setbackwards 
                            - continue
                  waiton: 0
                 - type: animcmdmsg
                  params:
                     receivers:
                       - 006D:LiftDoor1
                     animname: AnimLiftDoor1
                     cmds:
                       - setbackwards 
                            - continue
                  waiton: -1
                 - type: animcmdmsg
                  params:
                     receivers:
                       - 006D:LiftDoor2
                     animname: AnimLiftDoor2
                     cmds:
                       - setbackwards 
                            - continue
                  waiton: -1
                 - type: soundmsg
                  params:
                     receivers:
                       - 0011:LiftButtonSndEm
                     cmds:
                       - play
                       - setvolume
                     volume: 1
                  waiton: -1
               nextstate: 0
               waittocmd:
                 - key: 0
                  msg: 0
            curstate: 0
            flags:
              - detecttrigger

CallLiftButton1:
   logic:
        modifiers:
        - cursor: poised
            flags:
              - localelement
            activators:
              - type: objectinvolume
                remote: CallLiftRegion1
                triggers:
                  - any
            conditions:
              - type: activator
                activators:
                  - type: picking
              - type: objectinbox
                satisfied: true
            actions:
              - type: responder
                ref: :Move2Lift
      actions:
        - type: responder
         name: Move2Lift
         responder:
            states:
              - cmds:
                 - type: oneshotmsg
                  params:
                     receivers:
                       - oneshotmod:PushBtn1
                     callbacks:
                       - marker: TouchButton
                        receiver: respondermod:Move2Lift
                        user: 0
                  waiton: -1
                 - type: animcmdmsg
                  params:
                     receivers:
                       - 006D:Lift
                     animname: AnimLift
                     cmds:
                       - setforewards 
                            - continue
                  waiton: 0
                 - type: animcmdmsg
                  params:
                     receivers:
                       - 006D:LiftDoor1
                     animname: AnimLiftDoor1
                     cmds:
                       - setforewards 
                            - continue
                  waiton: -1
                 - type: animcmdmsg
                  params:
                     receivers:
                       - 006D:LiftDoor2
                     animname: AnimLiftDoor2
                     cmds:
                       - setforewards 
                            - continue
                  waiton: -1
                 - type: soundmsg
                  params:
                     receivers:
                       - 0011:CallLiftBtnSndEm1
                     cmds:
                       - play
                       - setvolume
                     volume: 1
                  waiton: -1
               nextstate: 1
               waittocmd:
                 - key: 0
                  msg: 0
              - cmds:
                 - type: oneshotmsg
                  params:
                     receivers:
                       - oneshotmod:PushBtn1
                     callbacks:
                       - marker: TouchButton
                        receiver: respondermod:Move2Lift
                        user: 0
                  waiton: -1
                 - type: animcmdmsg
                  params:
                     receivers:
                       - 006D:Lift
                     animname: AnimLift
                     cmds:
                       - setbackwards 
                            - continue
                  waiton: 0
                 - type: animcmdmsg
                  params:
                     receivers:
                       - 006D:LiftDoor1
                     animname: AnimLiftDoor1
                     cmds:
                       - setbackwards 
                            - continue
                  waiton: -1
                 - type: animcmdmsg
                  params:
                     receivers:
                       - 006D:LiftDoor2
                     animname: AnimLiftDoor2
                     cmds:
                       - setbackwards 
                            - continue
                  waiton: -1
                 - type: soundmsg
                  params:
                     receivers:
                       - 0011:CallLiftBtnSndEm1
                     cmds:
                       - play
                       - setvolume
                     volume: 1
                  waiton: -1
               nextstate: 0
               waittocmd:
                 - key: 0
                  msg: 0
            curstate: 0
            flags:
              - detecttrigger


CallLiftButton2:
   logic:
        modifiers:
        - cursor: poised
            flags:
              - localelement
            activators:
              - type: objectinvolume
                remote: CallLiftRegion2
                triggers:
                  - any
            conditions:
              - type: activator
                activators:
                  - type: picking
              - type: objectinbox
                satisfied: true
            actions:
              - type: responder
                ref: :Move3Lift
      actions:
        - type: responder
         name: Move3Lift
         responder:
            states:
              - cmds:
                 - type: oneshotmsg
                  params:
                     receivers:
                       - oneshotmod:PushBtn2
                     callbacks:
                       - marker: TouchButton
                        receiver: respondermod:Move3Lift
                        user: 0
                  waiton: -1
                 - type: animcmdmsg
                  params:
                     receivers:
                       - 006D:Lift
                     animname: AnimLift
                     cmds:
                       - setforewards 
                            - continue
                  waiton: 0
                 - type: animcmdmsg
                  params:
                     receivers:
                       - 006D:LiftDoor1
                     animname: AnimLiftDoor1
                     cmds:
                       - setforewards 
                            - continue
                  waiton: -1
                 - type: animcmdmsg
                  params:
                     receivers:
                       - 006D:LiftDoor2
                     animname: AnimLiftDoor2
                     cmds:
                       - setforewards 
                            - continue
                  waiton: -1
                 - type: soundmsg
                  params:
                     receivers:
                       - 0011:CallLiftBtnSndEm2
                     cmds:
                       - play
                       - setvolume
                     volume: 1
                  waiton: -1
               nextstate: 1
               waittocmd:
                 - key: 0
                  msg: 0
              - cmds:
                 - type: oneshotmsg
                  params:
                     receivers:
                       - oneshotmod:PushBtn2
                     callbacks:
                       - marker: TouchButton
                        receiver: respondermod:Move3Lift
                        user: 0
                  waiton: -1
                 - type: animcmdmsg
                  params:
                     receivers:
                       - 006D:Lift
                     animname: AnimLift
                     cmds:
                       - setbackwards 
                            - continue
                  waiton: 0
                 - type: animcmdmsg
                  params:
                     receivers:
                       - 006D:LiftDoor1
                     animname: AnimLiftDoor1
                     cmds:
                       - setbackwards 
                            - continue
                  waiton: -1
                 - type: animcmdmsg
                  params:
                     receivers:
                       - 006D:LiftDoor2
                     animname: AnimLiftDoor2
                     cmds:
                       - setbackwards 
                            - continue
                  waiton: -1
                 - type: soundmsg
                  params:
                     receivers:
                       - 0011:CallLiftBtnSndEm2
                     cmds:
                       - play
                       - setvolume
                     volume: 1
                  waiton: -1
               nextstate: 0
               waittocmd:
                 - key: 0
                  msg: 0
            curstate: 0
            flags:
              - detecttrigger

This works for all the buttons when used twice(first click, platformd goes to the right, second click, platform goes to the left), but not when you use the buttons one after another.
I hope you can do something with it.

Regards,
Frits
Frits
 
Posts: 132
Joined: Sun Feb 10, 2008 7:00 am

Re: Second enterregion subworld

Postby D'Lanor » Wed Oct 15, 2008 9:49 am

I have looked at your script but I am afraid it is more complicated than I had foreseen from your example. So I am going to pass. I draw the line at an hour to answer questions and this is going to take much longer. Sorry. Maybe others with more time on their hands can pick this up.
"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: Second enterregion subworld

Postby Frits » Fri Oct 17, 2008 12:06 am

D'Lanor, in ieder geval bedankt voor het bestuderen van het probleem.

Thanks for looking at the problem, I think that this must be done completely in Python.
I know it must be possible, the elevator in Teledahn works the same way.

Regards,
Frits
Frits
 
Posts: 132
Joined: Sun Feb 10, 2008 7:00 am

Previous

Return to Building

Who is online

Users browsing this forum: No registered users and 0 guests