Author Topic: Slow console  (Read 5740 times)

Offline cnotsch

  • Posts: 85
  • Cookies: 3
Re: Slow console
« Reply #20 on: June 24, 2008, 02:49:25 PM »
nice idea there.

Quote
ut the game is already paused when you open the console, right? So any slowdown shouldn't really matter.

that is true but what if you have to wait 15 minutes? (wich can in extreme situations be caused by playing 3 min.

Quote
Adding GUI to the console isn't a good idea

i didn't mean exactly into the console i know this would be extremly difficult, but somewhere into the main menu.

but after all i really look forward to get my hands on it  :)

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Slow console
« Reply #21 on: June 24, 2008, 04:03:09 PM »
15 minutes? That's way too much, and I never even managed that unless I accidently logged a (near) endless loop. ;)

What are you doing anyway?

To actually do this might be rather tricky.
I'll see what I can do, but you will have to navigate UMM to reach this setting, I was hoping to evade creating a gui, since it means I will then also have to provide an "off" setting for it. :(
It isn't the GUI work, that's not hard, it's all the other things I would then have to consider.
The off setting means that people mostlikely will turn it off, which in effect means that when they have an error, they won't even bother looking for a log. :(
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline cnotsch

  • Posts: 85
  • Cookies: 3
Re: Slow console
« Reply #22 on: June 24, 2008, 05:57:35 PM »
then release a stock version for 'those people who turn it off and forget it'
and a new version for the porfis... maybe

not that important... i think about scripting a new console GUI maybe you could tell me where to plug in a command for passing the output... i do have a good idea but i may need some time to complete my actual work first.

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Slow console
« Reply #23 on: June 24, 2008, 06:07:41 PM »
Like I said in a previous post, a new Console GUI won't work, I've tried that already. ;)

You need the exec keyword/function for this.
But doing so in an event handler other than the console will possibly result in an exception.
For example, sys.exit most certainly won't work.

And you can't enter new commands into the console, unless you do it the slow and totally unadvised way via keypress emulation on the console (which is what the console tracker, not mine, does, it emulates a keypress).

As for a hook, you can get a MainWindow for the console through:
App.TopWindow_GetTopWindow().FindMainWindow(App.MWT_CONSOLE).
You can replace (or rather, hide) the original GUI and then you don't need to worry about the ` key, since it just appears then.
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline cnotsch

  • Posts: 85
  • Cookies: 3
Re: Slow console
« Reply #24 on: June 24, 2008, 06:16:57 PM »
my idea was to create a complete new console from scratch

