#1 18-10-2011 15:13

gozo12
Registered: 16-10-2011
Posts: 4

how i use Loop ?

how i make the line run 10 times how i use Loop in cleo ?

Offline

#2 18-10-2011 15:28

Yoda
From: Moscow
Registered: 08-03-2011
Posts: 90

Re: how i use Loop ?

First of all, open Sanny Builder->Help->Contents->Articles and read both of them. Then, if you have more questions or if you need clarification - ask.
The loop is this:

:label_1
wait 0
jump_if_false @label_1
some_opcodes

:label_2
wait 0
jump_if_false @label_2
some_opcodes
jump @label_1

or variations of this


Try not. Do or do not, there is no try.

Offline

#3 18-10-2011 15:29

Den_spb
From: Ленинград
Registered: 23-11-2008
Posts: 941
Website

Re: how i use Loop ?

It's very simple to use loops. Example:

{$CLEO}
model.Load(403)
038B: load_requested_models
1@ = 190.6194 
for 0@ = 0 to 9
    car.Create(2@(0@,10i) 403 -1991.5049 1@ 27.5391)
    0175: set_car 2@(0@,10i) Z_angle_to 90.0 
    1@ -= 5.0    
end
model.Destroy(403)
0A93:

Cars will created near SF railway station. Handles of cars will written to variables 2@ - 11@.

Offline

#4 18-10-2011 15:33

Yoda
From: Moscow
Registered: 08-03-2011
Posts: 90

Re: how i use Loop ?

эк ты человека сразу высоким уровнем с арреями...:D

Last edited by Yoda (18-10-2011 15:34)


Try not. Do or do not, there is no try.

Offline

#5 18-10-2011 15:35

Den_spb
From: Ленинград
Registered: 23-11-2008
Posts: 941
Website

Re: how i use Loop ?

Лучше сразу учиться нормальному стилю, чтобы потом не переучиваться wink
Хотя я тоже когда-то начинал с меток.
Ну а что касается массива, то без него тут не обойтись - писать все хэндлы в одну переменную нет смысла.

Last edited by Den_spb (18-10-2011 15:38)

Offline

#6 18-10-2011 15:43

Yoda
From: Moscow
Registered: 08-03-2011
Posts: 90

Re: how i use Loop ?

да-да... буквально пару дней назад наблюдал подобную беседу (там в конце) между ZAZ'ом с одной стороны (низкоуровневый стиль) и Wesser'ом и Deji с другой (высокоуровневый)... ZAZ отвечать не стал...

Last edited by Yoda (18-10-2011 15:45)


Try not. Do or do not, there is no try.

Offline

#7 04-07-2013 07:45

Bigbossbro08
Registered: 22-06-2013
Posts: 26

Re: how i use Loop ?

It is simple to use loops.

Here is the code to use loops.

while true
wait <your time>
<upcodes>
end

Or use this,

repeat
<upcodes>
until <condition>

Offline

#8 02-09-2013 18:59

mary roy
Registered: 02-09-2013
Posts: 1

Re: how i use Loop ?

It is very simple. you should try this...my method is  same like Bigbossbro08

while true
wait <your time>
<upcodes>
end

Last edited by mary roy (02-09-2013 19:10)

Offline

Board footer

Powered by FluxBB