Jump to content

Scout / Editor Framework 2010 (Make your own FMScout / FMEditor)


DrBernhard

Recommended Posts

Ever wanted to build your own FMScout, FMRTE? Ever wanted to do crazy stuff to the ingame database, but no button in FMRTE which provided the function? Now you can build everything you want on your own!

This is a framework for developers only! Please read the tutorial here: http://www.100procentjan.nl/fm2009/tutorial.htm

Version 1.3.0 out, complete version. 10.3 support added

After the tremendous success of last years project, there is a new version of the FM Scout/Editor Framework. FMSE can be and is used to create scouts and editors for Football Manager 2010 by using any .Net language! The framework is just a single ready-to-use assembly, which can be included in any .Net project (both Visual Basic and C#). The Framework gives you the ability to query the database using LINQ, make changes to the game's objects, and produce your own personalized scout or editor!

The framework has extended since last year, which means: more properties to play with and way better speed!

The framework is fully opensource, feel free to contribute! (Google code link below)

Key features

* Query the ingame database

* Find players, clubs, staff, cities, continents, stadiums, teams, etc.

* Make realtime changes to the in-memory database

* Create complex filters

* Get the active player, and show his stats immediately

* Perform batch operations on a whole bunch of persons

* Used (partly) by FMScout, FMRTE, MiniSE and many more

* Driven by the community

New additions

* Advanced caching to optimize speed

* Rating system based on Genie's

Links

* Google Code Project: http://code.google.com/p/scoutframeworkfm2009/

* Ready to use assemblies: http://scoutframeworkfm2009.googlecode.com/files/FMSE2010.Core.dll (Core)

* Basic tutorial: http://www.100procentjan.nl/fm2009/tutorial.htm

* Demo Apps (MiniScout and FMSE.FMScout) are available in the SVN repo

* For Ratings download the FMSE.Utils http://scoutframeworkfm2009.googlecode.com/files/FMSE2010.Utils.dll

What do I need?

If you are making an editor, or you only want to get the Active Player or something, use 'new FMContext(DatabaseModeEnum.Realtime)'.

If you are making a scout, and want massive performance when searching; ratings etc, use 'new FMContext(DatabaseModeEnum.Cached)'; don't forget to download FMSE.Utils, as this will give you a free ratings system.

- Realtime mode, loads extremely fast (within a second on almost every game). Queries will take quite a while. Possible to edit things!

- Cached mode, loads quite fast (200.000 person db, 13 sec, + 2 sec for ratings). Queries perform almost always under the 100 ms. Not possible to edit things!

Major thanks to ruci, for finding like 98% of all new offsets

Link to post
Share on other sites

  • Replies 134
  • Created
  • Last Reply

DrBernhard, First of all thanks a lot for the new release!

I have a problem and I cannot debug it. I used this to find a specific club, on 2009 version:

Club club = fm.Clubs.Single(c => c.Name == "Birmingham City");

which worked fine. And just tweaked my code with your new framework version, everything work fine except the line I mentioned above, which is almost the same. It cannot find "Birmingham City". I tried lots of other club names, in case a typo on it, but no help. I even tried this:

Club club = fm.Clubs.Single(c => c.ID == 609);

to get rid of any error on the string, did not work as well, could not find this ID this time. Shouldn't these work? If not what's wrong with it?

Link to post
Share on other sites

which worked fine. And just tweaked my code with your new framework version, everything work fine except the line I mentioned above, which is almost the same. It cannot find "Birmingham City". I tried lots of other club names, in case a typo on it, but no help. I even tried this:

Club club = fm.Clubs.Single(c => c.ID == 609);

to get rid of any error on the string, did not work as well, could not find this ID this time. Shouldn't these work? If not what's wrong with it?

Well, that's quite strange. You can however find any other club? Do you get any results with fm.Clubs.Where(c=>c.Name.ToLower().StartsWith("birmingham")); ? They might have changed the name to Birmingham FC or something.

Downloaded the DLL and found that Player seems missing Age property.

I'm aware, you can however compare Global.InGameDate with the player's date of birth, to get his age. Will be added to the repo.

Link to post
Share on other sites

Well, that's quite strange. You can however find any other club? Do you get any results with fm.Clubs.Where(c=>c.Name.ToLower().StartsWith("birmingham")); ? They might have changed the name to Birmingham FC or something.

No, I get the same exception with fm.Clubs.Where(c=>c.Name.ToLower().StartsWith("birmingham")); as well.

Here is my code, it's so simple, there has to be sth very simple missing but couldn't find it yet:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Young3.FMSearch.Core;
using System.Reflection;
using Young3.FMSearch.Interface;
using Young3.FMSearch.Core.Entities.InGame;
using Young3.FMSearch.Utils;
using System.Diagnostics;


namespace WindowsFormsApplication2
{
   public partial class Form1 : Form
   {

       public FMContext fm;


       public Form1()
       {
           InitializeComponent();
       }

       private void Form1_Load(object sender, EventArgs e)
       {

           fm = new FMContext();

       }

       private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
       {

       }

       //START: Goalkeepers
       private void button1_Click(object sender, EventArgs e)
       {
           dataGridView1.AutoGenerateColumns = true;

           try
           {

               //Club club = (Club)fm.Clubs.Where(c => c.Name.ToLower().StartsWith("birmingham"));
               //Club club = fm.Clubs.Single(c => c.ID == 609);
               Club club = fm.Clubs.Single(c => c.Name == "Birmingham City");

               var query =
                   from p in fm.Players
                   where p.Team != null && p.Team.Club == club
                   orderby ((p.Skills.Reflexes) + (p.Skills.Handling) + (p.Skills.Communication) + (p.Skills.Jumping) + (p.Skills.Positioning)) descending
                   select new
                   {
                       Name = p.FirstName + " " + p.LastName,
                       Pos = p.PositionalSkills,
                       Total = ((p.Skills.Reflexes) + (p.Skills.Handling) + (p.Skills.Communication) + (p.Skills.Jumping) + (p.Skills.Positioning))
                   };

               dataGridView1.DataSource = query.ToList();
           }
           catch
           {
               MessageBox.Show("Team not found!");
           }
       }

     }
}

I tried the commented-out fm.Clubs.Single(c => c.ID == 609); and fm.Clubs.Where(c=>c.Name.ToLower().StartsWith("birmingham")); too, still have the same problem.

I've put try-catch to handle keynotfound exception. Do you see sth missing/problem that I cannot see?

Link to post
Share on other sites

I am having another question. For Players, Current & Potential Playing Ability is Int16 and other skills is SByte. How can I convert to InGame value? E.g., CA / PA is 200-based, and other skills is 20-base. Thanks!

Ingame is 1-20, but the SByte value is 1-100. So just divide by 5.

Link to post
Share on other sites

var bir = fm.Clubs.Where(s => s.Name.ToLower().StartsWith("birmingham")).First();

this works for me.

Btw, there is a Ratings() extension in the Utils project in the framework. Just put a

using Young3.FMSearch.Utils;

at the top of your project, and you can access the rating by playerObject.Ratings().Goalkeeper or playerObject.Ratings().BestRating() etc.

Are you using the non-Steam version of the demo btw? Framework works for FM2010 non-steam demo only at this point

Link to post
Share on other sites

var bir = fm.Clubs.Where(s => s.Name.ToLower().StartsWith("birmingham")).First();

this works for me.

Btw, there is a Ratings() extension in the Utils project in the framework. Just put a

using Young3.FMSearch.Utils;

at the top of your project, and you can access the rating by playerObject.Ratings().Goalkeeper or playerObject.Ratings().BestRating() etc.

Are you using the non-Steam version of the demo btw? Framework works for FM2010 non-steam demo only at this point

I think I should take a look at my environment again since yours is already working. But anyway, I've modified your sample application with my reqs and it works fine!

Thanks for the help;)

