[Release] Grepolis 2 bot

05/11/2011 21:28 jmspaggi#196
There is also VirtualBox under Linux. There might be a version for Mac too. And it's free! That's what I'm using to make the bot working ;)
05/11/2011 22:41 pronkjuweel#197
I have an idea for your bot.

- The bot will automatically turn on on the startup of your computer (you never have to click it manually)
05/11/2011 23:17 Utharnl#198
@jmspaggi
Nice tip, should also be useful for other linux users.

@pronkjuweel
You can also create a shortcut of the bot and place it in your startup folder. Windows will start it then automatic. But you'll still need to press the "login" button.
I could however add an option to login automatic when the bot starts, then everything is automatic :)

~Uthar
05/12/2011 02:35 jmspaggi#199
+1 for the autologin option at startup.

Also, will be nice to have the Login name in the title bar...

JM
05/12/2011 05:54 Unghiutza#200
Uthar, what's up with that "Daily limit reached: true" thingy? Now my bot doesn't want to farm anymore :( after it shows that :-<
05/12/2011 06:43 Utharnl#201
You can only loot 12500 resources (can be more/less depending on server speed) daily from farmers.
The bot is currently resetting the limit each day at 00:02 but that doesn't seem the right time. Tried last night to reset it at 00:15 but that wasn't either the correct time.
If someone has more info please let me know.

~Uthar
05/12/2011 09:39 Jarisk#202
Small improvement for building queue
If population is below small amount (for example 10), bot should build farm, no matter what is next in queue.
Below small example
in checkBuildingQueue() just before line: if (!l_Building.Equals("")):
Quote:
if ((m_Player.Towns[m_CurrentTownIntern].Population < 10) &&
!m_Player.Towns[m_CurrentTownIntern].getIngameBuildingQueue().Contains("farm"))
{
int j;
for ( j = 0; j < m_Player.Towns[m_CurrentTownIntern].Buildings.Count; j++)
if (m_Player.Towns[m_CurrentTownIntern].Buildings[j].DevName=="farm") break;
if (m_Player.Towns[m_CurrentTownIntern].Buildings[j].Upgradable)
{
l_Building = m_Player.Towns[m_CurrentTownIntern].Buildings[j].DevName;
}
else
{
if (m_Player.Towns[m_CurrentTownIntern].Buildings[j].Level < m_Player.Towns[m_CurrentTownIntern].Buildings[j].MaxLevel)
l_Building = "";
}
}
05/12/2011 12:46 jmspaggi#203
+1 for the farm automatic creation!!!! I'm always blocked because of that :(

Other possible options:
- Ability to order the cities in the display;
- Ability to schedule the "friendly request only" for the farmers. Like, I want friendly between 4h and 6h so when I wake up, they are above 80% and I can do some commerce.

From the exemple above, if you have the population below 10, and you have 10 buildings in the queue, then the farm. Will the bot not be stuck?

JM
05/12/2011 13:07 Jarisk#204
It mean: if population is less than 10 and there is no farm in game building queue (to prevent more then one farm in queue)
[edit]
We must also check max level for farm before ignore bot queue:
if (m_Player.Towns[m_CurrentTownIntern].Buildings[j].Level < m_Player.Towns[m_CurrentTownIntern].Buildings[j].MaxLevel) l_Building = "";
05/12/2011 13:14 jmspaggi#205
Ok, I see! I mixed-up the building queue and the bot queue... So I understand. Thanks for the clarification.

Another request:
- When we select 100 troops in the target, display is 00. Which is a bit disturbing. Might be better to have 100? Or change the color? Or reduce the font size?

JM
05/12/2011 14:50 Utharnl#206
@Jarisk
Was already added in the feature request post but thanks for the code will probably add it in the next release.

@jmspaggi
Added the scheduler to the feature request post.
What do you mean with this one:
Quote:
Ability to order the cities in the display;
I will make the font a bit smaller in the next release but I think it also depends on your pc settings because mine are displayed correct up to 999.

~Uthar
05/12/2011 15:54 Jarisk#207
sometimes it's good to randomize choose building in automatic queue mode.
In checkBuildingQueue():
Quote:
//Automatic mode activad
int l_LowestLevel = 41;
int l_Level = 0;
string l_BuildingTemp = "";
// place for upgradable buildings
StringCollection UpgradableBuildings = new StringCollection();

for (int i = 0; i < m_Player.Towns[m_CurrentTownIntern].Buildings.Count; i++)
{
l_BuildingTemp = m_Player.Towns[m_CurrentTownIntern].Buildings[i].DevName;
l_Level = m_Player.Towns[m_CurrentTownIntern].Buildings[i].Level + m_Player.Towns[m_CurrentTownIntern].countIngameBuildingQueueByName(l_BuildingTemp);
if (m_Player.Towns[m_CurrentTownIntern].Buildings[i].Upgradable)
{
if (l_Level < m_Player.Towns[m_CurrentTownIntern].Buildings[i].TargetLevel)
{
if(l_Level < l_LowestLevel)
{
l_Building = l_BuildingTemp;
l_LowestLevel = l_Level;
// store upgradable building
UpgradableBuildings.Add(l_Building);

}
}
}
}
// randomize available buildings
Random l_rnd = new Random();
if (UpgradableBuildings.Count>1)
l_Building = UpgradableBuildings[l_rnd.Next(0,UpgradableBuildings.Count)];
l_rnd = null;
UpgradableBuildings = null;
05/12/2011 16:01 jmspaggi#208
Quote:
Originally Posted by Utharnl View Post
Added the scheduler to the feature request post.
Thanks ;)

Quote:
Originally Posted by Utharnl View Post
What do you mean with this one: Ability to order the cities in the display;
My cities are called "City 1", "City 2", "City 3", and so on up to "City 40".

In the display, they are not ordered by number. I have "City 4" on the top, "City 1" in the middle, etc. And I'm a bit mixed up.

I would like to be able to order them using drag and drop. So I can put my defense cities on the top, and my attack cities on the bottom. Or would like to have the ability to order them by name at least?

Quote:
Originally Posted by Utharnl View Post
I will make the font a bit smaller in the next release but I think it also depends on your pc settings because mine are displayed correct up to 999.
Ok. So I will try to play with my settings.

Last thing, I see some are posting some part of you code. If you tell me how I can get the code and the required tools to compile, I will be VERY hapy to help. Seems to be close to Java language, so I might be able to learn pretty quickly...

JM
05/12/2011 16:11 Utharnl#209
@Jarisk
Thanks for all the ideas :) But do you have any specific point why to randomize them?

@jmspaggi
Shouldn't be a problem to sort them. But drag and drop is going to be a problem I think, I'll look in to it later. First I want to complete some more features :)
You can find the source code at my blog (see signature) in the download section. The only tool you need is Visual Studio 2010.

~Uthar
05/12/2011 16:24 maxsssss#210
has ny1 experianced a hanging bot?i run the new .4 version and some times i check up on the bot and i find that the farms havnt been harvested. then i see that the count down timer has frozen, when i click stop and start again it will start again and will run for a few hours but finally the same thing happends again