Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (ozgur, TipmyPip, AndrewAMD), 1,209 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Python Plugin for C-Script #21612
12/30/03 07:49
12/30/03 07:49
Joined: Mar 2002
Posts: 1,123
California
Cellulaer Offline OP
Expert
Cellulaer  Offline OP
Expert

Joined: Mar 2002
Posts: 1,123
California
First Beta version of GSPython.dll is now available. You can write Python code inside your c-script files.

At the moment the only thing you can pass back and forth between Python and Acknex are strings.

Any feedback would be appreciated.

Download Now

Example:

Code:
 
include <gspython.wdl>;

// Define a string for you to use. I default it to 1000 characters here.
string MyPythonString[1000];

text python_txt
{

layer = 1;
pos_x = 50;
pos_y = 50;
strings = 1;
font = standard_font;
string = MyPythonString;
alpha = 100;
flags = narrow, transparent, visible;

}

function EvaluatePython() {

dll_handle = dll_open("GSPython.dll");

// Fill our test string with something
str_cpy(MyPythonString,"123");

// Create and Initialize the Python Engine
Python_Init();

// Link MyPythonString to a string variable defined in Python named AckNexStr.
// Changes to one effect changes to the other.
Python_LinkStr("AckNexStr",MyPythonString);

// Evaluate code.
Python("

# Print goes nowhere right now
print 2+2

# Test the Acknex<->Python string interface
AckNexStr.Value = AckNexStr.Value + '456' + AckNexStr.Value

");

// Free the Python Engine
Python_Free();

dll_close(dll_handle);

}





Buy, Sell, & Archive Realtime 3D Content @ RedRock7.com *BETA* A5.5+ Plugin DLLs: GSADO, GSHTTP, GSImgLst, FreeMod, GSFlash, GSPython http://cellulear.slashbang.com/
Re: Python Plugin for C-Script [Re: Cellulaer] #21613
12/30/03 08:01
12/30/03 08:01
Joined: Aug 2000
Posts: 7,490
O
Orange Brat Offline

Senior Expert
Orange Brat  Offline

Senior Expert
O

Joined: Aug 2000
Posts: 7,490
Why exactly would someone use Python? Just curious, I don't really know much of anything about it. I know Gamespace uses it, so I should probably learn about it. This will be yet another reason.


My User Contributions master list - my initial post links are down but scroll down page to find list to active links
Re: Python Plugin for C-Script [Re: Orange Brat] #21614
12/30/03 08:21
12/30/03 08:21
Joined: Mar 2002
Posts: 1,123
California
Cellulaer Offline OP
Expert
Cellulaer  Offline OP
Expert

Joined: Mar 2002
Posts: 1,123
California
I don't know the Python language either. However, from what I've seen it does give you a lot of options for accessing databases, the file system, data processing, data manipulation, OS information, etc. If you already knew Python it would probably be useful verses having to learn c-script (if/when I get the other Acknex objects accessable via the plugin in Python). Bottom line is that it gives you a lot of the power of C++ or Object Pascal in a scripting language embedded in c-script.

Another example would be that I also have an Object Pascal plugin which functions similarly to the Python plugin (has an Object Pascal interpreter). Personally since I program in Object Pascal all the time it is most benificially to be able to write Object Pascal script right inside my c-script files. I ran read/write INI files, the registry, and whatever else I can think of without having to re-compile a DLL every time. Plus there is support for types, classes, and objects.

Lastly with both languages in the above examples it would allow the user to easily MOD source code for whatever game you distributed (if you allowed them to) via a standardized language. You could have a group of effects files written in Python and the user could add their own effects files (I don't know if c-script can be used in this fashion at design time).

Implimenting Python was requested by a couple users so it wasn't more than the work of a few hours to do.


Buy, Sell, & Archive Realtime 3D Content @ RedRock7.com *BETA* A5.5+ Plugin DLLs: GSADO, GSHTTP, GSImgLst, FreeMod, GSFlash, GSPython http://cellulear.slashbang.com/
Re: Python Plugin for C-Script [Re: Cellulaer] #21615
12/30/03 09:17
12/30/03 09:17
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
Someone asked today how to write a filemanager / explorer in 3D with A6 and the answer referred to the SDK. Within Python and your plugin you get the access to all needed functions and features you need to write something like this.

Re: Python Plugin for C-Script [Re: Cellulaer] #21616
12/30/03 11:18
12/30/03 11:18
Joined: Mar 2002
Posts: 580
San Francisco
clone45 Offline
User
clone45  Offline
User

Joined: Mar 2002
Posts: 580
San Francisco

Holly poop! That's SO cool! Might I ask how you did it? I had considered doing a similar thing for Perl, but it didn't seem like the 3dGameStudio SDK was going to "talk" with my Perl created .dll correctly. It kept saying "Not a GameStudio DLL" (or something similar).

Gracias.
- Bret

Re: Python Plugin for C-Script [Re: clone45] #21617
12/30/03 11:47
12/30/03 11:47
Joined: Mar 2002
Posts: 1,123
California
Cellulaer Offline OP
Expert
Cellulaer  Offline OP
Expert

Joined: Mar 2002
Posts: 1,123
California

Delphi has a Python interface available for it here. I haven't as of yet seen a Perl interface for Delphi.

I'm currently working on implimenting Python access to Entities.


Buy, Sell, & Archive Realtime 3D Content @ RedRock7.com *BETA* A5.5+ Plugin DLLs: GSADO, GSHTTP, GSImgLst, FreeMod, GSFlash, GSPython http://cellulear.slashbang.com/
Re: Python Plugin for C-Script [Re: Cellulaer] #21618
12/31/03 03:15
12/31/03 03:15
Joined: Jan 2003
Posts: 710
T
Templar Offline
Developer
Templar  Offline
Developer
T

Joined: Jan 2003
Posts: 710
now that's coooool!

Re: Python Plugin for C-Script [Re: Templar] #21619
01/01/04 10:22
01/01/04 10:22
Joined: Jan 2002
Posts: 644
USA
tesanders Offline
Developer
tesanders  Offline
Developer

Joined: Jan 2002
Posts: 644
USA
Having used Python on a number of projects, (one of the ACM's electronic journals, two modest game titles, and countless CGI scripts), I'm thrilled to hear that someone's working on this. I always thought Python would make for an excellent scripting language for 3DGS.

Re: Python Plugin for C-Script [Re: Cellulaer] #21620
01/14/04 08:27
01/14/04 08:27
Joined: Mar 2002
Posts: 1,123
California
Cellulaer Offline OP
Expert
Cellulaer  Offline OP
Expert

Joined: Mar 2002
Posts: 1,123
California

Released GSPython v0.91 *BETA*

Added the ability to link Acknex Entities and Particle as Python objects. You can also call custom WDL functions from inside Python.

dllfunction Python_LinkEnt(VarName, VarEntity);
// VarName is the name of the Python variable you are creating.
// VarEntity is the Acknex entity you are linking it to.
// Everything is support except .link.
// Access .min[0..2] with .min0, .min1, .min2
// Access .max[0..2] with .max0, .max1, .max2
// Access .skill[1..48] with .skill1, .skill2, etc.

dllfunction Python_LinkPar(VarName, VarParticle);
// VarName is the name of the Python variable you are creating.
// VarParticle is the Acknex particle you are linking it to.
// Everything is support except .link. and .bmap
// Access .skill[1..4] with .skill1, .skill2, etc.



Buy, Sell, & Archive Realtime 3D Content @ RedRock7.com *BETA* A5.5+ Plugin DLLs: GSADO, GSHTTP, GSImgLst, FreeMod, GSFlash, GSPython http://cellulear.slashbang.com/
Re: Python Plugin for C-Script [Re: Cellulaer] #21621
01/17/04 07:52
01/17/04 07:52
Joined: Mar 2002
Posts: 1,123
California
Cellulaer Offline OP
Expert
Cellulaer  Offline OP
Expert

Joined: Mar 2002
Posts: 1,123
California

Released GSPython 0.92 *BETA*. Also added the source code for download.

Now supports (in Python):
*Entities
*Strings
*Textures
*Bmaps
*Fonts
*Texts
*Panels
*Views


Buy, Sell, & Archive Realtime 3D Content @ RedRock7.com *BETA* A5.5+ Plugin DLLs: GSADO, GSHTTP, GSImgLst, FreeMod, GSFlash, GSPython http://cellulear.slashbang.com/
Page 1 of 2 1 2

Moderated by  adoado, checkbutton, mk_1, Perro 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1