Logic scripting and one shot animations

Moderators: Trylon, Paradox

Logic scripting and one shot animations

Postby Trylon » Mon Jan 07, 2008 2:24 pm

So, I have another small piece of info for you.
I just got use of predefined animations working in pyprp.


But let me start by giving a current status update:
- Drawablespans rewrite - complete
- Physical rewrite - complete
- resmanager rewrite - virtually complete
- logical scripting support - pretty well done
- camera regions - broken atm
- swim regions - broken atm

One of the pieces in that list is "logical scripting support" - basically it's an advanced way of creating sets of logic objects for uru, and link them to a python script, or other actions. That's the one that also does the animations.

Until now, such support has always been minimal - examples of it are the basic support for clickable regions - that didn;t allow for much flexibility when interfacing with already existing classes, and the footstep sound that was a very rough implementation of the system.

Of course, the logic scripting must be done in alcscript.
A few working examples of the code:

Code to make a footstep region like cyan does:
Code: Select all
RgnFootstepSfxMetal:
    logic:
      modifiers:
       - tag: Enter
         flags:
          - multitrigger
         activators:
          - type: objectinvolume
            triggers:
         conditions:
          - type: volumesensor
            direction: enter
         actions:
          - type: responder
            ref: /
      
         - tag: Exit
         flags:
          - multitrigger
         activators:
          - type: objectinvolume
            triggers:
         conditions:
          - type: volumesensor
            direction: exit
         actions:
          - type: responder
            ref: /
         
      actions:
       - type: responder
         responder:
            states:
             - cmds:
                - type: armatureeffectmsg
                  params:
                     surface: stone
                     append: false
                  waiton: -1
               nextstate: 0
               waittocmd: 0
            curstate: 0
            flags:
             - detect_trigger

The more knowledgable readers may notice that this code actually builds up a respondermodifier and messages according to given specifications.

Code to link an object to simple SDL:
Code: Select all
Gate:
   logic:
      actions:
       - type: pythonfile
         pythonfile:
            file: xAgeSDLBoolShowHide
            parameters:
             - type: string
               value: GateVis
             - type: bool
               value: True

As you can see, you can customize the python arguments that are used

A region that starts a oneshot animation when you enter it (with the objects own origin as the seekpoint):
Code: Select all
OneShotTest:
   logic:
      modifiers:
       - tag: Detect
         flags:
          - multitrigger
         activators:
          - type: objectinvolume
            triggers:
             - enter
         conditions:
          - type: volumesensor
            direction: enter
         actions:
          - type: oneshot
            ref: /
      actions:
       - type: oneshot
         oneshot:
            animation: PushButton

Yes - this means that doing the buttonpress and other animations is finally possible :)

Code for a clickregion:
Code: Select all
GateButton:
    logic:
        modifiers:
          - cursor: poised
            flags:
              - localelement
            activators:
              - type: objectinvolume
                remote: GateBtnRegion
                triggers:
                  - any
            conditions:
              - type: activator
                activators:
                  - type: picking
              - type: objectinbox
                satisfied: true
            actions:
              - type: pythonfile
                ref: /
              - type: oneshot
                ref: :OneShotButtonPush

        actions:
          - type: pythonfile
            pythonfile:
                file: FuncChk01Clickables
                parameters:
                  - type: activator
                    ref: logicmod:/
                  - type: string
                    value: GateButton
                  - type: behavior
                    ref: oneshotmod:OneShotButtonPush

A bit more complex, as it also refers to the oneshot mod defined below, though references

Code for a simple one shot mod - the object on which it is defined is the seekpoint:
Code: Select all
OneShotClickBtn:
   logic:
      actions:
       - type: oneshot
         name: OneShotButtonPush
         oneshot:
            animation: DoorButtonTouch
            seektime: 1.0


I don't have time to explain it in detail at the moment, but perhaps it helps to wet the appetite of some of the more knowledgable writers :)
One day I ran through the cleft for the fiftieth time, and found that uru held no peace for me anymore.
User avatar
Trylon
 
Posts: 1446
Joined: Fri Sep 28, 2007 11:08 pm
Location: Gone from Uru

Re: Logic scripting and one shot animations

Postby Marcello » Mon Jan 07, 2008 2:43 pm

Big /cheer!!!
User avatar
Marcello
 
Posts: 374
Joined: Sun Nov 04, 2007 8:59 am
Location: Haarlem, The Netherlands

