Hi guys.
QuestionSuppose I'm running an SQS script. If I assign a
local variable to a function using the preProcessFile command (see example), will the pre-processed code be discarded after the script exits? If not, will running that same script again cause a duplicate function to be created? If so, will the cost of RAM be significant?
Example_distanceFormula = preProcessFile "distancepos.sqf"
_dist = [getpos player, getpos alife] call _distanceFormula
? _dist > 1000 : hint "You are very far from having a life"
exit
ExplanationI'm making a mission that uses a
lot of functions. Right now I have them all assigned to global variables in the init.sqs file.
distanceFormula = preprocessfile "distancepos.sqf"
gridCoord = preProcessFile "kurtzgridcoord.sqf"
gridCenter = preProcessFile "gridCenter.sqf"
;etc....
This is using a lot of global variables and I'm concerned that I could run aground on the
saveGame bug. Therefore, I'm considering listing the needed functions at the beginning of each SQS script (like in the example above), rather than having a single master list of functions.
However, I'm worried that this technique will create useless duplicates of functions saved in RAM, because each script might load a new instance of each .sqf file without deleting the old ones.
Any suggestions?