loop2 function, can't get to loop

For problems with creating games or for reporting bugs of the Tool.
Post Reply
theswitch
PaC-DK Newby
Posts: 41
Joined: 11 Apr 2007, 15:50
Location: north of Toronto

loop2 function, can't get to loop

Post: # 76415Post theswitch
06 Nov 2010, 14:49

mabe I am typing it wrong, I tryed function loop2 but can't get my script to loop, tryed starting this function in room script and main script (the games main script)

I think I just need to enter the code correctly for function loop2 command, . . . . I think

Baelavay
PaC-DK God
Posts: 1168
Joined: 04 Jun 2006, 19:24
Contact:

Post: # 76416Post Baelavay
06 Nov 2010, 15:18

Wait, I think you're mixing up on(loop), room script, main script and functions.


Firstly, you have the main script which runs all the time, it doesn't matter which room you're in. You don't need a loop() command in the main script either, just put your command lines in there.

Then you have the room script. It is initiated automatically when the room is loaded, but it requires commands like on(enter) and on(loop).

And then there are functions. Those are independent scripts which are initiated on command and repeated by a specified number of times. They don't require any on(loop) stuff either.


So, your mistakes are:
- on(loop2) is not a function itself and is not supposed to be written in a function either
- on(loop2) belongs to room script, it doesn't work right if you put it into the main script

If you've put on(loop2) into the room script and it still doesn't work, you made a mistake in the script or you didn't start the room script at all (because the room is not loaded?)

theswitch
PaC-DK Newby
Posts: 41
Joined: 11 Apr 2007, 15:50
Location: north of Toronto

Post: # 76420Post theswitch
06 Nov 2010, 16:28

so can I loop a script infinitly somehow as this is written about in manual

I thought this could be done with

function (sciptname;loop2)

etc

all I would like is to place a function command in main or room script so I don't have to put the code all in the room script or main script as everything then gets so hard to brows through as its all in on script file

Baelavay
PaC-DK God
Posts: 1168
Joined: 04 Jun 2006, 19:24
Contact:

Post: # 76421Post Baelavay
06 Nov 2010, 16:48

You can create a piece of script and run it as a function with the command function(NAME;NUMBER OF RUNS)

To play it infinitly, use * or infinitly

As I said before, on(loop2) belongs into the room script only!!!

theswitch
PaC-DK Newby
Posts: 41
Joined: 11 Apr 2007, 15:50
Location: north of Toronto

Post: # 76441Post theswitch
06 Nov 2010, 22:16

I discoverd I did not have my brackets setup right and also dummy me did not know I need to start a function with an on command first, such as on keypress etc

so I solved my problem

thank you for your help, sorry about that

Post Reply