Author Topic: Python Learning Resources and Assistance  (Read 9549 times)

Offline Mark

  • Retired Administrator
  • Posts: 1930
  • Cookies: 1797
  • Site Co-Founder
    • ST Excalibur
Python Learning Resources and Assistance
« on: July 21, 2006, 06:30:48 AM »
I've made this thread because it's clear that the BC community needs more scripters.  There are people posting new ideas in here occassionally, but there's nobody around with both the knowledge and the time to make other peoples' ideas work.  The logical solution is to do everything possible to help people learn Python, and some of the specifics of BC's Python interface.

PYTHON

The place to start if you're serious about learning Python is:

www.python.org

This is the official Python home page.  You can download the latest version of Python here, if you wish (and if you intend to learn to use the language, I'd heartily recommend it!). Bridge Commander uses Python 1.5.2, so it might be best if you went with this version.

Also at this domain name are links to several good tutorials for learning Python.  A direct link to the page with the tutorials on is:

http://www.python.org/doc/Newbies.html

And I particularly recommend A Non-Programmer's Tutorial for Python for those of you new to the concepts of programming.

Bridge Commander

As for Bridge Commander-specific stuff.. Well, I'm afraid there isn't really much around yet that I'm aware of.  Bear in mind, everyone in the community that knows *anything* started off knowing nothing at all, and it is only trial and error, and sifting through the SDK that we've learnt how to do things!

When making new scripts for BC, this is the process I'd follow to configure my computer:

1. Install a second copy of BC, and patch it.

2. Extract the scripts from the BC SDK (Available here, I think you need only get V1.1)

3. Start scripting! Just go nuts and try *anything* at all! You can edit the .py files in any text editor, or if you've downloaded Python, you can use the editor it comes with, which has nice features like syntax highlighting and things. 

And if it all goes wrong, your main BC install is still safe, and all you'll probably have to do is re-extract all the .py files from the SDK back into the Scripts directory! Nice and easy!

As I said, please feel free to use this thread to ask more questions, but please, try and keep the scope of your questions small! Asking for help with one particular problem you've found while working on something is far more likely to get a positive response than popping in and asking "How do I program it so that the saucer can seperate?".  Where possible, if you have code that's playing up, attach a file so that people can have a look at it and try to work out what's wrong (You may need to change your file's extension to .txt, or zip your file, to attach it to the forum)

This thread should not be for other scripters to do all your work for you.  It should be for other scripters to help you become a better scripter, so that the number of people working to make the game better can start to increase.

Originally Posted at BCU by Sim Rex

Offline LJ

  • Retired Staff
  • Posts: 1661
  • Cookies: 1139
Python Learning Resources and Assistance
« Reply #1 on: August 26, 2006, 09:55:02 AM »
Attached is a VERY Basic tutorial about how to use Python. I would recommend it if this is your first experience at programming.

Here is a link to the BCS:TNG Training Corps.

LJ

MLeo EDIT: Fixed the link

Offline LeeGrant

  • Posts: 1
  • Cookies: 0
Re: Python Learning Resources and Assistance
« Reply #2 on: February 25, 2007, 01:08:41 PM »
Thanks for posting this.  I've been wanting to learn scripting for some time.  You mentioned that BC uses python 1.5.2, but will the newest version work too?   

BCDS

  • Guest
Re: Python Learning Resources and Assistance
« Reply #3 on: February 25, 2007, 01:24:11 PM »
Yes, after all its just a Seperate Interpreter, there maybe changes however in operators or something but it should be mostly the same.

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Python Learning Resources and Assistance
« Reply #4 on: February 25, 2007, 01:47:54 PM »
There are some incredibly usefull things in the newest Python that are not possible in 1.5.2, for instance, the pop function on dictionaries isn't in 1.5.2
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 RCgothic

  • Retired Staff
  • Posts: 428
  • Cookies: 51
Re: Python Learning Resources and Assistance
« Reply #5 on: May 25, 2007, 08:01:08 AM »
Are there any resources about for Mission Scripting in Python for BC?

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Python Learning Resources and Assistance
« Reply #6 on: May 25, 2007, 08:04:47 AM »
Are there any resources about for Mission Scripting in Python for BC?
There are, aside from the bits and bobs in the SDK, there is an excelent series by SimRex on mission scripting, with JWattsjr for a couple of AI lessons.

They are in the BCU scripting forum (I believe the links are in the Usefull links stickies).
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.

wz

  • Guest
Re: Python Learning Resources and Assistance
« Reply #7 on: May 26, 2007, 06:58:00 AM »
Slightly offtopic question, but do you have access to a normal python environment as well? I mean, is it possible to load modules etc. ?

wz

Offline Defiant

  • Posts: 398
  • Cookies: 1105
    • BC: Kobayashi Maru
Re: Python Learning Resources and Assistance
« Reply #8 on: May 26, 2007, 07:07:06 AM »
Slightly offtopic question, but do you have access to a normal python environment as well? I mean, is it possible to load modules etc. ?
From BC? You have to copy the modules from a Python 1.5 Installation into scripts/.
This will work with ~90% of all the modules.

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Python Learning Resources and Assistance
« Reply #9 on: May 26, 2007, 08:57:27 AM »
Indeed.