Link to post
Share on other sites

I have a problem and don't know how to solve. For some of the players' CA / PA, it will throw an exception saying that "Value was either too large or too small for an Int16." Any ideas? Thanks!
Downloaded the DLL and found that Player seems missing Age property.

These issues are fixed in the latest svn commit. You can do an update and rebuild the DLL's, or just get the dll's from the link in the first post.

Link to post
Share on other sites

Hi. First congratulations for the framework.

I have a programming issue that maybe you can help.

I am making a tool for converting FM Players to Fifa10 format.

I am using the "print screen" function from the game to export a text file with the team i want to convert and from that file i make that conversions needed and generate a csv file to import into FIFA. (I could use your framework but i want to do a program that would not depend from any FM framework and the exported FM file is more than enough for my tool).

I just have a problem for converting player positions. I need to convert all the possible FM positions combinations into the basic Fifa Postions (GK,LB,LWB,RB,RWB,CB,RCB,LCB,DM ....)

How can i "extract" the information i need from a complex string like D/WB/DM LC. I just need the role (Defender,Midfielder etc and the side (Left,Right,Center).

There might be any regex that can to the job but i cant think of any.

Do you have any idea?

If i cant find anything i have to do the hard way. Making a switch with all the possible combinations i may find.

Also do you know any book/tutorial where i can learn hex editing and memory reading/writing?

Link to post
Share on other sites

Hi. First congratulations for the framework.

I have a programming issue that maybe you can help.

I am making a tool for converting FM Players to Fifa10 format.

I am using the "print screen" function from the game to export a text file with the team i want to convert and from that file i make that conversions needed and generate a csv file to import into FIFA. (I could use your framework but i want to do a program that would not depend from any FM framework and the exported FM file is more than enough for my tool).

I just have a problem for converting player positions. I need to convert all the possible FM positions combinations into the basic Fifa Postions (GK,LB,LWB,RB,RWB,CB,RCB,LCB,DM ....)

How can i "extract" the information i need from a complex string like D/WB/DM LC. I just need the role (Defender,Midfielder etc and the side (Left,Right,Center).

There might be any regex that can to the job but i cant think of any.

Do you have any idea?

If i cant find anything i have to do the hard way. Making a switch with all the possible combinations i may find.

Also do you know any book/tutorial where i can learn hex editing and memory reading/writing?

In short, just use the framework :-). There is a positionalSkills property on each Player which is easily convertible into fifa 10 format. Memory editing isn't that big of deal but you just have to know the basics, the fastest way should be checking out the framework code, just see how you can find and edit an attribute, and then seek further with tools like ArtMoney, and implement the found offsets in your own code.

Link to post
Share on other sites

Non-patched. Haven't patched my game yet, and could use some support from other members who f.e. have the Steam version etc.

Adding the version is quite simple, so if anyone can have a look (ProcessManager -> getVersionOffset) :-)

