[Plugin] [DEV] Python for SA-MP
#1



Well, I started this project ages ago, it failed, then I was motivated to restart it and got it to a fairly working state.

This is my development thread for my plugin which integrates the Python interpreter into SA-MP. Basically you can run Python scripts on SA-MP servers, similar to MaVe\'s Lua wrapper. (though obviously that allows you to run Lua, not Python scripts)

Ask questions and such if you want, I\'ll update it with more information and screenshots soon, and hopefully within a month or two it will be released.

What is it?

A plugin which will allow you to run scripts coded in Python on SA-MP servers, using both Python and SA-MP functions.

What\'s Python, and where can I learn it?
www.python.org

Why Python?

Because it rocks. Take a look at its massive collection of in-built modules: http://docs.python.org/modindex.html

What can you do with it?

Run Python scripts on SA-MP servers. You will have access to all of the normal SA-MP functions, in respective modules (ie. functions from a_vehicles.inc will be in the "vehicles" module, you will only need to import what you use) as well as all of Python\'s built-in modules. (such as urllib, cPickle and SQLite, just to name a few cool ones)

What about the speed?

I haven\'t actually done a speed test, but it will probably be slower at executing callbacks in Python scripts, and at calling SA-MP functions from Python scripts.

There is nothing I can do to help this, it\'d be a lot faster if plugins were given native access to the server, but rather everything must be done through Pawn. (without memory hacking, that is) Nevertheless, the delay in executing functions and callbacks will be mere milliseconds, if that.

I haven\'t done a speed test to compare Python and Pawn default functions, either, but probably will soon. Oh well, Python still rocks.

When will it be released?

When it is in a stable state with all functions/callbacks implemented, and doesn\'t crash the server every 5 seconds.

What will be included with it?

The plugin itself, all of Python\'s default modules, and all SA-MP Pawn scripts rewritten to Python. (as examples)

It currently uses Python 2.6.x, but may be upgraded to 3.

I want it now!

No you don\'t. If you want to help test it, though, you can PM me. Pawn and Python scripting experience would be handy, but I\'d be happy to let most people test it if they want to.

Where are the screenshots? Have you actually done anything yet?

Screenshots are coming soon. I\'ve mostly integrated the Python interpreter into a plugin already, some work is left on that though, as well as adding all native SA-MP functions to be accessible from Python.

Can I help?

If you have experience with Python, possibly. You can also help test the plugin, read above. PM me.

Join the IRC channel for development updates and latest news - #sa-mp.python on irc.tl (formerly FFSNetwork)
UPDATES

- June 18 - base.pwn rewritten in Python as an example: http://pastebin.com/i5uRgHkg

- June 18 - Looking for Python coders to rewrite default SA-MP scripts (Pawn > Python)

- June 19 - Threads don\'t seem to be working :\
Reply
#2

:O yayyyyyyy

i cant wait for this

you rock man
Reply
#3

Nice
Reply
#4

this shit will be hawt, n1 <3

edit - realised it\'s not released yet D:
Reply
#5

Awesome, I\'ve done a bit of \'research\' on Python and it looks pretty epic. Can\'t wait to see a public release of this.
Reply
#6

Small updates

- All callbacks are now implemented and working
- Multiple Python scripts can now be loaded (this was always planned, but there was a small bug which prevented more than one script from working)
- Added a few more SA-MP natives (all will be added, there\'s about 95% of them left, but I want to make sure I have a system that works before adding them all)
- Fixed a few bugs with callbacks and script loading
- Threads are being retarded, not sure how I\'m going to implement timers. With any luck I can get Python\'s whole threading system working, as well

Still open to suggestions and looking for Python coders and testers, too.
Reply
#7

Watermelon here, I\'m pretty sure we talked about this

I would offer to test but my knowledge on Python is limited to calculating prime numbers and the such. Looking good though
Reply
#8

Quote:
Originally Posted by [SR
Arbash™ | ❶❸❸❼ ]
Python Scripting is hard
No it\'s not, it\'s incredibly easy to learn, it\'s typeless, and also has many inbuilt features. Many more than a language like Pawn, anyway.
Reply
#9

Quote:
Originally Posted by [SR
Arbash™ | ❶❸❸❼ ]
Quote:
Originally Posted by ev0lutionnn
No it\'s not, it\'s incredibly easy to learn, it\'s typeless, and also has many inbuilt features. Many more than a language like Pawn, anyway.
What did you said TYPELESS
Typeless means that the variables aren\'t declared with a static type. Example, in a static, strict language like C++, Java, or yes, PAWN, if you declare a variable which stores an integer, it must always store an integer, for the most part (even though there are sometimes ways around this in some bigger languages). In a TYPELESS language a variable can change it\'s type dynamically.

Example, you could declare a variable at the top of the script storing an integer value, than change it to a string, or a double, or even an array or an object, if your really feeling it. Depends how you look at it, dynamic type can confuse beginner\'s quite a bit when it comes to arithmetic and other similar functions.
Reply
#10

Would be another great language to learn, hope its get done .
Reply
#11

Quote:
Originally Posted by iLinx
Depends how you look at it, dynamic type can confuse beginner\'s quite a bit when it comes to arithmetic and other similar functions.
I suppose it depends on where you come from. (programming-wise)
I think Python was one of the first programming languages I learnt, being typeless made it easier for me, and it wasn\'t difficult to learn other non-typeless(?) languages after that, in fact Python really helped.
Reply
#12

True, I suppose it really comes down to who you are, the way you think and the way you learn.
Anyways, I look forward to this project. It\'s about time someone did this, :P
Reply
#13

I\'m currently learning Python, does this mean that you can use Python for the whole script? If so how do you load it onto the SAMP server.
Reply
#14

Quote:
Originally Posted by Samdudes
I\'m currently learning Python, does this mean that you can use Python for the whole script? If so how do you load it onto the SAMP server.
You\'d use the plugin.
Reply
#15

ahh and then script the Python in PAWN.
Reply
#16

You would write your servers code in Python if you were to use this plugin.

Well, you could also use pawn if you wanted to I guess, but python <3
Reply
#17

Interesting. Please could you elaborate about what Python threading would be like?
Reply
#18

Quote:
Originally Posted by Samdudes
ahh and then script the Python in PAWN.
Not really. Python scripts will be completely seperate to everything else.
If you wanted, you could indeed script everything in Python and have no Pawn filterscripts or gamemode running. (although you\'d need the Python filterscript and a blank gamemode)
With that said, there\'s still nothing to stop you using Pawn. You could have both types of scripts running and working perfectly together.
Reply
#19

Welcome to the new forums, everyone. :P
During the downtime, I got threads working, including Pythons thread/threading modules. So, timers (as well as anything else involving threads) now work. Yay.

Now all that\'s left is adding the rest of the native functions, and a lot of testing.
Reply
#20

No news.Is this gonna be released or not?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)