There are a couple of modules built into the exe, such as nt (similar to os).

And we can't read nor write from anything outside the scripts/Custom/ directory.
What we can do is list all files from anywhere within BC (I must admit, I haven't tried outside of it yet) through usuage of the Load/Save File Dialog UI object.
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 Defiant

  • Posts: 398
  • Cookies: 1105
    • BC: Kobayashi Maru
Re: Python Learning Resources and Assistance
« Reply #10 on: May 26, 2007, 09:06:47 AM »
Small thing: The module 'nt' shouldn't be imported directly. Thats why 'os' exists.

Under windows the os module will load the nt module, under an unix the posix module and so on.

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Python Learning Resources and Assistance
« Reply #11 on: May 26, 2007, 09:08:55 AM »
True, but os isn't always avaidable.

And BC is, as of yet, still Win32 only.
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 SMBW

  • Noob
  • Posts: 35
  • Cookies: 107
Re: Python Learning Resources and Assistance
« Reply #12 on: March 26, 2008, 01:38:08 PM »
Attached is a VERY Basic tutorial about how to use Python. I would recommend it if this is your first experience at programming.

I just tested your tutorial and wanted to tell you that I enjoyed it very much. It's easy to understand and much fun the way you write it. It's much more practical then most other tutorials I read because you show how to use the new introduced things instead of simply defining them. Thanks for writing it!

I assume you didn't write more, did you?
Don't part with your illusions. When they are gone you may still exist, but you have ceased to live.  - -  Mark Twain

Sorry for my bad English!

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Python Learning Resources and Assistance
« Reply #13 on: March 26, 2008, 01:53:30 PM »
I assume you didn't write more, did you?
He did, it says so at the bottom in the exact same style as the rest of the document (the last bit meaning that he didn't simply attach another page).
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 SMBW

  • Noob
  • Posts: 35
  • Cookies: 107
Re: Python Learning Resources and Assistance
« Reply #14 on: March 26, 2008, 07:07:39 PM »
He did, it says so at the bottom in the exact same style as the rest of the document (the last bit meaning that he didn't simply attach another page).

Oh, I'm sorry!
He wrote that he would think about it if it?s well received, so I wasn't so sure about that...
So now that?s fantastic, I can't wait to see the other tutorials. Can someone post a link to them? I tried to use the search, but I wasn't able to find anything.
Don't part with your illusions. When they are gone you may still exist, but you have ceased to live.  - -  Mark Twain

Sorry for my bad English!

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Python Learning Resources and Assistance
« Reply #15 on: March 26, 2008, 07:25:15 PM »
Ah, sorry about this missunderstanding, I "read" (yeah, read wrongly) that you asked if LJ wrote the tutorial.
Sorry, I don't know of any other tutorials he may have written.


There are some other tutorials (BC specific) here:
http://bcs-tng.com/forums/index.php?board=26.0

Also, if you have any specific questions (BC or Python, I'll even try to answer others if I can), feel free to ask in this forum.
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 LJ

  • Retired Staff
  • Posts: 1661
  • Cookies: 1139
Re: Python Learning Resources and Assistance
« Reply #16 on: March 27, 2008, 06:04:47 AM »
Thanks for the compliments man.   :mrgreen:  I never got round to writing any more after that, but I will hopefully be releasing another regarding making the LCARS interfaces for the game. :-)

Offline SMBW

  • Noob
  • Posts: 35
  • Cookies: 107
Re: Python Learning Resources and Assistance
« Reply #17 on: March 27, 2008, 07:23:26 AM »
Great, now I really am looking forward to read it!
Don't part with your illusions. When they are gone you may still exist, but you have ceased to live.  - -  Mark Twain

Sorry for my bad English!

Offline dep88y

  • Posts: 51
  • Cookies: 0
Re: Python Learning Resources and Assistance
« Reply #18 on: January 01, 2009, 12:11:40 AM »
 I would like to learn more but the researsh I've done seems to work off the assumption that the learner (me) has a basic foundation of computer programming terms. In reading your post I found a good example that I encountered. SDK, I don't know what that is.
 So, here is what I'm asking. Is there a resource that I can study to get me "up to speed" so that I can learn from the newby or beginner lessons, like with Python? I hope I was clear because I have a problem communicating effectively.
 If you could assume that I never had computer classes in highschool (because they didn't exist then) or any training at all. I just picked up a computer and learned to use the programs by trial and error; believe me, it was a lot of hours and errors.
 OR wait. If you had a child that was beginning and your child knew how to use email and all that stuff in those novice dummy books; what would you have them study?

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Python Learning Resources and Assistance
« Reply #19 on: January 01, 2009, 08:20:01 AM »
SDK stands for Software Development Kit.

Do you have a basis in Mathematics, Logics, and/or Set Theory? Then it shouldn't be that hard.

Here is what I would recommend, learn 2 languages. Python, http://docs.python.org/tutorial/index.html (be aware, that this is a newer version of Python than the one used in BC, so not everything will be usable, but it's still Python, aside from that, BC uses a modified version of Python 1.5.2, so a lot of standard libraries won't be avaidable) and some other language. But I think it would be usefull, if you just started at the link above.
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.