Page 1 of 2
Triggered Looping Animations
Posted: Thu Aug 26, 2010 12:51 pm
by Justintime9
Hey,
I've just added an animated object to my age in which the player pushes a button and the object animates and loops endlessly until the button is pushed again. I tried using the Quickscript avatar animations and such, and for the animation script I set loop to 1 because I want it to loop when triggered.
However when I exported, the object had already started moving even though I didn't press the button. I made sure that autostart was off as well. The avatar animation works and the button is pushable, but what's the point if the object is already in motion?
Here's my AlcScripts:
Code: Select all
SirrusToy:
animations:
- name: SirrusRotate
autostart: 0
loop: 1
SirrusButton:
quickscript:
stateanimation:
objectname: SirrusToy
region: SirrusReg
sdlname: SirrusTurn
avatar:
animation: ButtonTouch
animtarget: SirrusTarget
forewards:
animation: SirrusRotate
backwards:
animation: SirrusRotate
As far as SDL file, I put one variable in. I assumed that although it looped, it would remember whether the object is in motion when the player links in later.
Re: Triggered Looping Animations
Posted: Thu Aug 26, 2010 5:54 pm
by D'Lanor
You cannot use the stateanimation quickscript for that. It was made for playing non-looping animations forwards or backwards. In both cases it sends the continue command. What you need though is the stop command.
Re: Triggered Looping Animations
Posted: Thu Aug 26, 2010 6:10 pm
by Justintime9
Then what Quickscript should I have used? Can I just modify the stateanimation quickscript, or is there a completely different one I need?
Re: Triggered Looping Animations
Posted: Fri Aug 27, 2010 11:00 am
by D'Lanor
There is no quickscript for it but here is the full AlcScript.
Code: Select all
SirrusButton:
logic:
modifiers:
- name: SirrusButtonClick
cursor: poised
flags:
- localelement
activators:
- type: objectinvolume
remote: SirrusReg
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:SirrusButtonClick
- type: string
value: SirrusTurn
- type: skip
- type: skip
- type: string
value: SirrusTurn
SirrusToy:
animations:
- name: SirrusRotate
autostart: 0
loop: 1
logic:
actions:
- type: pythonfile
tag: IntStartStopResp
pythonfile:
file: xAgeSDLIntStartStopResp
parameters:
- type: string
value: SirrusTurn
- type: responder
ref: $StartTurn
- type: string
value: 1
- type: bool
value: false
- type: responder
ref: $StopTurn
- type: bool
value: false
- type: responder
tag: StartTurn
responder:
states:
- cmds:
- type: oneshotmsg
params:
receivers:
- oneshotmod:SirrusTarget
callbacks:
- marker: ButtonTouch
receiver: respondermod:$StartTurn
user: 0
waiton: -1
- type: animcmdmsg
params:
receivers:
- 006D:SirrusToy
animname: SirrusRotate
cmds:
- continue
waiton: 0
nextstate: 0
ncallbacks: 1
waittocmd:
- key: 0
msg: 0
curstate: 0
flags:
- detecttrigger
- type: responder
tag: StopTurn
responder:
states:
- cmds:
- type: oneshotmsg
params:
receivers:
- oneshotmod:SirrusTarget
callbacks:
- marker: ButtonTouch
receiver: respondermod:$StopTurn
user: 0
waiton: -1
- type: animcmdmsg
params:
receivers:
- 006D:SirrusToy
animname: SirrusRotate
cmds:
- stop
waiton: 0
nextstate: 0
ncallbacks: 1
waittocmd:
- key: 0
msg: 0
curstate: 0
flags:
- detecttrigger
SirrusTarget:
logic:
actions:
- type: oneshot
name: SirrusTarget
oneshot:
animation: ButtonTouch
Re: Triggered Looping Animations
Posted: Fri Aug 27, 2010 2:08 pm
by Justintime9
Ok, I just put that script in, and then deleted the .sav file. When I linked in I realized that I had forgotten to Apply scale and rotation (and at that point although nothing happened when I presses it, the button was clickable), but now I applied scale and rotation and the button isn't even clickable! At least the animation doesn't start automatically like it used to, but I can't figure out why the button would stop being clickable