Ahh, ok! I will have a look at it when I back to home today, if I don't forget ;)

Link to post
Share on other sites

I keep getting KeyNotFoundException when trying to populate a comboBox upon MainForm_Load. Im using ...


       private void MainForm_Load(object sender, EventArgs e)
       {
           fm = new FMContext();

          var teamCombo =
               from club in fm.Clubs
               where club.Name != null
               orderby club.Name
               select club.Name;
           comboBox1.Items.AddRange(teamCombo.ToArray());


       }

Any idea where I might be going wrong?

Link to post
Share on other sites

I keep getting KeyNotFoundException when trying to populate a comboBox upon MainForm_Load. Im using ...

Any idea where I might be going wrong?

I had similar problem, kept getting keynotfound exception but could not find what the problem is. You can see it on post #7

Link to post
Share on other sites

Dear DrBernhard,

I can't enumerate through staff

IEnumerable<Player> playerCollection = fm.Players.Where(p => p.Contract.Club == curClub); worked fine but

IEnumerable<Staff> staffCollection = fm.NonPlayingStaff.Where(st=> st.Team.Club==curClub ); or

IEnumerable<Staff> staffCollection = fm.NonPlayingStaff.Where(st=> st.Contract.Club==curClub ); didn't work neither

So where was I wrong? Tks you.

Link to post
Share on other sites

Hello and thank you for your beautiful framework.

I'm trying to make a simple mini scout that display the current player info.

But, after loading data in the context, the ActivePlayerObject is null (ActiveStaffObject and ActiveTeamObject null too).

This is my code to load the data:

currentDataContext = new FMContext();

currentDataContext.LoadData();

Any idea?

Thanks all (and sorry for my bad english).

Bye

Link to post
Share on other sites

I keep getting KeyNotFoundException when trying to populate a comboBox upon MainForm_Load. Im using ...


       private void MainForm_Load(object sender, EventArgs e)
       {
           fm = new FMContext();

          var teamCombo =
               from club in fm.Clubs
               where club.Name != null
               orderby club.Name
               select club.Name;
           comboBox1.Items.AddRange(teamCombo.ToArray());


       }

Any idea where I might be going wrong?

Try adding a fm.LoadData() right after initiating the fmContext.

Link to post
Share on other sites

