Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / DarkSDK Script :)

Author
Message
Argon Knight
17
Years of Service
User Offline
Joined: 29th Aug 2002
Location: Gastonia, NC, USA
Posted: 3rd Dec 2004 05:12
I just playing around here but....

Wouldn't it be nice if TGC gave us:

dbScript MyScript = dbCompiler( char * filename);

So we can add the darkbasic compiler to our game and run scripts. The compiler wouldn't need stuff like "sync" and "wait key", or even the draw commands, because our game is handle that part, but little stuff like "dim" and "if".

Being able to pass our own functions into the script runtime would give us TPC like control in our scripts.

MyScript.dbAddTPC( void * functionname);


Just a thought...
Jedive
16
Years of Service
User Offline
Joined: 24th Jan 2003
Location: Spain
Posted: 3rd Dec 2004 06:02 Edited at: 9th Dec 2004 23:11
Why not use Lua? It's the best scripting engine I've seen in ages. I am using using it with a C engine in my project.

[href]www.lua.org[/href]

== Jedive ==
AthlonXP 1600+, 512MB, GeForce4200, WinXP/DX9, Mandrake 10
iBook G4 1Ghz, 256MB, Radeon9200, Mac OS X Panther
OSX Using Happy Dude
16
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 3rd Dec 2004 06:15
Have you got any example code for using Lua ? Would be interesting to have a look.

Walk softly... and carry a big gun...
APEXnow
Retired Moderator
16
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 3rd Dec 2004 06:42
Try these sites for embedded scripting:

NerveBreak - http://nervebreak.sourceforge.net/

ScriptBasic - http://scriptbasic.com/html/index.html


Home of the Cartography Shop - DarkBASIC Professional map importer
IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 3rd Dec 2004 07:42
Or you could try AngelScript : http://www.angelcode.com/angelscript/

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins and source code http://www.matrix1.demon.co.uk
Jedive
16
Years of Service
User Offline
Joined: 24th Jan 2003
Location: Spain
Posted: 3rd Dec 2004 20:01 Edited at: 3rd Dec 2004 20:07
@The Coding Area: Do you mean a sample Lua script, or an example on how to embed Lua into an application?

Doesn't matter, I'll show you both things he he.

A Lua script looks like this:



To embed Lua into your executable, the simplest form is to use toLua++. toLua++ contains a library and a command line tool. The command line tool takes a C header file (in this case it would be "DarkSDK.h"), and generates a .cpp files with the code needed to export the Dark Game SDK fucntions to Lua.

Then, you must create a Lua State, which is a virtual machine capable of running a script:



Of course you would write a better script handler. For example, in my game engine (which is a heavily modified version of Cipher), there are three Lua scripts: ui.lua, game.lua and cgame.lua. Each one runs on its own lua_State. These scripts has a function which works as entry point for the script: the main() function (as in C). The game runtime puts the main() parameters on the Lua stack, and then calls the main() function of the corresponding script.

And another cool way of exporting the funtions to Lua, would be writing a C++ wrapper first with object-oriented code. Then the Lua script would look something like this:



toLua++ website: http://www.codenix.com/~tolua/

If you are serious about using Lua, the Programming In Lua book is simply awesome. You can check it online here, but I highly recommend buying it!: http://www.lua.org/pil/

== Jedive ==
AthlonXP 1600+, 512MB, GeForce4200, WinXP/DX9, Mandrake 10
iBook G4 1Ghz, 256MB, Radeon9200, Mac OS X Panther
OSX Using Happy Dude
16
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 3rd Dec 2004 23:09
I've only really had a quick look at it. Its pretty good though.

Walk softly... and carry a big gun...
Shadow Robert
17
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 3rd Dec 2004 23:51
Dark Game SDK requires DirectX 9.0b
DirectX 9.0b can use something called Visual C# Script. That has built-in protection to prevent 'naughty' scripting.

I'd strongly suggest using that instead.


Login to post a reply

Server time is: 2019-12-13 15:18:03
Your offset time is: 2019-12-13 15:18:03