play object objnum,startframe,endframe
or
loop object objnum,startframe,endframe
sometimes it is necessary to position the animation on the first needed frame with this command:
set object frame,startframe
play with those
this snippet will help you check what frame does what
cheers
rem Animate Test
autocam off
set global collision off
backdrop on
set text opaque
set ambient light 80
sync on
sync rate 30
hideflag=0
x#=0:h#=0:z#=0:a#=0
cx#=0:cy#=50:cz#=-300
frame=0:frames=0:loopflag=0
rem ************************************************
rem **********LOAD YOUR OBJECT HERE*****************
load object "tsmen/jteditmanwalk2.x",1
scale object 1,6000,6000,6000
set object 1,1,1,0,1,1,1,1
set object specular 1,100
rem set object diffuse 1,100
position object 1,x#,h#,z#
set object frame 1,frame
set object speed 1,50
frames=total object frames(1)
rem *************************************************
rem *************************************************
gosub resetcam
do
if inkey$()="r" then gosub resetobj
if inkey$()="l" then gosub loopobj
if inkey$()="k" then gosub stopobj
if inkey$()="n" then gosub playnextobj
if inkey$()="p" then gosub playobj
frame=object frame(1)
gosub camera_controls
gosub update_camera
gosub printdata
sync
loop
resetobj:
set object frame 1,0
stop object 1
return
loopobj:
loop object 1,5,25
return
stopobj:
play object 1,frame+1,25
play object 1,5,22
gosub resetobj
rem stop object 1
return
playnextobj:
if frame<frames then frame=frame+1:wait 300
if frame=frames then frame=0
set object frame 1,frame
return
playobj:
play object 1,0,25
return
printdata:
rem Print information about object
set cursor 0,0
print "Frame Information"
print "----------------"
print "Total Frames:";frames
print "Frame Number:";frame
print "Press n for next frame"
print "Press l for loop object (frames 5 to 25)"
print "Press p for play object"
print "Press r for reset"
print "Press k for stop object"
return
camera_controls:
if inkey$()="z" then camdist=camdist+2
if inkey$()="Z" then camdist=camdist-2
if inkey$()="x" then camhgt=camhgt+2
if inkey$()="X" then camhgt=camhgt-2
if inkey$()="c" then camrot=wrapvalue(camrot+2)
if inkey$()="C" then camrot=wrapvalue(camrot-2)
if inkey$()="v" then camlen=camlen+2
if inkey$()="V" then camlen=camlen-2
if inkey$()="b" then camrot = 180
if inkey$()="B" then camrot = 0
if inkey$()="<" then gosub Resetcam
if inkey$()="m" then camdist=-1000:camhgt=500:camrot=0:set camera range 100,30000:cls
if inkey$()="M" then camdist=-3000:camhgt=1000:camrot=0:set camera range 100,30000:cls
mymousex=mousemovex()
if mymousex>0 then camrot=camrot+1:cls
if mymousex<0 then camrot=camrot-1:cls
mymousey=mousemovey()
if mymousey>0 then camlen=camlen+1:cls
if mymousey<0 then camlen=camlen-1:cls
return
rem camera update
update_camera:
rem Position camera to the back of the character
ca#=wrapvalue(a#+camrot)
cx#=newxvalue(x#,ca#,camdist)
cz#=newzvalue(z#,ca#,camdist)
cy#=0
position camera cx#,cy#+camhgt,cz#
yrotate camera ca#
rem Point camera at object
point camera x#,cy#+camhgt+camlen,z#
return
Resetcam:
set camera range 1,30000
camdist=-200
camhgt=80
camrot=0
camlen=0
cls
return
rem End the program
end