Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?
You are not logged in.
Pages: 1
what application?
Everybody edits, but some edit more than others
Offline
You could put your main function in a loop.
Everybody edits, but some edit more than others
Offline
Well I'm assuming you have now something like:
static void Main(string[] args){
<code>
}
And it does your <code> and you press enter and exit.
static void Main(string[] args){
do{
<code>
Console.WriteLine();
}while(true);
}
This will make your program repeat until you press the close button from window
Or if you just don't want it to close on enter:
static void Main(string[] args){
<code>
do{
}while(true);
}
Do I receive a woot?
Everybody edits, but some edit more than others
Offline
static void Main(string[] args) {
c = PlayerIO.QuickConnect.SimpleConnect("everybody-edits-su9rn58o40itdbnw69plyw", "email", "password");
con = c.Multiplayer.CreateJoinRoom(Console.ReadLine(), "Everybodyedits" + c.BigDB.Load("config", "config")["version"], true, new Dictionary<string, string>(), new Dictionary<string, string>());
con.Send("init");
con.OnMessage += new MessageReceivedEventHandler(con_OnMessage);
while (true) {
Console.ReadLine();
}
}
"do" not needed, simply do that.
Offline
static void Main(string[] args) { c = PlayerIO.QuickConnect.SimpleConnect("everybody-edits-su9rn58o40itdbnw69plyw", "email", "password"); con = c.Multiplayer.CreateJoinRoom(Console.ReadLine(), "Everybodyedits" + c.BigDB.Load("config", "config")["version"], true, new Dictionary<string, string>(), new Dictionary<string, string>()); con.Send("init"); con.OnMessage += new MessageReceivedEventHandler(con_OnMessage); while (true) { Console.ReadLine(); } }
"do" not needed, simply do that.
I know how to make bots. I already made a lot of them. Im making console game now.
Offline
ZeldaXD wrote:some code
"do" not needed, simply do that.
I know how to make bots. I already made a lot of them. Im making console game now.
In case you are doing a game that works by orders, I suggest you doing this:
static void Main(string[] args)
{
Console.ReadLine(" Hello, welcome to dis game");
while (true)
{
string[] arg = Console.ReadLine().ToLower().Split(' ');
switch (arg[0]) {
case "hi":
Console.WriteLine("hai :)");
break;
}
}
}
Offline
I know how to make bots. I already made a lot of them. Im making console game now.
Make a psudo-console game as you have more control over individual placement of characters and colour, think of Dwarf Fortress - it's impossible to make that in an actual console, they've just made the game look like it's in a console. You know C#, make a psudo-console game with XNA - at least then if it's decent it can be published properly.
Thank you eleizibeth ^
I stack my signatures rather than delete them so I don't lose them
Offline
If you want help with your programming, you should probably show us the relevant part of your code.
Or if you just don't want it to close on enter:
static void Main(string[] args){ <code> do{ }while(true); }
Do I receive a woot?
No. Doing this will pin one of your CPU cores at 100% while the program is running.
- Twipply
Offline
static void Main(string[] args) { c = PlayerIO.QuickConnect.SimpleConnect("everybody-edits-su9rn58o40itdbnw69plyw", "email", "password"); con = c.Multiplayer.CreateJoinRoom(Console.ReadLine(), "Everybodyedits" + c.BigDB.Load("config", "config")["version"], true, new Dictionary<string, string>(), new Dictionary<string, string>()); con.Send("init"); con.OnMessage += new MessageReceivedEventHandler(con_OnMessage); while (true) { Console.ReadLine(); } }
"do" not needed, simply do that.
By replacing my "do while" with "while" will make the program run +1 verification of true is true
Everybody edits, but some edit more than others
Offline
Depending on your personal preference, I have 2 solutions
static void Main(string[] args) {
new Thread(new ThreadStart(CLI)).Start();
}
static void CLI()
{
while(true)
{
switch(Console.Readline())
{
case "exit":
Environment.Exit(0);//Shuts down all threads
break;
//Add other commands here
}
}
}
or
static void Main(string[] args) {
CLI();
}
static void CLI()
{
ThreadPool.QueueUserWorkItem(delegate {
while(true)
{
switch(Console.Readline())
{
case "exit":
Environment.Exit(0);
break;
//Add other commands here
}
}
});
}
Thank you eleizibeth ^
I stack my signatures rather than delete them so I don't lose them
Offline
Depending on your personal preference, I have 2 solutions
...
Seems a little excessive to spawn a new thread just for a while loop that could happily exist within main, no?
Really, I don't know why OP hasn't just posted code yet.
- Twipply
Offline
Offline
Wtf, just put
Thread.Sleep(Timeout.Infinite);
I have never thought of programming for reputation and honor. What I have in my heart must come out. That is the reason why I code.
Offline
No, it would freeze everything becouse thread would be sleeping for infinite time.
how can I stop closing application after "ENTER" key button?
Do you see how these are the same thing now I've pointed it out? Once again, if you want programming help, you should post your god damn code.
- Twipply
Offline
I've already said that this is solved you freeposters.
Where? I can't find it.
Offline
Vitalijus wrote:I've already said that this is solved you freeposters.
Where? I can't find it.
I already got answer and I've typed "Close the topic." in the first message so please post theese craps in your PM's.
Offline
Pages: 1
[ Started around 1732822640.7791 - Generated in 0.090 seconds, 12 queries executed - Memory usage: 1.74 MiB (Peak: 1.98 MiB) ]