Hi there, small question: Is there a way to include python functions into simba somehow and combine it with SRL functions? And what about C/C++ or maybe even Java?
Hi there, small question: Is there a way to include python functions into simba somehow and combine it with SRL functions? And what about C/C++ or maybe even Java?
Former Name: MasterCrimeZ.
ToDo: 1. Finish my private bot 2. Make some cool bots for this community 3. Become a member
If you have any questions about scripting, feel free to PM me
@slacky;
New to scripting? Procedures & Functions for Beginners
Do you use your computer at night? Just get f.lux
Feel free to ask me any questions, I will do my best to answer them!
Previously known as YouPee.
There is no direct way of using python within Simba, no.
You can write native libraries in C, C++, FPC, and other languages capable of building dlls, and then call methods in that dll from Simba.
That does not work with python as python is an interpreter language, and so it can't compile into a dll. And even if you did write a plugin wrapping the whole python engine; python represents datatypes in an entirely different way so it would just be painful to use alongside Lape.
Last edited by slacky; 04-11-2016 at 02:52 PM.
!No priv. messages please
I found this thread via google but it didnt help me. Here is the solution I came up with now.
I use Tprocess and Python with the -i parameter to use stdinout.
Code:PYProcess.SetCommandline('C:\Users\Matt\AppData\Local\Programs\Python\Python37-32\python.exe -i'); PYProcess.setOptions([poUsePipes]); //, poNoConsole PYProcess.getParameters.Add('/c'); PYProcess.getParameters.Add('dir /s C:\Users\Matt\AppData\Local\Programs\Python\Python37-32\'); PYProcess.execute; //Do Python stuff and write it readycmd := 'print("hello world from python")'+#10; PYProcess.getInput().Write(readycmd[1],length(readycmd)); //Read Python answer repeat //writeln(AProcess.getOutput().getNumBytesAvailable); count := PYProcess.GetOutput().Read(buf, PYProcess.getOutput().getNumBytesAvailable); until PYProcess.getOutput().getNumBytesAvailable = 0; ss := ''; //read python output for I := 1 to count do begin ss := ss + buf[i]; end; //Here is your python answer writeln(ss);
There are currently 1 users browsing this thread. (0 members and 1 guests)