Re: Logic scripting and one shot animations

Postby Chacal » Mon Jan 07, 2008 2:50 pm

Awesome.
This is several steps towards the capability for a library of easy-to-use common objects (buttons, doors, books, etc).
Chacal


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

Re: Logic scripting and one shot animations

Postby Nadnerb » Mon Jan 07, 2008 2:58 pm

Awesome! :D

Question: can a responder 'action' include an SDL change message, or do we have do run a python script to do that?
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: Logic scripting and one shot animations

Postby Trylon » Mon Jan 07, 2008 3:00 pm

Not at the moment, but I'm sure there is a message for that somewhere that we can implement for that :)
Adding a new message to the responder code is really easy, so the number of usable messages should grow as we understand more..

EDIT:
Yes, there appears to be a message for that, but we don't understand its format yet.
One day I ran through the cleft for the fiftieth time, and found that uru held no peace for me anymore.
User avatar
Trylon
 
Posts: 1446
Joined: Fri Sep 28, 2007 11:08 pm
Location: Gone from Uru

Re: Logic scripting and one shot animations

Postby Aloys » Mon Jan 07, 2008 3:57 pm

Alcscript look all kind of great because it allows for many new things, but I have an itching feeling that the learning curve will be kind of steep at first :)
Even if someone (Robert?) writes a convertion script for existing Ages, we'll have to learn it. You'll have fun writing the needed tutorials.. :p
User avatar
Aloys
 
Posts: 1855
Joined: Sun Oct 21, 2007 7:57 pm
Location: France (GMT +1)

Re: Logic scripting and one shot animations

Postby Trylon » Mon Jan 07, 2008 4:26 pm

Yes, I agree that thed scripts aboved look pretty complex.
But please understand that these scripts are the "power user" versions.

Honestly, having to put up an entire script just to set one footstep region is quite a bit of overkill.
I'm planning a set of so called "quickscripts" to make setting commonly used scripts simple.

Basically they would be simple settings, that are internally entered into a template for scripts like the ones I showed above.
It could look as simple as this:
Code: Select all
<object name<
    quickscripts:
      - type: footstepregion
        surface: metal

Or it could even be a logic property.

And that information would internally be fed into a template resembling the first script in my above post.
The scripting system actually makes it easier to provide such templates, and bugfixing tham than the very static system we used before.
One day I ran through the cleft for the fiftieth time, and found that uru held no peace for me anymore.
User avatar
Trylon
 
Posts: 1446
Joined: Fri Sep 28, 2007 11:08 pm
Location: Gone from Uru

Re: Logic scripting and one shot animations

Postby Aloys » Mon Jan 07, 2008 4:48 pm

this is good news I was starting to worry.. ;)
However if I understand everything correctly we'll need a script for each object, do you envision a simple way to apply a script to several objects? For instance right now it's easy and fast to copy/paste properties for objects.. Say I have twenty footsteps regions in an Age that all use the same footstep sounds, would I have to create by hand a script for each one?
User avatar
Aloys
 
Posts: 1855
Joined: Sun Oct 21, 2007 7:57 pm
Location: France (GMT +1)

Re: Logic scripting and one shot animations

Postby Paradox » Mon Jan 07, 2008 7:25 pm

Just so that this exists in some form so that someone will stumble upon it when writing the tutorial:

The position of the seek point is exactly 2 blender units away from the "clickable" (door, journey cloth, etc.). The clickable should be approximately 4 units above the level of the seek point. The seek point should be level with the ground/surface upon which the avatar stands.


To be honest... I'm not quite sure what would happen if you had a seek point above the ground... but that's one of those crazy things that I'm going to have to try at some point :D
"And one day I woke to find the future held no place for me. I was unwanted in a world, that with my hands I'd helped to build. Where once was honesty and pride, I now stand broken and alone."
User avatar
Paradox
 
Posts: 1259
Joined: Fri Sep 28, 2007 6:48 pm
Location: Canada

Re: Logic scripting and one shot animations

Postby Grogyan » Mon Jan 07, 2008 9:49 pm

One step closer to animations, one step closer to a unified library of objects, sounds, animations and scripts
Better to have loved and lost than never to have loved at all
User avatar
Grogyan
 
Posts: 1203
Joined: Thu Oct 11, 2007 1:27 am

Next

Return to Scripting Journal

Who is online

Users browsing this forum: No registered users and 1 guest

cron