DrBernhard Posted November 26, 2008 Share Posted November 26, 2008 I got numerous requests about the shortlist format in FM, so I figured it out. Every shortlist starts with 14 bytes, highlighted by the purple box. Then 4 bytes indicating how many chars the shortlist-name will be (in this case: 3) Then 2 bytes for each char describing the name of the shortlist (in this case 6 bytes) (light blue) Then 2 bytes of bogus data Then 4 bytes describing the number of items in the shortlist (in this case 2) (red) Then 4 bytes for each element in the shortlist describing the player ID (blue/orange) And 1 byte finally with the value of 0. Good luck! Link to post Share on other sites More sharing options...
DrBernhard Posted November 26, 2008 Author Share Posted November 26, 2008 C# Code for creating shortlist private void Form1_Load(object sender, EventArgs e) { int[] players = new int[] {8443037, 35011612, 3301294 }; string name = "Test"; using (FileStream stream = new FileStream(@"C:\test.slf", FileMode.OpenOrCreate)) { using (BinaryWriter sw = new BinaryWriter(stream)) { sw.Write(new byte[] { 0x02, 0x01, 0x66, 0x6C, 0x73, 0x2E, 0x01, 0x00, 0x00, 0x01, 0xC0, 0xD6, 0x64, 0x00 }); sw.Write(FromIntToHex(name.Length)); sw.Write(FromStringToHex(name)); sw.Write(new byte[] { 0x00, 0x00 }); sw.Write(FromIntToHex(players.Length)); foreach (int playerId in players) { sw.Write(FromIntToHex(playerId)); } sw.Write(0x00); } } } private byte[] FromIntToHex(int value) { byte[] buffer = new byte[4]; { buffer[0] = (byte)(value & 0xff); buffer[1] = (byte)((value & 0xff00) >> 8); buffer[2] = (byte)((value & 0xff0000) >> 0x10); buffer[3] = (byte)((value & 0xff000000L) >> 0x18); } return buffer; } private byte[] FromStringToHex(string value) { List<byte> bytes = new List<byte>(); char[] chars = value.ToCharArray(); foreach (char c in chars) { bytes.Add((byte)c); bytes.Add(0x00); } return bytes.ToArray(); } Link to post Share on other sites More sharing options...
arsenaltops Posted November 26, 2008 Share Posted November 26, 2008 This is probably going to sound stupid but why would you need to code a shortlist using C# when the game creates them for you and so many new scouting tools are cropping up each day? Link to post Share on other sites More sharing options...
mrsl Posted November 26, 2008 Share Posted November 26, 2008 Well done, great work! This will help people developing those editors and scouts Link to post Share on other sites More sharing options...
DrBernhard Posted November 26, 2008 Author Share Posted November 26, 2008 This is probably going to sound stupid but why would you need to code a shortlist using C# when the game creates them for you and so many new scouting tools are cropping up each day? This is support information for anyone out there creating their scout-tools, and who can't get shortlists to work (f.e. the author of FMAgent). Now they can implement this feature with ease. Link to post Share on other sites More sharing options...
homerjnick Posted November 26, 2008 Share Posted November 26, 2008 What about the tactics file? .tac would be handy. Link to post Share on other sites More sharing options...
Cin-cout Posted November 27, 2008 Share Posted November 27, 2008 int[] players = new int[] {8443037, 35011612, 3301294 }; are those numbers the player ids? Link to post Share on other sites More sharing options...
DrBernhard Posted November 27, 2008 Author Share Posted November 27, 2008 That's correct. Link to post Share on other sites More sharing options...
Fulham_Mic Posted January 19, 2009 Share Posted January 19, 2009 What about the tactics file? .tac would be handy. I'll second this ? Any chance DrBernhard ? Cheers -Mic Link to post Share on other sites More sharing options...
brightonrock Posted January 22, 2009 Share Posted January 22, 2009 I asked about this a while ago and didn't get an answer so I wondered whether it was something people weren't able to discuss, like fake teams etc, but could this coding be used to edit AI shortlists? My original example was santa cruz, parker, toure being wanted by man city instead of zhirkov, srna, hamsik etc? Sorry if this isn't supposed to be discussed, but if it is allowed, is this sort of thing possible using an editor ie FMRTE? I'm no coding genius, in fact I have no knowledge whatsoever, but I could fiddle about with an editing tool if its something that can be done? Link to post Share on other sites More sharing options...
Gesh Posted February 28, 2009 Share Posted February 28, 2009 this is changed in 9.3.0 im sure ;/ Link to post Share on other sites More sharing options...
Thanoulas Posted March 1, 2009 Share Posted March 1, 2009 Shortlist Code example and addresses for 9.3 Shortlist file format private void Form1_Load(object sender, EventArgs e) { int[] players = new int[] {8443037, 35011612, 3301294 }; string name = "Test"; using (FileStream stream = new FileStream(@"C:\test.slf", FileMode.OpenOrCreate)) { using (BinaryWriter sw = new BinaryWriter(stream)) { sw.Write(new byte[] { 0x02, 0x01, 0x66, 0x6C, 0x73, 0x2E, 0x01, 0x00, 0x00, 0x01, 0x91, 0x52, 0x38, 0x00 }); sw.Write(FromIntToHex(name.Length)); sw.Write(FromStringToHex(name)); sw.Write(new byte[] { 0x00, 0x00 }); sw.Write(FromIntToHex(players.Length)); foreach (int playerId in players) { sw.Write(FromIntToHex(playerId)); } sw.Write(0x00); } } } private byte[] FromIntToHex(int value) { byte[] buffer = new byte[4]; { buffer[0] = (byte)(value & 0xff); buffer[1] = (byte)((value & 0xff00) >> 8); buffer[2] = (byte)((value & 0xff0000) >> 0x10); buffer[3] = (byte)((value & 0xff000000L) >> 0x18); } return buffer; } private byte[] FromStringToHex(string value) { List<byte> bytes = new List<byte>(); char[] chars = value.ToCharArray(); foreach (char c in chars) { bytes.Add((byte)c); bytes.Add(0x00); } return bytes.ToArray(); } Link to post Share on other sites More sharing options...
chapperzUK Posted September 16, 2009 Share Posted September 16, 2009 I am using this code and would like to know how I can change it so that every player in a datagridview can go into the shortlist. (The player's ID will be in the 1st column). Could someone either email me or PM me. Thanks in advance. Link to post Share on other sites More sharing options...
chapperzUK Posted September 18, 2009 Share Posted September 18, 2009 I have tested this code but I only get 3 players in the shortlist. The bit I have changed is in red and bold. dgvShortlist = DataGridView with the players that will get transfered to the shortlist in it. In cell(0) is the player's ID private void Form1_Load(object sender, EventArgs e) { int[] players = new int[] {8443037, 35011612, 3301294 }; string name = "Test"; using (FileStream stream = new FileStream(@"C:\test.slf", FileMode.OpenOrCreate)) { using (BinaryWriter sw = new BinaryWriter(stream)) { sw.Write(new byte[] { 0x02, 0x01, 0x66, 0x6C, 0x73, 0x2E, 0x01, 0x00, 0x00, 0x01, 0x91, 0x52, 0x38, 0x00 }); sw.Write(FromIntToHex(name.Length)); sw.Write(FromStringToHex(name)); sw.Write(new byte[] { 0x00, 0x00 }); sw.Write(FromIntToHex(players.Length)); [b][color="Red"]foreach (DataGridViewRow row in dgvShortlist.Rows) { sw.Write(FromIntToHex(row.Cells(0).Value.ToString())); }[/color][/b] sw.Write(0x00); } } } private byte[] FromIntToHex(int value) { byte[] buffer = new byte[4]; { buffer[0] = (byte)(value & 0xff); buffer[1] = (byte)((value & 0xff00) >> 8); buffer[2] = (byte)((value & 0xff0000) >> 0x10); buffer[3] = (byte)((value & 0xff000000L) >> 0x18); } return buffer; } private byte[] FromStringToHex(string value) { List<byte> bytes = new List<byte>(); char[] chars = value.ToCharArray(); foreach (char c in chars) { bytes.Add((byte)c); bytes.Add(0x00); } return bytes.ToArray(); } Thanks in advance Link to post Share on other sites More sharing options...
chapperzUK Posted September 20, 2009 Share Posted September 20, 2009 Also the name of the shortlist on FM comes out as 'Untitled', does anyone know how to change this? Link to post Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.