Embedding ScriptBasic in FreeBASIC

User projects written in or related to FreeBASIC.
John Spikowski
Posts: 453
Joined: Dec 24, 2005 2:32
Location: WA - USA
Contact:

Embedding ScriptBasic in FreeBASIC

Postby John Spikowski » Sep 18, 2009 18:08

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: 324
Joined: Sep 03, 2007 18:40

Postby jcfuller » Sep 19, 2009 9:51

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

James
aurelVZAB
Posts: 339
Joined: Jul 02, 2008 14:55
Location: Croatia
Contact:

Postby aurelVZAB » Sep 19, 2009 14:11

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

Postby Merick » Sep 19, 2009 14:43

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: 324
Joined: Sep 03, 2007 18:40

Postby jcfuller » Sep 19, 2009 15:34

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:

Postby John Spikowski » Sep 19, 2009 16:04

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: 324
Joined: Sep 03, 2007 18:40

Postby jcfuller » Sep 19, 2009 16:05

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: 324
Joined: Sep 03, 2007 18:40

Postby jcfuller » Sep 19, 2009 16:12

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:

Postby John Spikowski » Sep 19, 2009 16:15

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

Postby Eponasoft » Sep 19, 2009 16:17

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

Postby rdc » Sep 19, 2009 17:48

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: 324
Joined: Sep 03, 2007 18:40

Postby jcfuller » Sep 19, 2009 18:10

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:

Postby John Spikowski » Sep 19, 2009 18:49

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

Postby Eponasoft » Sep 19, 2009 19:44

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:

Postby John Spikowski » Sep 19, 2009 20:00

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.

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 5 guests