OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: 456820 on 08 Feb 2005, 15:33:32

Title: lag?
Post by: 456820 on 08 Feb 2005, 15:33:32
i think this goes here anyway. can lag be caused by scripts not having exit on the end? and is there anyways of getting rid of lag without deleting anything in game?
Title: Re:lag?
Post by: 456820 on 08 Feb 2005, 15:36:08
and also does any one have a script wich deletes dead bodies after a set amount of time?
Title: Re:lag?
Post by: GI-YO on 08 Feb 2005, 15:54:06
Macguba made a handy 'lag buster' tute in the ed department, im sure that will give you all the info you need to know.

GI-YO
Title: Re:lag?
Post by: macguba on 08 Feb 2005, 16:19:40
There are also dead body deletion scripts in the Ed Depot.  

I don't know about scripts with no "exit" though.    If there were a lot of them, and depending on how the game handles them, then I suppose it could cause lag problems.   But then if there were a lot of unexited scripts around lag might be the least of your worries.     Or perhaps the game just exits a script automatically when it can't find any more commands.

The best way to deal with lag of course is to buy a much better computer.  ;D

Oh, and if you think of something after you've posted, you can modify your own posts - just click the button in the top right hand corner.     Helps make the thread easier to read too.  :)
Title: Re:lag?
Post by: Baddo on 08 Feb 2005, 16:31:09

I thought it was obvious that a script dies completely if there's no more lines left.

I can't even imagine a reason why the game would keep a script file in memory or process it somehow, if there's nothing to read.

If it happens it's a programming error.
Title: Re:lag?
Post by: Acecool on 08 Feb 2005, 16:42:07
Why would it be a programming error if it does what its told...

If it is not told to exit through the front door "Exit" then it stays...
Title: Re:lag?
Post by: Baddo on 08 Feb 2005, 16:55:48
Please read this again:

Quote
can lag be caused by scripts not having exit on the end?

Well...

It would certainly be a programming error if a script file is kept in memory or processed somehow after the script has reached the end of file.

A script has to have an endless loop if it continues running, or am I completely wrong? Tell me what exactly does the game do with a script file after it is read to the end?
Title: Re:lag?
Post by: macguba on 08 Feb 2005, 17:41:47
I don't know.    Though I'm sure somebody does and I hope they tell us.

But my point is that it doesn't matter in this particular case.   If you have one script on an endless non-exit loop that's not enough to cause lag.   If you have loads of such scripts your mission is fucked up anyway.
Title: Re:lag?
Post by: CopyrightPhilly on 08 Feb 2005, 17:43:45
only use loops if you need to, from what i know exitign a script will be very usfull in reducing lag if your mission has many scripts.

but loops, always make sure you have a delay in it somthing like ~0.5, this will stop "system lag" being as bad.
Title: Re:lag?
Post by: Baddo on 08 Feb 2005, 17:52:47
Magcuba, I am pretty sure all scripts that do not have an endless loop are exited automaticly at the end of the file and do not exist after that. Or let's say, the game does not keep the memory address where the script was in the memory and releases that part of memory to other use.

Functions are different as far as I have read from a great tutorial somewhere here...
Title: Re:lag?
Post by: The-Architect on 08 Feb 2005, 19:35:43
Here's a thing, just put "exit" at the end of your script anyway. Its good practice, like ending stuff in html. If a mission maker has used a script without one and the mission works fine then what's the problem? If you are writing the script, then you should end it with "exit" anyway.
Title: Re:lag?
Post by: Planck on 08 Feb 2005, 22:18:15
In my experience, and logically, when a script runs out of lines to process it will exit.

It will exit whether 'exit' is present or not.

Exit is nice and tidy, but not strictly essential.


Planck