Python (civ4 scripting language) tutorial thread

I am with you Weasel Op. I was in the GATE program as well, but I am so old they didn't offer any programming classes when I was a wee tot. I did take keyboarding and office computing in HS, but that was all they had. I also had an old Tandy keyboard/computer you hooked up to a TV when was about 12 or so. Took some programming classes in college - the rest I taught myself or learned on the job. Been doing it professionally for over 7 years now.

Gosh I feel old now :(

Oh, and back on topic - started the lessons myself. Hope to have them done as well as a side project in it by Civ4, but I am getting hitched on 10/16, and will be in Hawaii for the remainder of the month, so time will be short.
 
My last programming experience was BASIC on my Apple IIC. I use computers all the time, I just got away from programming. I don't know why you'd want to provide a free tutorial in programming for me, but thank you very much. I find Python to be very easy to learn. What about XML? Where do I go to learn that?
 
Modifiable said:
My last programming experience was BASIC on my Apple IIC. I use computers all the time, I just got away from programming. I don't know why you'd want to provide a free tutorial in programming for me, but thank you very much. I find Python to be very easy to learn. What about XML? Where do I go to learn that?

www.w3schools.com
 
Amesjustin said:
I am with you Weasel Op. I was in the GATE program as well, but I am so old they didn't offer any programming classes when I was a wee tot. I did take keyboarding and office computing in HS, but that was all they had. I also had an old Tandy keyboard/computer you hooked up to a TV when was about 12 or so. Took some programming classes in college - the rest I taught myself or learned on the job. Been doing it professionally for over 7 years now.

Gosh I feel old now :(

You and me both. I actually wrote programs on a punch card system in HS until my senior year when we finally got a DEC mainframe. We used to have to walk around with these big stacks of cards held together by rubber bands and if the thing ever fell and got out of order....ouch!

Of course, I had my faithful Atari 400/800 at home to mess with BASIC if I wanted to. The old Atari magazines would print complete games in pages and pages of code that you could type in for a free game. :crazyeye:

Anyway, still working on this excellent Python tutorial. Just started with lesson 8, Classes. :)
 
Thank you for the link to XML tutorial. It is excellently helpful. I'm working on lesson 7 and have just completed creating a text adventure. This actually worked! So, I've completed lesson 7 now and I'm moving on to lesson 8. I can't remember when I was last this excited to be learning something. Again my thanks to the Gingerbread Man for taking all the time and effort to post these tutorials and to the rest of you for helping out as well.
 

Attachments

I completed lessons 8 & 9, and while I can't say that I'm completely comfortable with classes, I get the idea and think with practice I'll be alright. I'm having problems on lesson 10. I'm trying to use the open() function. Everytime I try it returns an error saying there's no such file. Obviously I'm doing something wrong. Here's the way I've done it (though I've tried pretty nearly every combination I could think of.)

openfile = open('c:\python23\bard.txt', 'r')

Now I've tried leaving out the .txt, the c: the ' ' s I'm not sure what I'm doing wrong. If anyone can enlighten me I would appreciate it.
 
That worked perfectly. Thanks for the help! :)
 
I don't know much about moding, but would be able to mod resource to be countable. (so that with one oil resource you can have 20 modern armors or 5 carriers) That would be amazing! It does not seems to hard to mod.

Would you be able to mod that only town with airport can hold airplanes
 
bundy said:
I don't know much about moding, but would be able to mod resource to be countable. (so that with one oil resource you can have 20 modern armors or 5 carriers) That would be amazing! It does not seems to hard to mod.

Would you be able to mod that only town with airport can hold airplanes

Even tho this is probably gonna be pretty simple to do, I think you will need the SDK to do it. And know some c++.
 
Grey Fox said:
Even tho this is probably gonna be pretty simple to do, I think you will need the SDK to do it. And know some c++.

And you may have a major job on your hands getting the AI to do something useful with your changed rules.
 
Yeah, I reckon that adding features won't be too hard by the sound of what Firaxis will be giving us control over.

Getting the AI to work with it, however, is another story. Python is probably too slow for AI purposes, meaning we need to wait for the SDK.
 
For those who are interested, and haven't seen it yet, I found a link to this article on slashdot:
http://www.gamecloud.com/article.php?article_id=1614
Can't wait for this SDK to come out! We'll be able to mod everything but the graphics engine and the basic civ core, so the article tells us.

I wonder what they mean by the core civ part? As in the map and grid, units, and turns? Or is it more/less? What form will this SDK be in? Hopefully Firaxis has a fan-chat when they release the game, because I'll be trying to leech as much information off them as possible...
 
So, I've finished the 11 tutorials posted here. I want to again say thanks for the obvious work that went into creating them. I've also been researching Python programming and I have a question. Nothing I've seen gives any indication of how graphics are handled with Python. I know cIV will have its own graphics engine, do we have any idea of how to use Python to address those graphics? What about sounds? How do I make Python do the fun multimedia stuff in other words?
 
Weasel Op said:
So we can do graphical programming in Python? :drool:
I thought that would have to be done in the SDK.

Yup, I tried doing some myself, but I couldnt get the images to show. :P

But I did create windows with buttons and title etc.
 
Back
Top Bottom