SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 16/06/2010, 06:15 AM   #1
ev0lution
Gangsta
 
ev0lution's Avatar
 
Join Date: Jul 2009
Posts: 683
Reputation: 380
Default [DEV] Python for SA-MP


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 :\

Last edited by dugi; 04/07/2010 at 12:41 PM.
ev0lution is offline   Reply With Quote
Old 16/06/2010, 06:24 AM   #2
CJ101
High-roller
 
CJ101's Avatar
 
Join Date: Jan 2008
Location: RevolutionX
Posts: 1,759
Reputation: 162
Default Re: [DEV] Python for SA-MP

:O yayyyyyyy

i cant wait for this

you rock man
__________________
Code:
I'm working on a project. CLICK HERE to join my discord. In short: It's a roleplaying server like no other. warning: in BETA
CJ101 is offline   Reply With Quote
Old 16/06/2010, 09:57 PM   #3
[HUN]Gamestar
Big Clucker
 
Join Date: Aug 2009
Posts: 138
Reputation: 3
Default Re: [DEV] Python for SA-MP

Nice
[HUN]Gamestar is offline   Reply With Quote
Old 17/06/2010, 02:44 AM   #4
joemomma53
Huge Clucker
 
Join Date: Jul 2007
Posts: 463
Reputation: 1
Default Re: [DEV] Python for SA-MP

this shit will be hawt, n1 <3

edit - realised it's not released yet D:
joemomma53 is offline   Reply With Quote
Old 17/06/2010, 08:53 AM   #5
Calgon
Banned
 
Join Date: Jan 2009
Posts: 6,149
Reputation: 1127
Default Re: [DEV] Python for SA-MP

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.
Calgon is offline   Reply With Quote
Old 19/06/2010, 03:35 AM   #6
ev0lution
Gangsta
 
ev0lution's Avatar
 
Join Date: Jul 2009
Posts: 683
Reputation: 380
Default Re: [DEV] Python for SA-MP

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.
__________________
ev0lution is offline   Reply With Quote
Old 19/06/2010, 10:52 AM   #7
kazai
Little Clucker
 
Join Date: Jul 2009
Posts: 18
Reputation: 0
Default Re: [DEV] Python for SA-MP

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
kazai is offline   Reply With Quote
Old 23/06/2010, 10:54 AM   #8
ev0lution
Gangsta
 
ev0lution's Avatar
 
Join Date: Jul 2009
Posts: 683
Reputation: 380
Default Re: [DEV] Python for SA-MP

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.
__________________
ev0lution is offline   Reply With Quote
Old 23/06/2010, 02:46 PM   #9
iLinx
High-roller
 
Join Date: Jun 2009
Location: Toronto
Posts: 1,501
Reputation: 157
Default Re: [DEV] Python for SA-MP

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.
__________________
Servers in Arizona, Virginia, Quebec (Canada), United Kingdom, Netherlands. Over 12,000 served. Free cPanel web hosting is included with ALL servers. ********. *******.
iLinx is offline   Reply With Quote
Old 23/06/2010, 03:03 PM   #10
Mr187
Banned
 
Join Date: Aug 2007
Location: Ottawa, Canada
Posts: 918
Reputation: 11
Default Re: [DEV] Python for SA-MP

Would be another great language to learn, hope its get done .
Mr187 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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 Off



All times are GMT. The time now is 01:22 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.