but if calling the exec statement by a button would result in a error (i really hope not but i won't wonder if not because that would be one of the useful python basics and we all know most of them dont work in BC  :lol: :( :? :x)

otherwise i see no problem.

EDIT: Oh i forgot that with the input i'd realize with a paragraph (is it called like that?) i already used this in my new ATM quite sccesfully

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Slow console
« Reply #25 on: June 24, 2008, 06:31:53 PM »
Yeah, but if you evaluate exec("import sys;sys.exit()") (or even just sys.exit()) then it will result in an error which you (nor me) can not handle properly, and only the Console itself can do that. It does work for most stuff, but not for one of the most usefull utilities in BC (sys.exit()).


exec is actually a keyword in Python, meaning, so much baked in, it would be rather painfull to remove it, unlike things like regex and xml, which are "just" standard extension modules in Python, which were removed. And it's usefull.


The reason why the Console can handle it, is because it captures all the exceptions Python generates (otherwise it would leave the console in an unusable state). One of them is the one sys.exit generates (SystemExit to be exact), now, if you want to really exit Python through that (and you must), and you do your own console, you would just not capture the exception (or rethrow it), but because you are working in an event handler, in BC, you will either ignore it (don't exit BC), or you will allow the Debug Window to pop up with no errors shown (other than the one you print).
But because we are in the console, a C++ side object, it can notice the exception and handle it by calling it's own, internal, exit procedure, which results in the neat exit of BC.
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline cnotsch

  • Posts: 85
  • Cookies: 3
Re: Slow console
« Reply #26 on: June 24, 2008, 06:41:50 PM »
if it is just that one statement i think that would NO problem!
firstly i have NEVER used it so far, secondly you could filter it out of the text and call it manually in a script.
Besides this should be no replacement it should rather be a second console, main idea was to include a open/save file/module possibility meaning to create a console as near as possible to a stock python interpreter

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Slow console
« Reply #27 on: June 24, 2008, 06:53:38 PM »
if it is just that one statement i think that would NO problem!
firstly i have NEVER used it so far, secondly you could filter it out of the text and call it manually in a script.
I use it all the time, I recommend it to people all the time in case of BSOD, especially the last one (also for myself, I do quite a lot of things these days that happen on startup of BC). Pretty needed wouldn't you say? Also, console utilities such as dumpConsole, screenshot and, wait for it, exit(), the last one, of course, uses sys.exit().

Calling it manually from a script has the same effect, it's the same thing that's calling it, an event handler.


Quote
Besides this should be no replacement it should rather be a second console, main idea was to include a open/save file/module possibility meaning to create a console as near as possible to a stock python interpreter
Which exec is. In fact, if you pass in the __dict__ of the __main__ module, it is the "stock python interpretter".

With open/save file/module possiblity, you mean save and load games? That's already possible, it's called Quick Save/Load Game.
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline cnotsch

  • Posts: 85
  • Cookies: 3
Re: Slow console
« Reply #28 on: June 24, 2008, 07:03:36 PM »
Quote
Pretty needed wouldn't you say?

nope not at all i don't know why it is people saying BC can't be exited with the windows command ALT+F4??? it has worked on every BSOD - and i had hundreds - eyery crash and simply every error (fullscreen & windowed)...

Quote
With open/save file/module possiblity, you mean save and load games?

not at all i mean you can load/read/write/save multiline scripts/modules ingame like in editor!
EDIT: of course the save/load would only work in scripts/Custom/...

besides would not the console handle the exception (i thaught those were global) if it still exists? i have no intention in touching the console i just want to get the text you write ito the log to be printed into my new window

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Slow console
« Reply #29 on: June 24, 2008, 07:21:00 PM »
As soon as you do exec in anything other than the console, and it produces a SystemExit exception, you are basicly dead in the water with either no exit of BC, or a debug window.
The reason why the console doesn't do that, is because you aren't in the console.

You basicly have 2 things, either the console, dynamic input, or modules, where there could also be dynamic input, but those are still modules, in fact, the console is also a module (__main__), but it still is a special case since most of that is done by the exe, including handling the SystemExit exception.



Alt+F4 never worked for me in BC. It does work on the debug console though.



I also don't think that a paragraph is the most usefull editor you can have for files, no scrolling (not easily anyway, well, it's possible I suppose, but I'm unsure of the effect) for one.
I'd rather edit them in notepad. :P
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline cnotsch

  • Posts: 85
  • Cookies: 3
Re: Slow console
« Reply #30 on: June 25, 2008, 01:17:35 AM »
Quote
I'd rather edit them in notepad.

i disagree on that i think it is very helpful to be able to check your script instantly without restarting BC all the time, this totally sucks :lol:, i now get around that with making sure my module completely resets on calling its exit() so i can reload(module) and init() it again. but that is also a bit of... work all the time and I'm a LAZY person  :lol:

maybe I find a solution there but for that I need free time where I do not have a big bunch of work planned for, like my ATM is now.

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Slow console
« Reply #31 on: June 25, 2008, 08:29:05 AM »
I do that all the time (when possible of course, some scripts of mine don't like being unloaded).

Just run in Windowed mode and alt+tab.

You will have to type reload anyway.
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline cnotsch

  • Posts: 85
  • Cookies: 3
Re: Slow console
« Reply #32 on: June 25, 2008, 02:34:40 PM »
why in windowed i don't get it the only difference i see is that silly console breaking the game on every little error, alt+tab, alt+f4, windows, (+d),... all that works in fullscreen too.... am i doing something totally right when intalling windows or why can it be that those features seem only to work on (all) my pcs....

anyway, yeah it is a nice to be able to reload but it would be helpful to be able to write a quick loop with an if and something else ingame without exiting it (or writing it into my libary and reload it)

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Slow console
« Reply #33 on: June 25, 2008, 02:40:46 PM »
Maybe I ought to make a screencapture of my work flow (or something like that).

Because I can do this:


Start BC
Alt tab
Edit a file
Back into BC
reload(......)
Watch what happens
Alt tab
edit a file
etc,
etc,
etc.
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline cnotsch

  • Posts: 85
  • Cookies: 3
Re: Slow console
« Reply #34 on: June 25, 2008, 02:45:20 PM »
like i said would be MUCH faste to simply edit and press a button ^^ like i said i am veeeeery lazy  :lol:

besides is there only one single time where you don't respond in at least 2 min.? how do you do that? sorry for getting of topic but i had to ask

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Slow console
« Reply #35 on: June 25, 2008, 02:50:15 PM »
like i said would be MUCH faste to simply edit and press a button ^^ like i said i am veeeeery lazy  :lol:
Yes, that might be faster, but not by so much, since a TGParagraph is less than what you get from notepad (in terms of ease of use). And things like syntax highlighting makes scripting (or any kind of programming) faster. To make matters worse, I'm even thinking of creating an Eclipse plugin for BC specificly, with (if possible) intellisense. ;)

Quote
besides is there only one single time where you don't respond in at least 2 min.? how do you do that? sorry for getting of topic but i had to ask
I do at times, like when I'm asleep, or at dinner, or at work (or school) or doing something else. But I can multitask as it were when I'm behind my computer.



Btw, the debug console is far more usefull than a plain BSOD, it's even possible to fix stuff while in the debug console, say, you forgot to include an import in a module (and a function didn't work because of it), you can fix that in the console, and then type resume!
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline cnotsch

  • Posts: 85
  • Cookies: 3
Re: Slow console
« Reply #36 on: June 25, 2008, 03:00:18 PM »
Quote
I'm even thinking of creating an Eclipse plugin for BC specificly, with (if possible) intellisense.

what is that?

Quote
Btw, the debug console is far more usefull than a plain BSOD

i never got a bsod without the possibility to check the console for errors

Quote
it's even possible to fix stuff while in the debug console

didn't know that how do you do that?

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Slow console
« Reply #37 on: June 25, 2008, 06:15:34 PM »
Eclipse is just one of the biggest, expandable, Integrated Development Environment (IDE) on the world. Maybe except Emacs, but it looks like Eclipse is going to be the next Emacs.


The reason it's more usefull, is because it practicly gives us a step by step debugger.

We can fix stuff by replacing the faulty method from another file (that is stateless, ie. no data, such as App.py, Foundation.py, for example, is statefull, since it stores data).

Then, as soon as you have replaced the method (an import/reload and assignment away) then you can type in resume and it will continue till the next error.
Or you replace a variable (or set a variable) where you forgot to initially.

I even deem it possible that one day we find the magic trigger so that we always have the debug console at our fingertips, meaning, true, live, changing, instead of the current paused games. ;)
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline cnotsch

  • Posts: 85
  • Cookies: 3
Re: Slow console
« Reply #38 on: June 26, 2008, 04:10:07 PM »
Quote
Eclipse is just one of the biggest, expandable, Integrated Development Environment (IDE) on the world.

oooops i never heard of that one....  :oops:
i don't exactly understand your last post but i think i will understand when you release it someday ^^