Sorry for the lack of posts recently. It is not that I have no content to post, I have tonnes. I’ve been quite busy (and still am) with other things + the ISP terrorist engineers deprived me of my Internet for a few days, which kinda messed things up. But first of all I’d like to say big thank you (спасибо) to Nazar, for another donation! You’re spoiling me, Nazar
Anyway, today I’m going to release another extension I made. Quite recently BIS added new command – squadParams, which makes content of squad.xml file available to mission makers. TBH I am not too fast about squad.xml implementation. I think in 2014 the whole process should be a bit less painful. It has some potential and I was going to test something, but then I remembered Steam had a nice API and one of the functions was to retrieve friend list for any user (provided the user profile is not private).
Consider this. You can already join friend’s game from Steam. With a bit of further tweaking you can put the player with his friend in the same squad upon player joining the server. What you need is to know who is friend with whom. And this is where Steam API comes handy. The IDs API operates with are the same UIDs available in Arma 3 (not Arma 2) with getPlayerUID command or via _uid var in onPlayerConnected.
So I took my url_fetch extension and modified it to retrieve friend list for passed UID from Steam. How does it work? Due to security limitations, the extension has to be server side. So when player joins the server you can just go ahead and feed extension the player UID like this:
onPlayerConnected will execute only server side by default if placed in init.sqf for example. The extension will contact steam API and retrieve (or not ) the friend list for this user and store it internally. If you call the extension again, for example:
you will either get “WAIT”, if fetching is still in progress, or “” if fetching failed or player has private profile or has no friends, or something like this if everything is fine:
It will be a string obviously, so needs call compile to become array. Steam allows something like 300 friends. I did some calculation and with extension output limit of 10K, 300 UIDs can currently fit in a single output. I might make some extension handling examples later on.
The “” result is quite vague, so for debugging purposes only you can call extension with “ERROR” to see the last error.
If result is “” and last error is “” this would mean player has no friends. Because “” could also mean something went wrong with internet connection, if you call extension again with the same UID it will try to fetch friend list again. When the result is successful it will be permanently stored inside .dll until you either restart the server or clear internal .dll memory with “CLEAR” command:
The number returned will indicate how many results were in memory before it got cleared. On very long running servers it could be particular useful to clear results from .dll memory. “ABOUT” will return some about information with version number.
EDIT: Thanks to Soul for his comment (below), it looks like Arma 2 has been updated to Steam ID system, so this extension should now be compatible with A2 as well.