Jump to content
Maffine

Problem with code performance please help

Recommended Posts

Hello everyone,

 

I am currently doing two addons for myself and I encountered some problem in field test after everything made sense in editor. 

The mission I used to test involves a virtual arsenal at some point of the mission so that the player can customize their loadouts. However it would just stuck at the loading screen when I try to open the arsenal with the script on. I tried to run the mission without any mods and everything works fine, and when I only enable one script, the arsenal became accessible only that it will take much longer. Therefore my theory is that the while do script runs on each frame even when the loading screen is displayed and somehow severely affect the efficiency of the loading process. The problem is whether this can be avoided.

The code structure I used for both addons:

[] spawn {
	_varA = 0.0;
	_varB = 0.0;
	...
	while {alive player} do
	{
		
		<Some code here>
	};
};

I understand that there may be a performance issue since my PC is really an old one, but it is obviously more ideal if the addon is more friendly to low-end devices.

Thanks for any advice and sorry for my poor English.

Share this post


Link to post
Share on other sites

OK...I found another running script with do while loop that is forgotten by me. After changing all the while {alive player} to while {true} and optimizing some of my code, the arsenal is available now. Sure it still takes longer than normal (with no mod loaded), but it does not take infinite anymore.

Share this post


Link to post
Share on other sites

Nah, it's an addon. I ran it through my own sqf file defined in my config.cpp

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×