is the "xAgeSDLBoolToggle" file the correct python file to reference?
Re: Triggered Looping Animations
Posted: Fri Aug 27, 2010 2:30 pm
by D'Lanor
Yes, it is correct. I have used this many times. Just make sure your clickable is set up correctly.
Re: Triggered Looping Animations
Posted: Fri Aug 27, 2010 4:14 pm
by Justintime9
Ok. I checked again and the button
is clickable, but when I push it, neither the avatar animation nor the object animation play. I checked and made sure that the button, animated object, and the region are Actors and have bounds, so it seems the clickable part is right. Thinking maybe if there was something wrong with the object itself, I created a completely new animation somewhere else in the age and the same thing happened.
Here's the second animations AlcScript:
Code: Select all
FMMButton:
logic:
modifiers:
- name: FMMButtonClick
cursor: poised
flags:
- localelement
activators:
- type: objectinvolume
remote: FMMReg
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:FMMButtonClick
- type: string
value: FMFall
- type: skip
- type: skip
- type: string
value: FMFall
FMMSphere:
animations:
- name: FMMFall
autostart: 0
loop: 1
logic:
actions:
- type: pythonfile
tag: IntStartStopResp
pythonfile:
file: xAgeSDLIntStartStopResp
parameters:
- type: string
value: FMFall
- type: responder
ref: $StartTurn
- type: string
value: 1
- type: bool
value: false
- type: responder
ref: $StopTurn
- type: bool
value: false
- type: responder
tag: StartTurn
responder:
states:
- cmds:
- type: oneshotmsg
params:
receivers:
- oneshotmod:FMMTarget
callbacks:
- marker: DoorButtonTouch
receiver: respondermod:$StartTurn
user: 0
waiton: -1
- type: animcmdmsg
params:
receivers:
- 006D:FMMSphere
animname: FMMFall
cmds:
- continue
waiton: 0
nextstate: 0
ncallbacks: 1
waittocmd:
- key: 0
msg: 0
curstate: 0
flags:
- detecttrigger
- type: responder
tag: StopTurn
responder:
states:
- cmds:
- type: oneshotmsg
params:
receivers:
- oneshotmod:FMMTarget
callbacks:
- marker: DoorButtonTouch
receiver: respondermod:$StopTurn
user: 0
waiton: -1
- type: animcmdmsg
params:
receivers:
- 006D:FMMSphere
animname: FMMFall
cmds:
- stop
waiton: 0
nextstate: 0
ncallbacks: 1
waittocmd:
- key: 0
msg: 0
curstate: 0
flags:
- detecttrigger
FMMTarget:
logic:
actions:
- type: oneshot
name: FMMTarget
oneshot:
animation: DoorButtonTouch
And here's my SDL file:
Code: Select all
# Remember not to delete the existing versions when creating new SDL versions!
# Doing so could *corrupt* the vault!
STATEDESC TsoidahlPrad
{
VERSION 1
VAR BOOL SirrusTurn[1] DEFAULT=0
}
STATEDESC TsoidahlPrad
{
VERSION 2
VAR BOOL SirrusTurn[1] DEFAULT=0
VAR BOOL FMFall[1] DEFAULT=0
}
Should there be a reference somewhere to my python file as well?
Re: Triggered Looping Animations
Posted: Fri Aug 27, 2010 5:21 pm
by Paradox
Indentation is wrong at
Code: Select all
FMMSphere:
animations:
- name: FMMFall
autostart: 0
loop: 1
Re: Triggered Looping Animations
Posted: Fri Aug 27, 2010 8:26 pm
by Justintime9
Ah. Do you mean that
Code: Select all
FMMSphere:
animations:
- name: FMMFall
autostart: 0
loop: 1
should be
Code: Select all
FMMSphere:
animations:
- name: FMMFall
autostart: 0
loop: 1
?
because if so I just tried that and it didn't seem to change anything.
Re: Triggered Looping Animations
Posted: Sat Aug 28, 2010 4:58 am
by D'Lanor
Justintime9 wrote:Should there be a reference somewhere to my python file as well?
No, the only reference it needs is the name TsoidahlPrad which is there. And if you made a default TsoidahlPrad.py for your age then SDL states should work. We have confirmation of it from the quickscript (even though it did not do what you expected).
Can you post your export log file and the Python.0.elf log file?