How to get Python Console in BTS

Refar

Deity
Joined
Apr 10, 2005
Messages
4,608
I am sure that was covered somewhere... the trouble is, i can not find where.

I am trying to cook up a new Random Map Script and have some trouble debugging.

Waht i have found is: putting CheatCode = chipotle in the ini file and different suggestions, what key to use to open a console... None Worked

What i need is: a console where i can see the output of the Python interpreter 'live'. Even better a console where i can directly write code sniplets, to see what happens.

Thanks.
 
press "Shift" + "~"
 
Ok, i got the console thanks....

But is there a way to see the Python output in it ? (or at all)

I have seen "print(...)" calls, wich obviously are meaned for debugging in the civ4's map Scripts, so i assume there is a way to read them... but for now i dont know how - they do not appear in the console, and they are not going into any of the log files...
 
I don't know of any way to get them to print to console, but there are some debugging flags in the Civilization4.ini file that makes the stuff print to log files.
 
yeah i know... but i was hoping to make faster progres, if using the using the console. thanks anyway :D
 
Ok, i got the console thanks....

But is there a way to see the Python output in it ? (or at all)

I have seen "print(...)" calls, wich obviously are meaned for debugging in the civ4's map Scripts, so i assume there is a way to read them... but for now i dont know how - they do not appear in the console, and they are not going into any of the log files...
Doesn't it work if you just type 'print <something>' in console? I'm sure i was able to print a variable to the screen from a console somehow, but i forgot the exact way.
As i understand, there is no difference if you call any function from a game script or from a console.
 
I think Refar is asking how to have print calls inside Python modules go to the console. I'm talking about when the game is running your code normally, not when you call a function from the console.

Unfortunately, I haven't figured out how to get debug output like that, so I use CyInterface() to print messages to the screen.

Also, when I call a function from the console that prints something, I find that often times strings are printed twice. I cannot find a reliable pattern here, but the same calls produce the same repeats (the repeat is repeatable, as they say). Does anyone know what that's about?

Finally, sometimes the console gets borked so that no matter what command I type I get the error: "Invalid syntax: command not found" -- even import statements. This just happened when I used the console just fine, then closed it, then reopened it and now it won't take any commands. :cry:
 
I think Refar is asking how to have print calls inside Python modules go to the console. I'm talking about when the game is running your code normally, not when you call a function from the console.

Unfortunately, I haven't figured out how to get debug output like that, so I use CyInterface() to print messages to the screen.

Yes i was talking about this :D And i did not figured it out too. In addition i am working on map script, and for the most time when generating maps, the screen is frozen anyway... So i am sticking with Windowed mode and a texteditor having the option to reread a file when changed on disk...
 
Finally, sometimes the console gets borked so that no matter what command I type I get the error: "Invalid syntax: command not found" -- even import statements. This just happened when I used the console just fine, then closed it, then reopened it and now it won't take any commands.
This just happened to me.

("won't take any commands" = all commands give the Invalid Syntax error)

What can I do about it? (Rebooting my computer didn't help)

Can I somehow restart the console, so I get the initial greeting message again?
 
Rebooting my computer didn't help.

Really? It was a long while ago for me when I tried using the console, but I thought restarting Civ fixed the problem. I'm on an entirely new computer. Sorry I can't be any help.
 
no matter what command I type I get the error: "Invalid syntax: command not found" -- even import statements. This just happened when I used the console just fine, then closed it, then reopened it and now it won't take any commands.

This just happened to me.
("won't take any commands" = all commands give the Invalid Syntax error)
What can I do about it? (Rebooting my computer didn't help)


This seems to be happening to me as well; even import CvUtil in the console is just giving an Invalid Syntax - command not found error. Anyone know a fix for this or why it happens? :confused:
 
Make sure you are opening the Python Console ("~" key) and not the "other" console ("`" key). If you don't see the Python version information and a double prompt (">>") you're in the wrong one. On my keyboard both characters are the same physical key but "~" requires holding down Shift which can be a little tricky.
 
How do I get the console to open in hotseat ?

Shift + ~ doesn't work, although it does work in singleplayer :(
 
Back
Top Bottom