pierremgi 4862 Posted April 21, 2021 Not sure to understand why. - initPlayerLocal.sqf is running on client who have interface anyway, not on dedi or Headless Client. So, if I'm right, the hasInterface condition in initPlayLocal.sqf is useless. - the !isNull findDisplay 46 is usual. I missed that. But... why a difference between hosted and dedicated server? They have, in I'm right, the same initialization order, and the fact a hosted server is also a client should not impact the process on other clients... I'd really like to know why this solution works. Perhaps someone with better understanding than me could explain that to the community. Thanks. 1 Share this post Link to post Share on other sites
Tory Xiao 5 Posted May 6, 2022 On 4/21/2021 at 10:38 PM, pierremgi said: Not sure to understand why. - initPlayerLocal.sqf is running on client who have interface anyway, not on dedi or Headless Client. So, if I'm right, the hasInterface condition in initPlayLocal.sqf is useless. - the !isNull findDisplay 46 is usual. I missed that. But... why a difference between hosted and dedicated server? They have, in I'm right, the same initialization order, and the fact a hosted server is also a client should not impact the process on other clients... I'd really like to know why this solution works. Perhaps someone with better understanding than me could explain that to the community. Thanks. Have anyone figured out how to add autorun script to mission files? Share this post Link to post Share on other sites
dreadedentity 278 Posted May 6, 2022 On 4/21/2021 at 10:38 AM, pierremgi said: I'd really like to know why this solution works. Perhaps someone with better understanding than me could explain that to the community. Thanks. I'm more than a year late seeing this so maybe you've already found the answer, but this is caused by race conditions created in user-scripts. The short answer is that display 46 just doesn't exist at the time that code runs, so no EH can be added. That can be easily checked with: //in any "initX" script at the very beginning with uiNamespace do { myVar = findDisplay 46; }; uiNamespace getVariable "myVar" //put in console as a Watch variable; returns displayNull which is shown as "No display" I can't give you the long answer as I am only knowledgeable enough with the initialization order to make my stuff work 😛 You may have realized this by now, but the actual important thing here and why it works is suspending the script with waitUntil allows time for the display to get created. You may already know that some commands just don't seem to work in init.sqf until it has been suspended in some way. Sleep will work just the same to create this effect. This is the exact reason why you'll see "sleep 0.001;" at the very beginning of so many of my init.sqf's 1 Share this post Link to post Share on other sites
pierremgi 4862 Posted May 7, 2022 Yes, probably due to the client state chronology. Even in initPlayerLocal.sqf, the client is already an entity (so player command works) before the player (guy who plays) has reached the display 46 (world display). Share this post Link to post Share on other sites
pierremgi 4862 Posted May 7, 2022 12 hours ago, Tory Xiao said: Have anyone figured out how to add autorun script to mission files? Not sure to understand your question, but you just have to add some of these event scripts at mission root folder. You can run your sqfs from them, if needed. see also initialization order, especially for MP context. Share this post Link to post Share on other sites