LScript-to-Python converter

Gorbag

Geist im Maschine
I don't know if anybody might find this useful, but I've put up an LScript-to-Python converter web page. It can be found there:

http://www.bobhood.net:21134/

Enter a script name, and paste your valid LScript code into it, and it will be run through a Python backend that will attempt to convert it into a LightWave Python plug-in.

This is by no means a perfect converter. It simply attempts to get your LScript as near as possible to a usable LightWave Python plug-in. You are going to have to do further work to get it all the way.

Bear in mind some points:

  • Some LScript code will cause the converter to fail.
  • I will continue to work on the converter if/as I have time, but this is provided simply as courtesy.
  • If your script is successfully processed, it is not retained. If it fails for some reason, a copy is cached on the server so that I can use it to identify/correct issues with the converter. If you'd rather not have your code retained for this reason, please do not use the converter. If you're conversion has failed and you do not want a copy of your code cached, please let me know the name of the script you used in your conversion attempt, and I will delete it.
  • This is not officially supported or sanctioned by NewTek. I wrote this as a courtesy to LScript users, and I alone am responsible for it. That said, I am not responsible for damages, perceived or real, that result from your use of this converter.
 
Thanks Bob - just playing around with this.

I found the "conditional expression" operator {x = (4 > 5) ? 6 : 7} needed to be rewritten {x = (4 > 5) if 6 else 7}.

I found also the "post-increment" operator {x++} needed to be expanded {x = 1 + x}.
 
Should be back up now. The server was running, but the page wasn't loading. Don't know what is up with that.
 
I corrected a generation error that Elmar brought to my attention with regard to Generic scripts. They now generate the proper entry function, which is:

def process(self, ga):

instead of:

def generic(self):
 
I found also the "post-increment" operator {x++} needed to be expanded {x = 1 + x}.

I've put in detection and conversion of pre- and post-increment and decrement operators. So, things like:

Code:
++x;
x--;

should convert into:

Code:
x += 1
x -= 1

In addition, it should also handle assignments correctly. For example:

Code:
i = x++;

should produce:

Code:
i = x
x += 1

and:

Code:
d = --x;

should produce:

Code:
x -= 1
d = x
 
Hey Bob!
This is pretty slick and incredibly important to keep alive and accessible to as many people as possible. Are you ok with us posting this on Liberty3d.com as a prominent function and do you need help at all with this?
 
Hey Bob!
This is pretty slick and incredibly important to keep alive and accessible to as many people as possible. Are you ok with us posting this on Liberty3d.com as a prominent function and do you need help at all with this?

Define what you mean by "posting this." Do you mean posting a link to it on other sites?
 
Yup. That's exactly what I mean.
We did something similar with charlot (chco) and his scene fixing utility that converted hosed LWS files into fixed ones for EU LW users who got tied up in the , vs . issue a while back.

On top of that, there are a few Lscripters at L3D who could try help out a bit, specifically alexx, luke and petter as well as james.
 
Thank you!!!!!

This is by no means a perfect converter. It simply attempts to get your LScript as near as possible to a usable LightWave Python plug-in. You are going to have to do further work to get it all the way.

Thank you so much for this. Thanks to your converter, I just learned two new Layout commands that I hope to use in my future scripts:

lwsdk.LWSceneInfo().filename -- the path to the scene file itself.

lwsdk.LWSceneInfo().RGBPrefix -- the render output path.

:boogiedow
 
Yup. That's exactly what I mean.
We did something similar with charlot (chco) and his scene fixing utility that converted hosed LWS files into fixed ones for EU LW users who got tied up in the , vs . issue a while back.

On top of that, there are a few Lscripters at L3D who could try help out a bit, specifically alexx, luke and petter as well as james.

No, I would have no issue with posting just a link to it on other sites.

The reason I've set this up the way I have is so I can have a single location for fixes. I do not want the code scattered to the four winds for this reason. With this arrangement, when I make a fix or enhancement, it is instantly available as long as everybody comes here.
 
Should be accessible again. The server was running, but for some reason, it was not responding. I've restarted it. Sorry for the inconvenience.
 
Back
Top