Hello and thank you for your beautiful framework.

I'm trying to make a simple mini scout that display the current player info.

But, after loading data in the context, the ActivePlayerObject is null (ActiveStaffObject and ActiveTeamObject null too).

This is my code to load the data:

currentDataContext = new FMContext();

currentDataContext.LoadData();

Any idea?

Thanks all (and sorry for my bad english).

Bye

Erm, I guess I forgot to add those offsets. I will try to find this this week, so keep posted :-)

Link to post
Share on other sites

Dear DrBernhard,

I can't enumerate through staff

So where was I wrong? Tks you.

Can you give me some clue in this bug, also two more bug (but I thought it's same bug):

foreach (Player player in keyCol)

{

player.CurrentPlayingAbility = 200;

player.PotentialPlayingAbility = 200;

foreach (PropertyInfo p in typeof(PlayerSkills).GetProperties())

{

if (p.ToString().IndexOf("SByte") != -1)

{

p.SetValue(player.Skills, (SByte)100, null);

}

}

}

This worked in the FM2009, but didn't work in this version. Also, in FM2009 framework, when I added players object to PropertiesGrid, I could easily change their attributes in this PropertiesGrid and it changed immediately in game, but this version it didn't work neither. I think this two bugs are the same. So Hope to hear from you soon,

Tks you for your wonderful framework.

(Sorry, I'm only the amateur coder, so I don't know the way to debug them).

Link to post
Share on other sites

Guest rusolvan

Is there any function in the framework that you can use to check if a player is a regen or not? Like a bool IsRegen() that you can use on a Player object; bool regen = player.IsRegen();

Link to post
Share on other sites

Hi,

Sorry to bug you, but can we use this for the steam version now ?

Thanks,

Teja.

Edit: Also, I'd like to make something which is more of a scouting tool as opposed to an editing tool. Is there a different way to do this? Like how genie does it?

Link to post
Share on other sites

Does this come with a useable Scout or is just the bare-bones which needs mushing together.

Nope, just some demo code, but nothing fancy.

Hi,

Sorry to bug you, but can we use this for the steam version now ?

Thanks,

Teja.

Edit: Also, I'd like to make something which is more of a scouting tool as opposed to an editing tool. Is there a different way to do this? Like how genie does it?

At this point, not compatible with steam, but I have the offsets right here, so support will be added over the weekend or something. If someone has some time off: the version offset should be 0x2D188. Will take some time testing, and I don't have a Steam version.

For your second question. Yes you can. Do a 'using Young3.FMSearch.Utils;' on top of your file. Then initialize using

 fm = new FMContext(DatabaseModeEnum.Cached);

You can then do faster queries, and use ratings through

player.Ratings().BestRating()

Is there any function in the framework that you can use to check if a player is a regen or not? Like a bool IsRegen() that you can use on a Player object; bool regen = player.IsRegen();

Of course this is possible, yet I've got no clue where to find something like that; takes some time. Please report this as a feature request at http://code.google.com/p/scoutframeworkfm2009/issues/list.

Can you give me some clue in this bug, also two more bug (but I thought it's same bug):

This worked in the FM2009, but didn't work in this version. Also, in FM2009 framework, when I added players object to PropertiesGrid, I could easily change their attributes in this PropertiesGrid and it changed immediately in game, but this version it didn't work neither. I think this two bugs are the same. So Hope to hear from you soon,

Tks you for your wonderful framework.

(Sorry, I'm only the amateur coder, so I don't know the way to debug them).

Got no clue at this point, but will have a look this weekend. Looks like a bug to me :-) Can you report bugs at the following link, then anyone who works at the framework can resolve this issue: http://code.google.com/p/scoutframeworkfm2009/issues/list

Link to post
Share on other sites

Got no clue at this point, but will have a look this weekend. Looks like a bug to me :-) Can you report bugs at the following link, then anyone who works at the framework can resolve this issue: http://code.google.com/p/scoutframeworkfm2009/issues/list

Fired two bugs there. Tks the team very much, I hope I could continuing my program at weekend after you find out :thup:

Link to post
Share on other sites

Im populating comboboxes with all clubs, nationalities and continents, however when I try to search using one of the selected results its giving an object reference not set error. I know its something wrong with my code but cant quite figure it out, I'm sure it worked when I checked it a couple of nights ago. Can anyone please help..

           if (continentCombo.Text != "Continent")
           {
               if (!string.IsNullOrEmpty(continentCombo.Text))
               {
                   filter = filter.Where(p => p.Nationality.Continent.Name == continentCombo.Text);
               }
           }

