Alcscript Madness

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

Alcscript Madness

Postby GPNMilano » Sun Aug 03, 2008 10:55 am

Okay, here's my problem. I have an object that I want to click and trigger a python script. At the same time, I want to play an avatar animation as it does so. Here's my problem though: The python script it is intended to trigger requires it to read the name of the object, and the name of the LinkInPoint closest to the object. So what I've done is create this alscript:


Code: Select all
clkTempleHotSpot01r:
   visual:
      render: false
    logic:
        modifiers:
          - tag: AutoClick
            cursor: poised
            flags:
              - localelement
            activators:
              - type: objectinvolume
                remote: HotSpotRgn01
                triggers:
                  - any
            conditions:
              - type: activator
                activators:
                  - type: picking
              - type: objectinbox
                satisfied: true
            actions:
              - type: pythonfile
                ref: $clkHotSpot01
        actions:
          - type: pythonfile
          tag: HotSpot01
            pythonfile:
                file: TempleHotSpots
                parameters:
                  - type: string
                 value: ChurchofIllumination
        - type: string
                    value: LinkInPointDefault
        - type: activator
                    ref: logicmod:$AutoClick
                  - type: string
                    value: clkTempleHotSpot


Now I'm sure I've done something wrong, the object is clickable and activates the region the way I want it to, but I don't know where to put the avatar animation stuff, or where to put the stuff to reference my 3dsound for the object once its clicked. (Also I think that there's to many action fields in there. Basically I need help cleaning this up, as this is going to be my first complicated age.
You can't stop the truth. IC Blog
User avatar
GPNMilano
 
Posts: 1155
Joined: Mon Apr 21, 2008 5:50 am

Re: Alcscript Madness

Postby D'Lanor » Sun Aug 03, 2008 11:50 am

It looks ok, except that the indentation is messed up. You actually need more actions for your avatar animation and sound. Something like this probably:

Code: Select all
clkTempleHotSpot01r:
    visual:
        render: false
    logic:
        modifiers:
          - tag: AutoClick
            cursor: poised
            flags:
              - localelement
            activators:
              - type: objectinvolume
                remote: HotSpotRgn01
                triggers:
                  - any
            conditions:
              - type: activator
                activators:
                  - type: picking
              - type: objectinbox
                satisfied: true
            actions:
              - type: pythonfile
                ref: $clkHotSpot01
              - type: responder
                ref: $<responder tag>
        actions:
          - type: pythonfile
            tag: clkHotSpot01
            pythonfile:
                file: TempleHotSpots
                parameters:
                  - type: string
                    value: ChurchofIllumination
                  - type: string
                    value: LinkInPointDefault
                  - type: activator
                    ref: logicmod:$AutoClick
                  - type: string
                    value: clkTempleHotSpot
          - type: responder
            tag: <responder tag>
            responder:
               states:
                 - cmds:
                     - type: oneshotmsg
                       params:
                           receivers:
                             - oneshotmod:<avatar animation target>
                           callbacks:
                             - marker: <avatar animation>
                               receiver: respondermod:$<responder tag>
                               user: 0
                       waiton: -1
                     - type: soundmsg
                       params:
                           receivers:
                             - 0011:<sound emitter>
                           cmds:
                             - play
                             - setvolume
                           volume: 1
                       waiton: 0
                   nextstate: 1
                   waittocmd:
                     - key: 0
                       msg: 0
               curstate: 0
               flags:
                 - detecttrigger


<avatar animation target>:
    logic:
        actions:
          - type: oneshot
            name: <avatar animation target>
            oneshot:
                animation: <avatar animation>


Edit: Oh wait, the tag for the pythonfilemod did not match. Fixed.
"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: Alcscript Madness

Postby GPNMilano » Sun Aug 03, 2008 4:00 pm

Thanks D'Lanor.

The example you showed is pretty much what I had in one of my original attempts, except the indentation was screwy, as you pointed out, and I think thats what was causing it not to work as the original attempt used all the same alcscript defs that you posted. I just think I screwed up on the indentations.
You can't stop the truth. IC Blog
User avatar
GPNMilano
 
Posts: 1155
Joined: Mon Apr 21, 2008 5:50 am


Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests

cron