Cities: Skylines

Cities: Skylines

Python Console
50 条留言
1yur 2024 年 4 月 16 日 上午 8:15 
@Strad
any plans for Cities Skylines 2?
eran0004 2023 年 3 月 23 日 上午 10:50 
@Pistro It's caused by calling a function before it has been defined. In the original code, the curve function is defined starting on line 29, while the call is made at the end of the script on line 116.
Pistro 2023 年 3 月 10 日 上午 9:44 
Hi, I'm getting "Error: name 'curve' is not defined (script: line 1)" when executing the curveapp.py script. What could be the cause?
Strad  [作者] 2022 年 9 月 10 日 下午 1:19 
@Theodoroid Send me a friend request or create an issue on github - steam comments aren't a convenient place for such a technical discussion

Why do you need to debug the python server in the first place? The IronPython engine does not work? :)
Theodoroid 2022 年 9 月 3 日 上午 4:55 
[continued 4]
Alt+S brings up the ingame console, but it does not appear to be attached to the python server (pressing F5 on priint("Hello World!") has no effect. Should it? The wiki suggests that the in game component " will automatically connect to it after you open the Python Console dialog window." Should the ingame console be usable?

In VC22, I'm not yet able to execute code and have it affect the game state. The edittor isn't recognizing game symbols. What should I be using as the Python environment? Am I on the right track?
Theodoroid 2022 年 9 月 3 日 上午 4:39 
[continued 3]

Looking at the PC source code suggests it's using a vanilla TCP connection. As VSC doesn't offer that option (ssh is supported), I've installed VS22. Manually launching SkylinesRemotePythonDotnet.exe, and then, in VS22, Debug->Attach To Process produces several lines of output of the form '

SkylinesRemotePythonDotnet.exe' (CLR v4.0.30319: SkylinesRemotePythonDotnet.exe): Loaded 'C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll' . Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

In C:S I've enabled all the options except "execute scripts synchronously"
Theodoroid 2022 年 9 月 2 日 上午 10:23 
[continued 2]

On further reflection, I think I understand why my prior attempts failed: what I need to do is establish a connection with SkylinesRemotePythonDotnet.exe running as a "remote" sever, not as a local interpreter. I found multiple tutorials on how to do this in VSC, so it seems probable that it's possible to do it with Python Console. However, I do not know what port to use, if there is an authentication token, etc. Any clarification you could provide would be most appreciated.
Theodoroid 2022 年 9 月 1 日 上午 5:24 
[continued]

Am I correct in assuming SkylinesRemotePythonDotnet.exe is the Python interpreter? VSC (and PyCharm) both complain with similar messages (e.g., VSC's says, "An invalid Python interpreter is selected"). I tried making a copy named python.exe. in the same directory, but it too was rejected. To ensure I understood the configuration process correctly, I also installed IronPython and had no trouble VCS to use it.

I'm now at a loss on how to proceed. Would you please elaborate on how to configure VSC (preferably or VS otherwise) to work with your marvelous creation?
Theodoroid 2022 年 9 月 1 日 上午 5:23 
@Strad first, kudo's on creating an amazingly powerful and useful tool for the programmatically inclined!

The wiki mentions "You can run and debug the extarnal Python application directly from Visual Studio" and "you can start the server in VS." My efforts to do so have thus far proven futile and I realize the fault may be my own because my attempts (thus far) have been with VSC (with the MS Python Tools installed as recommended on the IronPython page) rather than VS proper.
[continued]
Strad  [作者] 2022 年 8 月 23 日 上午 10:38 
@Thorium Unfortunately you can't get info about cargo at this moment.
☢️ W Y VΞ R Π 2022 年 8 月 23 日 上午 12:18 
@strad - Will this mod only interact with networks or can it also interact with plopped buildings. For example to monitor the amount of Cargo pushed to a Warehouse by a truck, and then monitor the amount pulled out into a truck for export. Other examples could be like monitoring units of cargo hauled by a moving freight train etc. etc.
Sir Sheikhs Pears 2021 年 12 月 15 日 下午 5:50 
@IhmeHihhumi: RealGodzilla has done something like that on his map - tells us in detail about it on the MacSergey's Discord server in this thread: https://discord.com/channels/727463293253582967/731944724079968296/905565820573351986
Strad  [作者] 2021 年 12 月 13 日 下午 1:31 
@IhmeHihhuli Yes, it definitely possible to do that. You can get height data from the game and use them to compute the gradient. It requires to do a few trick so it is performant enough and the script doesn't take too much time to finish. If you are interested you can create an issue on the github page where we can talk about it more.
IhmeHihhuli ™ 2021 年 12 月 13 日 上午 6:47 
Judging by the GIF in the showcase image reel, with this mod you could auto-generate trees and resources to a map, am I right? Say for example, auto-generate trees to a map with a predetermined strength, programming the generation to happen on only certain terrain-gradient levels (i.e. place trees on low gradient hills only for example). I'd suppose the same could go with the resource painting as well.

I've dabbled some bit with Python and if the aforementioned is possible with this mod, this could probably revolutionize map making in some scenarios. We're talking about saving dozens of hours potentially. Really curious as to how well this mod could be utilized in that specific use-case. Thumbs up regardless! :hardhat:
Sasquatch 2021 年 11 月 21 日 下午 6:22 
@Strad Yeah, I don't know any python. So I really wouldn't have a clue where to start.
Strad  [作者] 2021 年 11 月 21 日 上午 2:48 
If you want to add transition curves, you probably need to rebuild all the roads, which is quite a hassle. But you can code a script that would do all that for you - it isn't included in the mod by default.

As for following the terrain - yes, there is an option for that.

Anyway, if you don't know coding it could be quite time consuming for you.
Sasquatch 2021 年 11 月 20 日 上午 5:54 
Looking at the wiki, I like the idea of being able to add transition curves to roads. Is that something that can be done to existing road, or does it need to be done when you build the road? Also, is it possible to tell it to build roads that follow terrain contour lines? My biggest aggravation with the game is building realistic mountain roads that follow the terrain and have sensible switchbacks.
Simuscape 2021 年 7 月 12 日 下午 2:37 
@10SunBee , hahaha... I was thinking the very same....
10SunBee 2021 年 6 月 12 日 下午 8:22 
I am afraid that I am not mathematically smart enough to use this mod lmao
Flesh Pound 2021 年 6 月 6 日 上午 6:45 
Wonderful!
Strad  [作者] 2021 年 5 月 24 日 下午 1:05 
Not for now. If you want to know a name of a specific road, build it with a road editor and then use clipboard tool to find its name.
You can add me on steam - I will be happy to answer all your questions :)
oliver 2021 年 5 月 24 日 上午 8:46 
Is there a way to iterate through all road types?
Victor 2021 年 5 月 24 日 上午 12:50 
OMG
Chief_Falkon 2021 年 5 月 18 日 下午 8:51 
This is probably a bit too advanced for me today, but maybe one day... Definitely love the concept
Koesj 2021 年 5 月 14 日 下午 2:51 
Insanely good mod, many thanks!
Indoctrinated 2021 年 4 月 17 日 上午 1:01 
I haven't strayed far from CPython or Cython, so I'll have to take a good read over the IronPython API.
Strad  [作者] 2021 年 4 月 15 日 上午 12:48 
Unfortunately not all libraries work with the IronPython engine.
I am happy to help if you would have questions about the API or have problems with making it work.
Indoctrinated 2021 年 4 月 15 日 上午 12:20 
Definitely going to try this out. I've always wanted to simulate a more accurate grid in-game, but the documentation for the C# API is kinda garbage.

Would it be possible to use use packages like, say, Numba, Pandas, and NumPy? Because this could get insane using Dask for simulation.
Strad  [作者] 2021 年 3 月 31 日 上午 1:08 
For now you can't change traffic lights. Unfortunately it is not a trivial task because of compatibility issues with TMPE
ehel 2021 年 3 月 30 日 下午 1:59 
is posible got get a state of an object. I mena like a trafic light?
Woud be so cool to program them.
Or that i seen some peopel try do. A bridge thats open up for ship when they come near a bridge.
Sp3ctre18 2021 年 3 月 11 日 下午 8:49 
U kidZ n ur coding n automation! Back in my day we did this stuff by hand, eyeballed, calculated, getting those tangencies and 12 unit lengths in!
Strad  [作者] 2021 年 3 月 11 日 上午 11:15 
I've just released a new version that includes the scripts (see the description)
@r3fe Hopefully one day
eran0004 2021 年 3 月 11 日 上午 9:46 
@Deeheks I study civil engineering, so that statement is pretty accurate! The script should be included with the mod soon :)
r3fe 2021 年 3 月 11 日 上午 4:45 
Is there any plan to make this available on other platforms besides Windows? Because this is literally the coolest thing ever.
kuaman 2021 年 3 月 10 日 下午 9:46 
Awesome...
cbudd 2021 年 3 月 8 日 上午 9:39 
Amazing. Makes me wanna try learning programming now
Deeheks 2021 年 3 月 7 日 下午 12:16 
CIVILskylines when?
wow eran you're amazing.. could you share some scripts eventually? would love to try!
eran0004 2021 年 3 月 7 日 上午 10:59 
I'm using this mod to design realistic curves for my railroads and highways. I can do that with MoveIt as well, but then I would have to manually set the coordinates of each node, which takes a lot of time. With this mod I can automate the entire process and have it done within two seconds.
Strad  [作者] 2021 年 3 月 6 日 下午 1:51 
You are right that it is rather a mod for "placing assets", but not every idea how to do that can be expressed with your keyboard and mouse.
macluk 2021 年 3 月 6 日 下午 1:39 
Is it a mod for modding that I still cannot see any details on here how to mod? Or is it just for placing assets, which i can do with my keyboard and a mouse? Because the impression after watching the video is that the latter is the case here.
matt 2021 年 3 月 6 日 下午 12:14 
The only Python I'm interested in features John Cleese, Michael Palin and Terry Jones... and I've no idea what I'm doing, but good work anyway!:steamthumbsup:
98ColdDew 2021 年 3 月 6 日 上午 7:35 
Incredible ! ! !
Strad  [作者] 2021 年 3 月 6 日 上午 7:13 
Unfortunately ironpython integrated with dotnet doesn't support python 3, at least not officially
iamdumdum1234 2021 年 3 月 6 日 上午 5:16 
Why did you chose Python 2 instead of 3?
It is just a question, this mod is very interesting.
Strad  [作者] 2021 年 3 月 5 日 下午 2:06 
Yep, it should be 2.7
There should be most of the basic functionality. About the external libraries - I don't know. I think it is possible.
There is a page about standard file imports:
https://github.com/Strdate/PythonConsole/wiki/Python-Imports
Ingenium 2021 年 3 月 5 日 下午 1:04 
That is awesome! Thank you.

I have seen on the Github that it works with IronPython. So it is Python 2.7? And are all Python functionalities available and can we load additional packages (numpy, pyopt, whatever)?
74091796519793665 2021 年 3 月 5 日 上午 11:49 
Wish you good luck with this project. Looks very interesting.
LemonsterOG 2021 年 3 月 5 日 上午 9:36 
@Strad -- Thanks! Hopefully, it will save you some headaches with MacOS player comments.
Strad  [作者] 2021 年 3 月 5 日 上午 9:28 
Ok I put the warning at the top
LemonsterOG 2021 年 3 月 5 日 上午 9:21 
Will this work with MacOS? If not, I suggest noting that boldly at the very top of the description.