Jump to content
Sign in to follow this  
Albert Schweitzer

the old anoying loop question

Recommended Posts

I want this loop to end after 10 seconds, then the camera should move to a different position, can you add an example line please (this would be easier for me then explaining it with lots of "X stands for" and "y represents").

Quote[/b] ]titlecut ["","Black in",10]

_camera = "camera" camcreate [0,0,0]

startcount=true

setacctime 0.5

_delay = _time + 10.0

#loop

_camera cameraeffect ["internal", "back"]

_camera camsettarget plane1

_camera camPrepareFOV 1.384

_camera camsetrelpos [0,5,-0.5]

_camera camcommit 0

? (endplaneview) : goto "nextstep" (<--- what the hell is this?) how does it work?)

goto "loop"

Thanks, much appreciated. And dont be suprised that a member with 6000 posts doesnt know these basics.   biggrin_o.gif

Share this post


Link to post
Share on other sites

I'm just aiming from the hip here...

But shouldn't it work to change the _camera camcommit 0 to _camera camcommit 10 and remove the loop.

Try it.

I'm no good at this but would try it...

Share this post


Link to post
Share on other sites
Guest

Maybe this is useless, thought u were asking for a loop script example, re-read your post, and it seems this may not be what your looking for, either way, if this helps or not, heres a simple loop example using a 1 second delay, sorry for the misunderstanding

_LoopTimeout = 0

#beginLoop

~1

_LoopTimeout = (_LoopTimeout + 1)

;some bunch of script this loop performs

player sidechat format ["loop time equals %1",_LoopTimeout]

?_LoopTimeout > 9:goto "NextArea"

goto "beginLoop"

#NextArea

player sidechat "10 seconds has passed, moved to next area"

Exit

Share this post


Link to post
Share on other sites

looks usable

Quote[/b] ]

titlecut ["","Black in",10]

_camera = "camera" camcreate [0,0,0]

startcount=true

setacctime 0.5

_delay = _time + 10.0

#loop

_camera cameraeffect ["internal", "back"]

_camera camsettarget plane1

_camera camPrepareFOV 1.384

_camera camsetrelpos [0,5,-0.5]

_camera camcommit 0

?_LoopTimeout > 9:goto "NextArea"

goto "loop"

;=== 23:32:46

#NextArea

_camera camPrepareTarget [-88709.64,-4921.25,48.76]

_camera camPreparePos [10694.68,5977.43,1.97]

_camera camPrepareFOV 0.700

_camera camCommitPrepared 0

@camCommitted _camera

does that look like a usuable script? The loop doesnt end though!

Thanks to both of you!

Share this post


Link to post
Share on other sites

Trimming off some of the unused variables, one might end up with something like the following. It's thoroughly untested and written late in the evening, so... whistle.gif

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">titleCut ["","BLACK IN",10]

_camera = "Camera" camCreate [0,0,0]

_accelFactor = 0.5

setAccTime _accelFactor

; This will keep the loop going until ~10 "wall clock" seconds have passed

_delayUntil = _time + 10.0*_accelFactor

#loop

~0.01

_camera cameraEffect ["INTERNAL", "BACK"]

_camera camSetTarget plane1

_camera camPrepareFOV 1.384

_camera camSetRelPos [0,5,-0.5]

_camera camCommit 0

?_time < _delayUntil: goto "loop"

; Do whatever comes next...

Hope it helps!

Share this post


Link to post
Share on other sites

titlecut ["","Black in",10]

_camera = "camera" camcreate [0,0,0]

startcount=true

setacctime 0.5

_LoopTimeout = 0

#beginLoop

~0.001

_LoopTimeout = (_LoopTimeout + 1)

_camera cameraeffect ["internal", "back"]

_camera camsettarget plane1

_camera camPrepareFOV 1.384

_camera camsetrelpos [0,5,-0.5]

_camera camcommit 0

player sidechat format ["loop time equals %1",_LoopTimeout]

?_LoopTimeout > 100:goto "NextArea"

goto "beginLoop"

#NextArea

_camera camPrepareTarget [-88709.64,-4921.25,48.76]

_camera camPreparePos [10694.68,5977.43,1.97]

_camera camPrepareFOV 0.700

_camera camCommitPrepared 0

@camCommitted _camera

This works!!! Just need to disable radio

Share this post


Link to post
Share on other sites
Quote[/b] ]titlecut ["","Black in",10]

_camera = "camera" camcreate [0,0,0]

_accelFactor = 0.5

setAccTime _accelFactor

; This will keep the loop going until ~10 "wall clock" seconds have passed

_delayUntil = _time + 10.0*_accelFactor

#loop

~0.01

_camera cameraEffect ["INTERNAL", "BACK"]

_camera camSetTarget plane1

_camera camPrepareFOV 1.384

_camera camSetRelPos [0,5,-0.5]

_camera camCommit 0

?_time < _delayUntil: goto "loop"

; Do whatever comes next...

#NextArea

_camera camPrepareTarget [-88709.64,-4921.25,48.76]

_camera camPreparePos [10694.68,5977.43,1.97]

_camera camPrepareFOV 0.700

_camera camCommitPrepared 0

@camCommitted _camera

And this works too! Great job both of you!

If I only knew what this stands for.

_accelFactor = 0.5

Share this post


Link to post
Share on other sites
Quote[/b] ]_accelFactor = 0.5

Variable for

Quote[/b] ]setAccTime _accelFactor

0.5 means that your scene is played in slow motion, half of the regular playback speed.

Share this post


Link to post
Share on other sites
If I only knew what this stands for.

_accelFactor = 0.5

I introduced that variable as a matter of convenience. Here's the relevant code part again:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_accelFactor = 0.5

setAccTime _accelFactor

; This will keep the loop going until ~10 "wall clock" seconds have passed

_delayUntil = _time + 10.0*_accelFactorOne could also write this as

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">setAccTime = 0.5

; This will keep the loop going until ~10 "wall clock" seconds have passed

_delayUntil = _time + 10*0.5or even

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">setAccTime = 0.5

; This will keep the loop going until ~10 "wall clock" seconds have passed

_delayUntil = _time + 5All three will get you the same result. Using the variable lets you try out different time acceleration factors by only changing the _accelFactor value. The _delayUntil time is then calculated automatically.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×