the error is "Object reference not set to an instance of an object"

Link to post
Share on other sites

Im populating comboboxes with all clubs, nationalities and continents, however when I try to search using one of the selected results its giving an object reference not set error. I know its something wrong with my code but cant quite figure it out, I'm sure it worked when I checked it a couple of nights ago. Can anyone please help..

           if (continentCombo.Text != "Continent")
           {
               if (!string.IsNullOrEmpty(continentCombo.Text))
               {
                   filter = filter.Where(p => p.Nationality.Continent.Name == continentCombo.Text);
               }
           }

the error is "Object reference not set to an instance of an object"

Try doing: p.Nationality != null && p.Nationality.Continent.Name == continentCombo.Text

Sometimes players are corrupted or something and don't have nationality

Link to post
Share on other sites

Hi !

I am a FM player for years (since CM 97/98) but I left the PC world since last summer to buy a MAC.

I wonder if a similar Framework can be developed for MAC OS X ?

I don't know which functions of the Microsoft.Scripting.Core DLL are used in the Framework but I guess there should be something similar for MAC.

TIA

Jojo

Link to post
Share on other sites

I can't seem to select any club or indeed any object whatsoever. fmContext.IsLoaded is true, yet all the clubs are null. I've tried DVD Patched and Unpatched.

Does anyone have any clues??

Also, the sample code no longer seems to work.

Thanks

Rob

Rob are you sure you have loaded a game in FM? Anyway, if you provide more info on that we'll be able to help better, cause it works for us. Try redownloading the framework from google project's svn.

Hi !

I am a FM player for years (since CM 97/98) but I left the PC world since last summer to buy a MAC.

I wonder if a similar Framework can be developed for MAC OS X ?

I don't know which functions of the Microsoft.Scripting.Core DLL are used in the Framework but I guess there should be something similar for MAC.

TIA

Jojo

I'm not good on Cocoa programming but after a small research I did there is no way to attach to a running process in MacOS and read its memory. If you think you can help with that and develop a mac framework we'll be more than happy to join you to the project!

Link to post
Share on other sites

Rob are you sure you have loaded a game in FM? Anyway, if you provide more info on that we'll be able to help better, cause it works for us. Try redownloading the framework from google project's svn.

I'm not good on Cocoa programming but after a small research I did there is no way to attach to a running process in MacOS and read its memory. If you think you can help with that and develop a mac framework we'll be more than happy to join you to the project!

Yep, a game was loaded, in some cases, it fmContext.IsLoaded was true, but still the in the list of clubs (6000+) every club was null. I'll try and re-download the framework tonight to see if it works any better.

Cheers

Link to post
Share on other sites

Sorry, got off the radar a couple of days, haven't fixed any bugs yet :-)

Anyhow, my FM Patched DVD game works still like a charm. Can anyone with the Steam version can have a look at the code and try to implement the Steam Patched version with the offset I posted above. You should get it working in little time, but I cannot test it as I don't have a Steam edition on my hands.

@demonpreacher, can you post the data you have in the FMProcess, like version etc.? You might need the framework source, as the class is internal.

BTW: Steam offset should be 0x2D188

Link to post
Share on other sites

here is what is in the ProcessManager.cs file.

if (FmVersion == "10.0.0f80381") return 0x140D8; //DVD version 10.0 without patch

if (FmVersion == "10.1.0f84702") return 0x2E1A8; //DVD version 10.1 patched

else return 0x0;

I am on DVD version 10.1.

I've re-checked the code out and still get the same issue.

Link to post
Share on other sites

here is what is in the ProcessManager.cs file.

if (FmVersion == "10.0.0f80381") return 0x140D8; //DVD version 10.0 without patch

if (FmVersion == "10.1.0f84702") return 0x2E1A8; //DVD version 10.1 patched

else return 0x0;

I am on DVD version 10.1.

I've re-checked the code out and still get the same issue.

@demonpreacher Please place a brakepoint in visual studio after you call the LoadData() function and hover your mouse over your FMContext object anywhare in your code. You should be able to browse the loaded variables, go to the "CurrentVersion" variable and write the full version number here so we can check what is wrong, since you are not the only one with this issue.

Link to post
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...