Android Question Porting into B4X

kackle123

Member
I have an Adobe Director project that I would like to port into something modern, like B4X stuff. If I can write code to pull the Director's Lingo-language code out of Director, is it reasonable to think that I can take that text output and convert it into something that B4X can understand?

I have experience with Microsoft's Visual Basic 6 and B4X seems similar. But I am concerned that they both use files that aren't plain text like does the C language and others. In other words, is there a special format I can follow to convert my code into B4X "modules" or "classes" or "procedures", etc.?
 

MicroDrie

Well-Known Member
Licensed User
What the concept of basic and car have in common is that the details differ in detail between different versions with the same description. In addition to the difference in syntactic description of an identical function command, it may also be the case that there is a completely different or no command for an identical function. This leads to a lot of testing of a complex conversion program in addition to a thorough knowledge of both BASIC languages. It seems simpler to me to see what the principle is for a program and then build this principle in the B4X language.
 
Upvote 0

William Lancee

Well-Known Member
Licensed User
Longtime User
I have done some work with Flash and ActionScript, but I only glanced at the verbose version of Lingo before moving on.
I fully agree with @MicroDrie that auto conversion will be extremely difficult.

It is not so much about the language syntax differences or file formats - B4X files are stored as a text file (*.bas).
However, the libraries that provide functionality to Lingo are not the same as the B4X resources and libraries.
This is a old project, so it probably will improve anyway by updating to current resources and methods.

If you decide to implement the functionality of your project with B4X, the B4X ecosystem and its community are here to help.
 
Upvote 0

kackle123

Member
Thank you for your replies. The original Director project is on the simple side: 2D graphics with little animation, some sound effects and reading of the user's mouse clicks (which trigger the simplistic animations and sounds). I'm not looking to write a comprehensive 1-to-1 Lingo-to-B4X conversion, but rather something that reads Director's Score (it directs the sprite positions) and my small number of simplistic Lingo scripts.

I think I can pull this information out of a (uncompiled) Director movie, but once I have "set sprite #1 to 'man.bmp' and draw it at x, y", I was wondering how I might pull off simple drawing/playing of sounds in B4X without manually typing everything into B4X. When I dig into B4X's examples, I see a bunch of Java classes/syntax under the hood, a language I'm not familiar with.
 
Upvote 0

William Lancee

Well-Known Member
Licensed User
Longtime User
Upvote 0

kackle123

Member
Thank you, @William Lancee. I found some separate B4X learning examples on their website a while ago. In the "BouncingSmiley" example's folder, I find no *.bas files. So, if there are supposed to be *.bas files, where are they, and if they don't exist, how does the example work correctly when I have run it before? Do you see what I'm saying; even if I know the B4X language, into which B4X file(s) would I put my converted Lingo/C/Fortran code? That is, I want to try to do this programmatically, not manually typing/pasting everything into the B4X IDE.
 
Upvote 0

William Lancee

Well-Known Member
Licensed User
Longtime User
If you create a class or other module they are named .bas
Each platform, B4J, B4A, and B4i replaces the .bas with .b4j, .b4a, and b4i.

The code is in Smiley.b4a.

However, changing those files is not what I would recommend.

What I suggest is:
1. create as script .txt file that has the sequence of steps you want to do in a format that makes sense to you
2. save it in project\files\ directory (this makes the file a asset to the program and stick with it wherever you put the program.
assets are accessed with File.DirAssets (they not writable by default - so you have to manually put them in \files and register them with 'file manager'
fileManager is in the rightmost panel of the IDE
3. write code to read this file and call subs in B4X to perform those actions

However, it does sound that you are too early in the learning curve to start that process.
Instead start with examples in the Booklets by @klaus
You can download them from Learn->guides link at top of this page.

You could also post a sample script in this thread and ask if anyone would give you an example code to read it.
 
Upvote 0

William Lancee

Well-Known Member
Licensed User
Longtime User
Exactly. I suspect the grammar of the script won't be very complex, so the parser could be simple.

In one of my projects, I created a grammar for describing steps in e-learning courses.
The parser was quite simple, not much more than reading a text file and following 'orders'.
 
Upvote 0
Top