Utharnl will it be difficult to make some NPC attacking options ?
That's indeed how it works. Not sure if you made a typo but you have to change your settings to:Quote:
in bot directory find settings.txt
one line of text shows following:
It seems the first listing for English (en.grepolis.com) has to be the main login server,Code:user;pass;1;en.grepolis.com;en.grepolis.com;en3.grepolis.com;True;debug.txt;settings.txt
then you add a number for the world you wish to load (gamma = en3, alpha = en1, the testing server is zz1 but not tested this with it).
user;pass;1;en.grepolis.com;en3.grepolis.com;True;debug.txt;settings.txt
It may be wine slow server?Quote:
ThaRealiestJEDI;*******;1;pl.grepolis.com;pl1.grep olis.com;True;debug.txt;settings.txt
Hey Nate the variable m_TimerLoginDelay is used for something else. It's the timer used to reconnect to the server when you are disconnected. It's still code i'm working on, it doesn't yet always work.Quote:
@Utharnl
Can you change the Time Code from
private int m_TimerLoginDelay = 60000;//ms
to:
private int m_TimerLoginDelay = 720000;//ms
This should allow the users to have a timer up to 5hours instead of 1.
(settings.cs)
/*
* Constructor
*/
public Settings()
{
InitializeComponent();
setLoadedSettings();
this.numericUpDownTimer.Maximum = 300;//Minutes
}
Quote:
Hey Nate the variable m_TimerLoginDelay is used for something else. It's the timer used to reconnect to the server when you are disconnected. It's still code i'm working on, it doesn't yet always work.
I know what you mean though, I will change it in the next version.
Here's a temporarily solution you can use:
Will add the production rate also in the next version.Code:(settings.cs) /* * Constructor */ public Settings() { InitializeComponent(); setLoadedSettings(); this.numericUpDownTimer.Maximum = 300;//Minutes }
~Uthar
(town.cs)
class Town
{
private String m_TownID = "";
private Queue<String[]> m_BuildingQueue = new Queue<String[]>();
private List<Building> m_Buildings = new List<Building>();
private String[] m_IngameBuildingQueue = new String[] { "", "", "", "", "", "", "" };//Not realy dynamic... but it works
private String m_Wood = "0";
private String m_Stone = "0";
private String m_Iron = "0";
private String m_Storage = "0";
(settings.cs)
public partial class Settings : Form
{
private String m_UserName = "";
private String m_Password = "";
private String m_Timer = "1";
private String m_MainServer = "";
private String m_Server = "";
private String m_DebugFile = "debug.txt";
private String m_SettingsFile = "settings.txt";
private String m_TranslationFile = "translation.txt";
private String m_QueueFile = "queue.txt";
****************************
public String QueueFile
{
get { return m_QueueFile; }
set { m_QueueFile = value; }
}
****************************
//Methods
private void updateSettings()
{
m_UserName = textBoxUserName.Text;
m_Password = textBoxPassword.Text;
m_Timer = numericUpDownTimer.Value.ToString();
m_MainServer = textBoxMainServer.Text;
m_Server = textBoxServer.Text;
m_DebugOn = checkBoxDebugMode.Checked;
m_DebugFile = textBoxDebugFile.Text;
m_SettingsFile = textBoxSettingsFile.Text;
m_QueueFile = textBoxQueueFile.Text;
}
public void setLoadedSettings()
{
textBoxUserName.Text = m_UserName;
textBoxPassword.Text = m_Password;
numericUpDownTimer.Value = decimal.Parse(m_Timer);
textBoxMainServer.Text = m_MainServer;
textBoxServer.Text = m_Server;
checkBoxDebugMode.Checked = m_DebugOn;
textBoxDebugFile.Text = m_DebugFile;
textBoxSettingsFile.Text = m_SettingsFile;
textBoxQueueFile.Text = m_QueueFile;
}
/*
* Log out from the game server
*/
private void logOut()
{
try
{
m_State = "logout";
loadSettingsRequest();
setStatusBar("Logging Out");
String l_Url = "http://" + m_Settings.MainServer + "/start?action=logout";
}
catch (Exception e)
{
debug(e.Message);
}
}
Could you check your settings.txt?Quote:
Hey. I need help in pt server.
i just cant login..any ideas?
String l_Url = "http://" + m_Settings.MainServer + "/start?action=logout"; Uri l_Uri = new Uri(l_Url); m_HtmlHandler.DownloadStringAsync(l_Uri);
The reason for the logout script is to make it where I can login with the browser, make any actions I want to and not have to restart the bot. This is just to make a quick fix for the queue until we can make a queue txt file to save the queue.Quote:
Could you check your settings.txt?
Your server settings should look like pt.grepolis.com;pt1.grepolis.com
Or maybe there's a small typo in your username or password?
The last time I checked the pt server is just a few days ago. There weren't any problems then with the login.
@srialmaster
Nice to hear that you want to learn some C#
But it's a bit difficult to let someone else add things. If you add something new there's a big chance you have to update some old code as well.
But the logout code is almost correct.
We need also a new state for this. m_State = "logout" for example.Code:String l_Url = "http://" + m_Settings.MainServer + "/start?action=logout"; Uri l_Uri = new Uri(l_Url); m_HtmlHandler.DownloadStringAsync(l_Uri);
You can handle this state in the method: client_DownloadStringCompleted
I'm not really sure yet if we need this function though. Because if you exit the bot and login with your browser the session you had with the bot is gone.
To save the building queue is some more work. The settings you added for queue text file looks correct.
To save/load this text file you need to know the townid and the building names for in the queue (the dev name (first line in translation.txt) not the local).
Form1.cs is the main class and knows every object so you have to create a new method there.
Remember you can only load the queue when you are logged in and townid is known.
There are probably some more things that you need to check but it's already too late to think of them.
I think I will work alone on this bot for the time being. But you can always come with ideas or questions about the code.
~Uthar
Prioritize:Quote:
The login method triggers a sequence of methods.
-Looking for town
-Getting building data
-Creating new Town object with this data
So if you call login again after you logged out it will overwrite all the current town data, also your building queue.
I think we can better skip the logout function and only make a relogin function. (If you login on your browser it will logout the bot). The new relogin function must then only connect to the server and don't update the town info.
At the moment I'm first updating a few things on my Empire Craft bot and after that I'm going to work on this one.
Todo list is getting bigger and bigger for grepolis, have this planned so far:
-Show resource production
-Minimize to tray icon
-Attack farmers
-Reconnect to server
-Bigger timer