Hi folks
I have an object with 2 animations allowing it to rotate 180 degrees and then rotate back again. i initially had this as a single animation which would run forwards and then backwards but changed it because I wanted the object rotation to be controllable by 2 different triggers. The problem I have now is as follows:
If we call my 2 animations A and B, then using trigger 1 will cause A, but then when using trigger 2 afterwards it does not recognise that the object has now changed state/position and hence it will try and repeat A rather than rotating the object back again using B.
Is there a way of making these 2 triggers mutually dependant in simple alcscript so that each will always have the same effect given the current object state?
Thanks in advance
Ekimmai
Animation interplay
Re: Animation interplay
A single animation would work fine for this if you set it backwards following this example.
"It is in self-limitation that a master first shows himself." - Goethe
-
- Posts: 1057
- Joined: Fri Sep 28, 2007 8:01 pm
- MOULa KI#: 23247
- Location: US (Eastern Time)
- Contact:
Re: Animation interplay
I don't believe that answers the question. The problem seems to be that the responders record their state separately, so if there are two responders responsible for running the same animation both backwards and forwards, they don't stay in sync. There are various solutions to this, including using a single responder linked to by multiple logic mods (clickables) or using a python script to track the state of the animation.
Re: Animation interplay
Hmm, that is not how I read that question at all. Otherwise I would have promoted the stateanimation quickscript, which was made for that purpose. That quickscript requires a clickable activator though and ekimmai did not say what the trigger was. I guess we need more information to answer this.
"It is in self-limitation that a master first shows himself." - Goethe
Re: Animation interplay
Thanks for the replies guys. You are correct Nadnerb in your explanation of my problem - how to get the responders in sync. My 2 triggers are just clickable objects.
I have a lot of animation in this age and have used alcscript throughout - not quickscript - so I am a little unsure as to how your code relates to this D'L.
Fundamentally my age is ready for "release" (for testing at least) except for one big hurdle - I have not yet incorporated any code to save the state of animations. This of course creates all manner of weird situations if the user links out and back in again. My plan was to eventually put out a general appeal for assistance in "converting" my alcscript/code for that purpose as I have read some of the guides on Python, quickscript etc but have no idea even where to begin.
Perhaps my responder-sync issue is too closely connected to this wider problem to allow solution at this stage.
Any more thoughts on this?
I have a lot of animation in this age and have used alcscript throughout - not quickscript - so I am a little unsure as to how your code relates to this D'L.
Fundamentally my age is ready for "release" (for testing at least) except for one big hurdle - I have not yet incorporated any code to save the state of animations. This of course creates all manner of weird situations if the user links out and back in again. My plan was to eventually put out a general appeal for assistance in "converting" my alcscript/code for that purpose as I have read some of the guides on Python, quickscript etc but have no idea even where to begin.

Any more thoughts on this?
Re: Animation interplay
Here is the basic frame for a clickable toggling a responder using saved SDL states.
This has a more logical setup than the quickscript which has to put everything under the clickable. This AlcScript shows the process more clearly. The clickable calls a global Python script which toggles the SDL state. The animated object responds to changes in that SDL variable through another global Python script.
Code: Select all
<clickable>:
logic:
modifiers:
- tag: ActToggle
cursor: poised
flags:
- localelement
activators:
- type: objectinvolume
remote: <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:$ActToggle
- type: string
value: <sdl variable>
- type: skip
- type: skip
- type: string
value: <sdl variable>
<animated object>:
animations:
- name: <animation name>
autostart: 0
loop: 0
logic:
actions:
- type: pythonfile
pythonfile:
file: xAgeSDLBoolRespond
parameters:
- type: string
value: <sdl variable>
- type: responder
ref: $State1
- type: responder
ref: $State2
- type: bool
value: false
- type: bool
value: true
- type: responder
tag: State1
responder:
states:
- cmds:
- <animation and other messages for State1>
nextstate: 0
waittocmd: 0
curstate: 0
flags:
- detecttrigger
- type: responder
tag: State2
responder:
states:
- cmds:
- <animation and other messages for State2>
nextstate: 0
waittocmd: 0
curstate: 0
flags:
- detecttrigger
This has a more logical setup than the quickscript which has to put everything under the clickable. This AlcScript shows the process more clearly. The clickable calls a global Python script which toggles the SDL state. The animated object responds to changes in that SDL variable through another global Python script.
"It is in self-limitation that a master first shows himself." - Goethe
Re: Animation interplay
Thanks for the advice.
Unfortunately I have no idea about how to go about using Python and the quickscript only appears to cover clickables - which in many cases would be fine but I have an awful lot of alcscript code and some of the animations are triggered by regions and not clickables. Where does this leave me?
Unfortunately I have no idea about how to go about using Python and the quickscript only appears to cover clickables - which in many cases would be fine but I have an awful lot of alcscript code and some of the animations are triggered by regions and not clickables. Where does this leave me?
Re: Animation interplay
These are global Python scripts I mentioned. You can tell by the first letter x in their names. They already exist. You should NEVER remake these yourself because that will result in breaking that global script in all ages.
The same action with a region would look like this:
This toggles the state of the animation each time you enter the region. Probably not quite what you want but it shows the general idea. Cyan has made several global Python scripts so there should be one for your purpose, but you will have to be more specific.
If you just want to run an animation upon entering a region you probably do not need SDL states or Python at all. Unless it is part of a puzzle. And then you will have to do your own scripting anyway.
The same action with a region would look like this:
Code: Select all
<region>:
logic:
modifiers:
- tag: ActToggle
flags:
- multitrigger
activators:
- type: objectinvolume
triggers:
- enter
conditions:
- type: volumesensor
satisfied: true
direction: enter
actions:
- type: pythonfile
ref: $BoolToggle
actions:
- type: pythonfile
tag: BoolToggle
pythonfile:
file: xAgeSDLBoolToggle
parameters:
- type: activator
ref: logicmod:$ActToggle
- type: string
value: <sdl variable>
- type: skip
- type: skip
- type: string
value: <sdl variable>
This toggles the state of the animation each time you enter the region. Probably not quite what you want but it shows the general idea. Cyan has made several global Python scripts so there should be one for your purpose, but you will have to be more specific.
If you just want to run an animation upon entering a region you probably do not need SDL states or Python at all. Unless it is part of a puzzle. And then you will have to do your own scripting anyway.
"It is in self-limitation that a master first shows himself." - Goethe
Re: Animation interplay
Okay so do I just replace the <sdl variable> part with a variable name of my own choosing and then that's it - the global script will do the rest? And do I just add these actions and modifiers to my own alcscript as it currently stands in order to just add on the state toggling function?
Re: Animation interplay
Yes. The key is to direct the actions for the modifier to the pythonfile instead of the responder like you did previously.
"It is in self-limitation that a master first shows himself." - Goethe