Register FAQ Search Today's Posts Mark Forums Read
Go Back   JazzJackrabbit Community Forums » Open Forums » JCS & Scripting

JJ1 Stuff -- Improve my Python

Violet CLM

JCF Éminence Grise

Joined: Mar 2001

Posts: 11,090

Violet CLM has disabled reputation

Jun 21, 2010, 07:35 PM
Violet CLM is offline
Reply With Quote
JJ1 Stuff -- Improve my Python

miscjj1.py
blockset.py
I'm working on my first Python program. So far, if you give it a folder it will convert every JJ1 BLOCKS file therein to a 256-color .png for use in whatever you like. Some code is based on Stijn's JJ2 stuff, and I refer heavily to DD's various file format documentations. Since I'm very new to Python, if you know it, I'd love some instruction for how to improve this, be it formatting alone or actual optimization. If not, hopefully you want to extract some JJ1 sets.
__________________
Dermo

JCF Member

Joined: Jun 2005

Posts: 1,743

Dermo should make better posts

Jun 22, 2010, 11:54 AM
Dermo is offline
Reply With Quote
I worked with Python for a quarter in school. If you have any questions, feel free to ask me. Honestly, I think Python is not the best programming language to use, however.
__________________
Yes, I am, in fact, ALWAYS the one to blame for everything. And none of your are full of yourself. Good job.

Do you like Stijn? Take my poll!




Windows is not a virus. A virus is small and efficient...

Note to Stijn: how am i even getting away with this
Violet CLM

JCF Éminence Grise

Joined: Mar 2001

Posts: 11,090

Violet CLM has disabled reputation

Jun 22, 2010, 12:28 PM
Violet CLM is offline
Reply With Quote
Go on...
__________________
minmay

JCF Member

Joined: Aug 2002

Posts: 1,186

minmay is immeasurably awesomeminmay is immeasurably awesomeminmay is immeasurably awesomeminmay is immeasurably awesomeminmay is immeasurably awesome

Jun 22, 2010, 12:58 PM
minmay is offline
Reply With Quote
Quote:
Originally Posted by Dermo View Post
Honestly, I think Python is not the best programming language to use, however.
Depends on the application, and personally I'd say Python is one of the best choices for something like this, though admittedly I don't have enough knowledge of it to correct anything in Violet's code.
Newspaz

JCF Member

Joined: Jan 2001

Posts: 2,678

Newspaz has disabled reputation

Jun 22, 2010, 01:34 PM
Newspaz is offline
Reply With Quote
I have written code for this in Python before, and it was comparable to this. It's been at least two years though so I can't really help you here Python-wise.
plunK

JCF Member

Joined: Apr 2008

Posts: 514

plunK is an asset to this forum

Jun 22, 2010, 02:21 PM
plunK is offline
Reply With Quote
lol i used python for 2 years....never got nearly this far XD
Violet CLM

JCF Éminence Grise

Joined: Mar 2001

Posts: 11,090

Violet CLM has disabled reputation

Jun 22, 2010, 04:20 PM
Violet CLM is offline
Reply With Quote
To be fair, I've been programming with Multimedia Fusion/etc. for ~15 years, plus a vague understanding of Javascript/C-like-stuff and I've had some practice with Python doing Django over the last year or so, although that was all very specific stuff and I didn't know any of the basic concepts behind what I was doing.

Sometime between my executing it in the first place and now, I managed to introduce some sort of error into this such that it stops working after reading one blocks file. I haven't figured out what I did yet, and I'm not sure if it's in the version I put online or not, so if you want to use this, be warned.
__________________
Dermo

JCF Member

Joined: Jun 2005

Posts: 1,743

Dermo should make better posts

Jun 22, 2010, 08:09 PM
Dermo is offline
Reply With Quote
Quote:
Originally Posted by Unknown Rabbit View Post
Go on...
I'm not sure, I never have really worked with Python to do hard-code. However, in my experiences, Python has been very fussy with me. It's not very extensive, I've noticed. After working with Visual Basic, I've just found Python doesn't work with me in terms of object-oriented programming. Mostly because of the way it handles values (especially when it comes to floating points). You also can't define a function in a line, you have to give it a name. This always led me to have to go back and re-do my code, forgetting that all functions had to be defined before actually coding them. And don't mention lambda, that's just a shortcut...

I mean, all-in-all, perhaps I shouldn't have made that comment. These are my issues with Python. However, for what you're using it for, it should work out fine. But extensive programming, not exactly.
__________________
Yes, I am, in fact, ALWAYS the one to blame for everything. And none of your are full of yourself. Good job.

Do you like Stijn? Take my poll!




Windows is not a virus. A virus is small and efficient...

Note to Stijn: how am i even getting away with this
Torkell

Stealth Admin

Joined: Jul 2004

Posts: 2,153

Torkell is a forum legendTorkell is a forum legendTorkell is a forum legend

Jun 24, 2010, 12:36 PM
Torkell is offline
Reply With Quote
I don't think there is such a thing as an all-round best programming language, but there are definetely languages that are nicer to use than others and purposes where specific languages are the best.

Some examples: With VB when trying to make large complex programs you soon end up running into various limitations, but it's excellent for quick hacks and virtually impossible to shoot yourself in the foot with. On the other hand, C/C++ are incredibly powerful but have no end of ways to trip up even experienced programmers.

On python: I've only used it a few times so I've not really explored it yet. I think my main gripes with it were the too-free coding style (I prefer languages where interfaces are solidly defined) and the quality of the API/library. On the whole, it's a nice scripting language but I'd hesitate before using it for a large project and I'm more likely to brew up something in VB if it's a small one-off or similar.
__________________
-- Torkell



Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump

All times are GMT -8. The time now is 06:43 AM.