Embedding ScriptBasic in FreeBASIC

User contributed sources that have become inactive, deprecated, or generally unusable. But ... we don't really want to throw them away either.
John Spikowski
Posts: 453
Joined: Dec 24, 2005 2:32
Location: WA - USA
Contact:

Embedding ScriptBasic in FreeBASIC

Post by John Spikowski »

Charles Pegge created an example of embedding ScriptBasic in a FreeBASIC program for the All Basic code challenge.

FreeBASIC Example

To date the following Basic languages have examples showing how ScriptBasic (DLL/so) can be embedded in your application.
  • BCX - Linux & Windows
  • Bacon - Linux
  • thinBASIC - (interpreter) Windows
  • PowerBASIC - Windows
  • FreeBASIC - Windows
  • Oxygen - Windows
jcfuller
Posts: 325
Joined: Sep 03, 2007 18:40

Post by jcfuller »

John,
Why would you want to embed any scripting language?
Why not just use the interpreter itself??

James
aurelVZAB
Posts: 666
Joined: Jul 02, 2008 14:55
Contact:

Post by aurelVZAB »

Yes why someone want embed script basic (which is OK) insted of use
your own interpreter in some app...?
Merick
Posts: 1038
Joined: May 28, 2007 1:52

Post by Merick »

Well, I don't know anything about Script Basic, but if you can give it access to functions written in FB like other scripting languages that I've tried (Lua, etc...) then it would serve the same purpose - easy configuration and prototyping without having to re-compile the main program with every little change made to the scripts
jcfuller
Posts: 325
Joined: Sep 03, 2007 18:40

Post by jcfuller »

Merick wrote:Well, I don't know anything about Script Basic, but if you can give it access to functions written in FB like other scripting languages that I've tried (Lua, etc...) then it would serve the same purpose - easy configuration and prototyping without having to re-compile the main program with every little change made to the scripts
???
Fb calling scriptbasic to call fb functions???

James
John Spikowski
Posts: 453
Joined: Dec 24, 2005 2:32
Location: WA - USA
Contact:

Post by John Spikowski »

Why does Microsoft offer VBA in Word, Excel and other Office applications.

Here is another example of why you might want to embed a scripting engine in FreeBASIC.

APOCALYX 3D & ScriptBasic
jcfuller
Posts: 325
Joined: Sep 03, 2007 18:40

Post by jcfuller »

From the little I know about Lua and it's superb string handling I can
understand using it but a basic using a basic has me baffled. And it's not scriptbasic, I just don't understand why you would want to embed any interpreted basic into FreeBASIC?

James
jcfuller
Posts: 325
Joined: Sep 03, 2007 18:40

Post by jcfuller »

John Spikowski wrote:Why does Microsoft offer VBA in Word, Excel and other Office applications.

Here is another example of why you might want to embed a scripting engine in FreeBASIC.

APOCALYX 3D & ScriptBasic
Nice.
Vba and office is not the same as embedding an interprted basic into a compiled one. I just don't get it.

James
John Spikowski
Posts: 453
Joined: Dec 24, 2005 2:32
Location: WA - USA
Contact:

Post by John Spikowski »

James,

Why would you want to add an interface to a SQL database when the language supports reading and writing to flat files?

ScriptBasic is a plug-in just like any other library offered here. It's LGPL with no strings attached. You may not have a need at the moment but I'm sure some of the other creative programmers here might have a few ideas.

John
Eponasoft
Posts: 264
Joined: Jul 26, 2007 2:40

Post by Eponasoft »

I can see the uses of this, but comparing FB to MSO is like comparing a screwdriver to a laundry basket.
rdc
Posts: 1741
Joined: May 27, 2005 17:22
Location: Texas, USA
Contact:

Post by rdc »

There are numerous reasons why you would want to add scripting to a program. Remember QuakeC, or UnrealScript? The idea is to add extended functionality to a program that does not require a recompile for each change. It also allows users to extend a program without having to wait for the programmer to (who knows when?) add in the functionality.

Suppose you have a roguelike game that uses scripts for the character stats, items and monsters. A player could tweak the scripts so that instead of a fantasy rl, they could play a sci-fi rl, or whatever they wanted, and it wouldn't require wading through someone else's source code or waiting for a new version that may or may not appear.

I could cite example after example, but the point is, this is something good to have, and to have it already packaged up and ready to use is a real plus. I for one, will find this quite handy.
jcfuller
Posts: 325
Joined: Sep 03, 2007 18:40

Post by jcfuller »

I am really out of my league here as I have no idea how game scripting works so please bear with me.

The very spartan example shows me very little on how one would interface in the scenario rdc mentions. Maybe someone could put together a small example?


James
John Spikowski
Posts: 453
Joined: Dec 24, 2005 2:32
Location: WA - USA
Contact:

Post by John Spikowski »

James,

The embedding of ScriptBasic will become more apparent when an example of loading a ScriptBasic program of functions and subs and their called from the host application. You have full access to global and local variables of the script from the host application.

The libscriba.dll/so/dylib is less then 500KB and works with Windows, Linux and OS X using a common SB script.

ScriptBasic Embedding Developer Guide

If you have some time, give it try. You might find a use in your complex train software you do for your client.

John
Eponasoft
Posts: 264
Joined: Jul 26, 2007 2:40

Post by Eponasoft »

Using a scripting language is great for some kinds of game development, provided the scripting language doesn't suck.
John Spikowski
Posts: 453
Joined: Dec 24, 2005 2:32
Location: WA - USA
Contact:

Post by John Spikowski »

I don't know of any other object like scripting solutions that is cross platform and doesn't need a DVD to install it.

ScriptBasic is a typeless traditional Basic syntax that's easy to use.

I use the MySQL DB extension module in ScriptBasic rather then PostgreSQL option. It doesn't mean PostgreSQL sucks. I'm not trying to sell (because it's open source and free) anyone on ScriptBasic. If you know of a better solution, please educate me so I don't continue to waste your time and mine.
Post Reply