Home   Help Search Login Register  

Author Topic: Speeding scripts up  (Read 10034 times)

0 Members and 1 Guest are viewing this topic.

PheliCan

  • Guest
Re:Speeding scripts up
« Reply #60 on: 18 Dec 2005, 15:45:30 »
- the 0.01 wait will not work within a block of code delineated by {}

That pretty much sais it all. The point of the pause was to give room for other tasks. Ohh, well...

Offline hardrock

  • Members
  • *
  • Title? What's that?
    • Operation FlightSim
Re: Speeding scripts up
« Reply #61 on: 26 May 2006, 11:02:31 »
The difference is that code blocks à foreach or while are executed within a single frame, just as are functions. All those blocks theoretically represent a line of a script, and OFP always parses one line at once.

So OFP takes the same time for executing
Code: [Select]
myVar = 1as for
Code: [Select]
myVar = 1; mySecondVar = 2; myThirdVar = 3or for
Code: [Select]
{myArray = myArray + [_x]} forEach [1,2,3,4,5]
Of course, the longer a line, the more lag will appear ingame on the long run. But if used wisely and sparely, you can get pretty good results.