Home   Help Search Login Register  

Author Topic: counting loops [solved]  (Read 1618 times)

0 Members and 1 Guest are viewing this topic.

Offline loki72

  • Former Staff
  • ****
    • Loki's Nightmare
counting loops [solved]
« on: 15 May 2008, 01:46:05 »
greetings,

how does one count the times a loop has been fired off? and when it has looped 12x.. it moves on?

i.e. i'd like to have a cut scene with the time changes from 12pm to 12am.. but i don't want it at once.

edit: and will this change the time for all? i can get it to kinda work.. but it will not release from the loop

something like?

#loop
~.05
_x = _x +1
skiptime 1
? _x >= 12 : goto "next"
goto "loop"

#next
blah blah

thx
« Last Edit: 15 May 2008, 04:05:17 by loki72 »

Offline sfc.itzhak

  • Members
  • *
Re: counting loops
« Reply #1 on: 15 May 2008, 03:33:52 »
#loop
~.05
_x = _x +1
skiptime 1
? _x >= 12 : goto "next"
goto "loop"

#next
blah blah

i think you need to define x before the loops start
so

Quote
_x=0
#loop
~.05
_x = _x +1
skiptime 1
? _x >= 12 : goto "next"
goto "loop"

#next
blah blah


#EDIT: No need to quote the entire previous post you're replying to...     h-
« Last Edit: 15 May 2008, 03:51:56 by h- »

Offline loki72

  • Former Staff
  • ****
    • Loki's Nightmare
Re: counting loops
« Reply #2 on: 15 May 2008, 03:59:55 »
 :clap:

works great.. thanks for helping.

here is a nice looking time change:

whatever.sqs

Code: [Select]
; start the time acc

_x=0
#loop
~.04
_x = _x +1
skiptime .0625
? _x >= 195 : goto "next"
goto "loop"

#next
;script continues from here
« Last Edit: 15 May 2008, 04:41:29 by loki72 »

Offline Gielovic

  • Contributing Member
  • **
Re: counting loops [solved]
« Reply #3 on: 20 May 2008, 22:05:03 »
use SQF  :D

Code: [Select]
_x = 0;
while {_x < 12 } do
{
    //do whatever you think is necessary but don't forget the following line
    _x = _x + 1;
};

or use the for-loop
Code: [Select]
for [{_x= 0},{_x <12},{_x = _x + 1}] do
{
    //again do whatever you like...and nothing more:D
};

Offline loki72

  • Former Staff
  • ****
    • Loki's Nightmare
Re: counting loops [solved]
« Reply #4 on: 22 May 2008, 00:29:39 »
weird how you can say the same thing 3 ways.. no wonder scripting has such a steep learning curve. :blink:

i have to agree that .sqf is nicer than .sqs.. but the whole 'grouping' and the brackets is still a bit beyond my level of understanding.

what is the difference between { } and [ ] in the way it is recognized?