Official Everybody Edits Forums

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.

#1 2015-03-07 20:10:53, last edited by Vitalijus (2015-03-08 08:22:52)

Vitalijus
Member
From: Lithuania
Joined: 2015-02-15
Posts: 1,384
Website

Dumb question

I know it's really dumb question, but how can I stop closing application after "ENTER" key button?
Close the topic.


wn7I7Oa.png

Offline

#2 2015-03-07 20:18:10

Zumza
Member
From: root
Joined: 2015-02-17
Posts: 4,656

Re: Dumb question

what application?


Everybody edits, but some edit more than others

Offline

#3 2015-03-07 20:19:26

Vitalijus
Member
From: Lithuania
Joined: 2015-02-15
Posts: 1,384
Website

Re: Dumb question

Console Application.


wn7I7Oa.png

Offline

#4 2015-03-07 20:21:59

Zumza
Member
From: root
Joined: 2015-02-17
Posts: 4,656

Re: Dumb question

You could put your main function in a loop.


Everybody edits, but some edit more than others

Offline

#5 2015-03-07 20:24:40

Vitalijus
Member
From: Lithuania
Joined: 2015-02-15
Posts: 1,384
Website

Re: Dumb question

Zumza wrote:

You could put your main function in a loop.

I'm pretty new at this stuff so could you just put me the code? I can learn only by this way.


wn7I7Oa.png

Offline

#6 2015-03-07 20:40:12, last edited by Zumza (2015-03-07 20:41:40)

Zumza
Member
From: root
Joined: 2015-02-17
Posts: 4,656

Re: Dumb question

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? //forums.everybodyedits.com/img/smilies/big_smile


Everybody edits, but some edit more than others

Offline

Wooted by: (2)

#7 2015-03-07 22:06:49, last edited by ZeldaXD (2015-03-07 22:07:25)

ZeldaXD
EE Homeboy
From: Cyprus
Joined: 2015-02-15
Posts: 1,539
Website

Re: Dumb question

        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.


gLjTZE1.png

Offline

#8 2015-03-07 22:08:56

Vitalijus
Member
From: Lithuania
Joined: 2015-02-15
Posts: 1,384
Website

Re: Dumb question

ZeldaXD wrote:
        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.


wn7I7Oa.png

Offline

#9 2015-03-07 22:14:38

ZeldaXD
EE Homeboy
From: Cyprus
Joined: 2015-02-15
Posts: 1,539
Website

Re: Dumb question

Vitalijus wrote:
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;
                }
            }
         }

gLjTZE1.png

Offline

#10 2015-03-07 23:59:59

Koya
Fabulous Member
From: The island with those Brits
Joined: 2015-02-18
Posts: 6,310

Re: Dumb question

Vitalijus wrote:

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.


Po9cnQh.png

PLNQVL8.png
Thank you eleizibeth ^

1SYOldu.png

I stack my signatures rather than delete them so I don't lose them
giphy.gif

WfSi4mm.png

Offline

#11 2015-03-08 01:35:49, last edited by Twipply (2015-03-08 01:38:22)

Twipply
Member
Joined: 2015-02-28
Posts: 32

Re: Dumb question

If you want help with your programming, you should probably show us the relevant part of your code.

Zumza wrote:

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? //forums.everybodyedits.com/img/smilies/big_smile

No. Doing this will pin one of your CPU cores at 100% while the program is running.


- Twipply

Offline

#12 2015-03-08 13:56:13

Zumza
Member
From: root
Joined: 2015-02-17
Posts: 4,656

Re: Dumb question

ZeldaXD wrote:
        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

#13 2015-03-08 14:03:03, last edited by Koya (2015-03-08 14:03:36)

Koya
Fabulous Member
From: The island with those Brits
Joined: 2015-02-18
Posts: 6,310

Re: Dumb question

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
      }
    }
  });
}

Po9cnQh.png

PLNQVL8.png
Thank you eleizibeth ^

1SYOldu.png

I stack my signatures rather than delete them so I don't lose them
giphy.gif

WfSi4mm.png

Offline

#14 2015-03-08 14:24:54

Twipply
Member
Joined: 2015-02-28
Posts: 32

Re: Dumb question

Koya wrote:

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

#15 2015-03-08 14:26:25

Vitalijus
Member
From: Lithuania
Joined: 2015-02-15
Posts: 1,384
Website

Re: Dumb question

I already got answer and I've typed "Close the topic." in the first message so please post theese craps in your PM's.


wn7I7Oa.png

Offline

#16 2015-03-08 14:51:41

goeyfun
Member
From: Mighty Japan
Joined: 2015-02-18
Posts: 667

Re: Dumb question

I have a feeling that the second generation of icebot is coming


Ug3JzgO.png

Offline

#17 2015-03-08 15:13:21

Vitalijus
Member
From: Lithuania
Joined: 2015-02-15
Posts: 1,384
Website

Re: Dumb question

goeyfun wrote:

I have a feeling that the second generation of icebot is coming

Read comments before posting.


wn7I7Oa.png

Offline

#18 2015-03-08 16:06:20

Processor
Member
Joined: 2015-02-15
Posts: 2,246

Re: Dumb question

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

#19 2015-03-08 18:56:34

Vitalijus
Member
From: Lithuania
Joined: 2015-02-15
Posts: 1,384
Website

Re: Dumb question

Processor wrote:

Wtf, just put

Thread.Sleep(Timeout.Infinite);

No, it would freeze everything becouse thread would be sleeping for infinite time.


wn7I7Oa.png

Offline

#20 2015-03-08 20:19:25, last edited by Twipply (2015-03-08 20:20:01)

Twipply
Member
Joined: 2015-02-28
Posts: 32

Re: Dumb question

Vitalijus wrote:

No, it would freeze everything becouse thread would be sleeping for infinite time.

Vitalijus wrote:

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

#21 2015-03-08 21:51:50

Vitalijus
Member
From: Lithuania
Joined: 2015-02-15
Posts: 1,384
Website

Re: Dumb question

I've already said that this is solved you freeposters.


wn7I7Oa.png

Offline

#22 2015-03-09 19:43:02

capasha
Member
Joined: 2015-02-21
Posts: 4,066

Re: Dumb question

Vitalijus wrote:

I've already said that this is solved you freeposters.

Where? I can't find it.

Offline

#23 2015-03-09 19:49:33

Vitalijus
Member
From: Lithuania
Joined: 2015-02-15
Posts: 1,384
Website

Re: Dumb question

capasha wrote:
Vitalijus wrote:

I've already said that this is solved you freeposters.

Where? I can't find it.

Vitalijus wrote:

I already got answer and I've typed "Close the topic." in the first message so please post theese craps in your PM's.


wn7I7Oa.png

Offline

Vitalijus1425926973480812

Board footer

Powered by FluxBB

[ Started around 1732822640.7791 - Generated in 0.090 seconds, 12 queries executed - Memory usage: 1.74 MiB (Peak: 1.98 MiB) ]