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.

Work in Progress / DarkScript (plugin) for DarkBASIC Pro

Author
Message
Torrey
20
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 28th Sep 2005 09:28 Edited at: 22nd Oct 2005 14:19
Welcome to the DarkScript WIP thread!

This plugin will extend the features of DBPro by offering a scripting engine that borrows concepts from Lua, but at the same time resembles the C language and DGSDK. Since this engine can be used in the same fashion as either of those just languages I believe DarkScript will become a very popular plugin to use!

Features include:

- Ability to load multiple scripts, and even have multiple threads per script to control various objects, AI, and other functions you have in the script.

- Access within the script to different command sets like, DBPro commands, extra rotation commands, string, math, SQL, net, etc. Some of these command sets will be dynamic as well, meaning you can chose in your script whether or not they should be loaded to save memory.

Here's a very generic example of a function in DarkScript:


More complex looking function:


After you load your script into your game/program you would issue a command like the one below to execute the function.

script function "test"

With DarkScript your variables have a wide array of options, below are some examples:



Here's some common keywords you might recognize:

if, for, foreach, while, dowhile, break, continue, return, true, false, null

The entire script command list to this engine is very large, and because of how I designed the framework of this plugin adding new commands is nearly effortless, so suggestions for command set ideas are more then welcome.

Below is the list of commands (dbp):

LOAD SCRIPT script file
Syntax: load script "somefile.gm"
Note: It is possible to load more then 1 script. If a second script loads with a variable or function with the same name, the newest one that is loaded overwrites the old one.

SCRIPT FUNCTION script function name (no returns)
Syntax: script function "somefunc"
Note: Use this command for functions that return no value.

SCRIPT FUNCTION INT script function name (returns a integer)
Syntax: someint = script function int("someintfunc")
Note: Use with functions that return an integer back to DarkBASIC Pro.

SCRIPT FUNCTION FLOAT script function name (returns a float)
Syntax: floatval# = script function float("floatfunc")
Note: Use with functions that return a float value back to DarkBASIC Pro.

SCRIPT FUNCTION STRING script function name (returns a string)
Syntax: stringval$ = script function string("stringval")
Note: Use with functions that return a string back to DarkBASIC Pro.

SCRIPT INT VARIABLE script global variable name (returns a integer)
Syntax: intval = script int variable("some_variable")
Note: To use this function with a variable the variable in the script needs to be declared as global.

SCRIPT FLOAT VARIABLE script global variable name (returns a float)
Syntax: floatval# = script float variable("some_variable")
Note: To use this function with a variable the variable in the script needs to be declared as global.

SCRIPT STRING VARIABLE script global variable name (returns a string)
Syntax: intval = script int variable("some_variable")
Note: To use this function with a variable the variable in the script needs to be declared as global.

SCRIPT SET INT VARIABLE script global variable name, integer value
Syntax: script set int variable "some_variable",521
Note: To use this function with a variable the variable in the script needs to be declared as global.

SCRIPT SET FLOAT VARIABLE script global variable name, float value
Syntax: script set float variable "some_variable",1.213
Note: To use this function with a variable the variable in the script needs to be declared as global.

SCRIPT SET STRING VARIABLE script global variable name, string value
Syntax: script set string variable "some_variable","DarkScript is cool!"
Note: To use this function with a variable the variable in the script needs to be declared as global.

SCRIPT COMPILE TO LIB script file name, script lib name

LOAD LIB SCRIPT lib script file

This early pre-release uses an automated installer, you can download the file by clicking here.


Check out my site!
Torrey
20
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 29th Sep 2005 13:40
I worked so hard on adding some 3D DarkBASIC commands to the script that with all the testing, tweaking, debugging, and repeating I'm starting to feel a little sick. How many rotations can you take in one night?

The best audio plugin for DarkBASIC Pro!
Plays Ogg Vorbis,MP3,FLAC,uncompressed WAV,AIFF,MOD,S3M,XM,and IT files.
Raven
19
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 29th Sep 2005 14:08
can i ask you a question... and i'm extending this to everyone making a scripting language for DarkBASIC Professional, but;

Why the hell does everyone keep using C-Style Structured Languages?!
Not to be funny but if you know C, and want to use it then we'd all just be using Dark GDK and Microsoft's Scripting Languages.

I don't mean to detract from this being a lot of work and another cool scripter, but seriously... is ANYONE going to make a scripting language that actually looks and feels like atleast BASIC if not DarkBASIC!?

Torrey
20
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 29th Sep 2005 18:08 Edited at: 29th Sep 2005 18:10
Here's a spinning cube demo done in DarkScript.

Cube DarkScript source code:


Keep in mind that these DarkBASIC Pro commands are subject to change, I might shove a "db" in front of the command so people know it's a dbpro command. Overall I'm just excited that it's all starting to work from the script!

DarkBASIC Pro source used:


I could have added the sync commands to the script, but I left them at the top of the dbpro source. The script handles the loop and messages, so you can press escape if you want to exit the demo.

--

Quote: "can i ask you a question... and i'm extending this to everyone making a scripting language for DarkBASIC Professional, but;

Why the hell does everyone keep using C-Style Structured Languages?!
Not to be funny but if you know C, and want to use it then we'd all just be using Dark GDK and Microsoft's Scripting Languages.

I don't mean to detract from this being a lot of work and another cool scripter, but seriously... is ANYONE going to make a scripting language that actually looks and feels like atleast BASIC if not DarkBASIC!?"


In my opinion this isn't just happening with people that are writing scripting engines. If you have noticed there has been a trend in the past 3 years or so that keeps bringing the programming community to C-structured languages. Personally I hated them for a long time, mainly because I programmed in assembler so long that I was intimidated by the looks of C/C++ and others. After some use of the C/C++ language I started realizing just how powerful it really was. This kind of structure for DarkScript offers me and others more flexibility and control with the language that was originally limited to a basic structure.

Please don't turn this into a flaming thread, I've worked really hard on this project each day and would like to keep it active.

The best audio plugin for DarkBASIC Pro!
Plays Ogg Vorbis,MP3,FLAC,uncompressed WAV,AIFF,MOD,S3M,XM,and IT files.

Attachments

Login to view attachments
Gen
20
Years of Service
User Offline
Joined: 6th Jul 2004
Location: Oklahoma, USA
Posted: 30th Sep 2005 00:24
Looking good m8, me will be awaiting.

DARK IDE RETURNS - Yes Dark IDE is still a go!!
Raven
19
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 30th Sep 2005 02:09
You don't get my point do you.
If I wanted to C-Style programming ... I WOULD USE FREAKING C++ or C#.

If other wanted to learn programming they wouldn't shell out $50 for a BASIC Programming Language when there are FREE versions of C++ on the internet. This isn't about what the industry is doing. **** the industry!

This is the nitché market who NEED simplicity.
Forcing people to learn 2-3 different language just to make a game when they could just learn one overly complex language in the first place is completely defying the point in people buying Dark Basic Professional.

A reason why Lee's responses about fixing issues with UDTs, Pointers, etc. in DBP for everyone who wants that stuff to use C++ and Dark GDK. I don't use DBP just to have a kick out of using a BASIC language.. to be honest the syntax style is bloated and cumbersome.

I use it because it's an excellent RAD Platform that allows me to worry less about the interaction of my data, and polymorphism-bullcrap of putting together complex programs in 2000 lines when I could do the same damn thing in 200 in DBP.

It saves huge amounts of time, effort and resources.
I don't mind using HLSL, but many people are afraid to touch it because it's C-Style; and they look extremely complex.

So to finally get Scripting languages that everyone is throwing in our face yet another damn language style that new programmers have to learn... imo defeats the entire point in using DBP.

Why should we follow the standards of the industry?

Torrey
20
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 30th Sep 2005 07:24 Edited at: 30th Sep 2005 07:25
Quote: "This is the nitché market who NEED simplicity.
Forcing people to learn 2-3 different language just to make a game when they could just learn one overly complex language in the first place is completely defying the point in people buying Dark Basic Professional."


Trust me on this, this scripting language is not difficult to pick up and learn. Don't let the use of these symbols, {}()[]; scare you.

Quote: "A reason why Lee's responses about fixing issues with UDTs, Pointers, etc. in DBP for everyone who wants that stuff to use C++ and Dark GDK. I don't use DBP just to have a kick out of using a BASIC language.. to be honest the syntax style is bloated and cumbersome.

I use it because it's an excellent RAD Platform that allows me to worry less about the interaction of my data, and polymorphism-bullcrap of putting together complex programs in 2000 lines when I could do the same damn thing in 200 in DBP.
"


I agree with Lee on this issue, there are many more bugs and features that should be added or fixed before worrying about pointers. DarkScript doesn't offer this lower level handling, it is meant to be more of a simple yet powerful scripting plugin for dbpro. The dbpro language is what it is, just like you I enjoy creating games with it.

Quote: "So to finally get Scripting languages that everyone is throwing in our face yet another damn language style that new programmers have to learn... imo defeats the entire point in using DBP.

Why should we follow the standards of the industry?"


Once again there really isn't much extra to learn when it comes to DarkScript, just the use of a few extra symbols, a simple syntax on conditionals, and some new commands that extend the script. In my personal opinion I attempt to follow standards of the industry because at the end of the day it's the industry that writes the checks that helps to pay my bills.

The best audio plugin for DarkBASIC Pro!
Plays Ogg Vorbis,MP3,FLAC,uncompressed WAV,AIFF,MOD,S3M,XM,and IT files.
Raven
19
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 30th Sep 2005 13:43
Quote: "Trust me on this, this scripting language is not difficult to pick up and learn. Don't let the use of these symbols, {}()[]; scare you."


FGS, I work with C/C++/C# Daily. The language complexity isn't what pisses me off. It's the fact I have to use several sodding languages to do the same bloody thing.

And for new programmers, YES that is scary and as I said DEFEATS THE BLOODY POINT IN DBP!

Quote: "I agree with Lee on this issue, there are many more bugs and features that should be added or fixed before worrying about pointers. DarkScript doesn't offer this lower level handling, it is meant to be more of a simple yet powerful scripting plugin for dbpro. The dbpro language is what it is, just like you I enjoy creating games with it."


I don't agree with him. He started implimenting a pointer system, he should finish it or remove it. End of Story!
Also how the hell do you think it's a good idea to have the script as C-Style when your sitting there saying "well I'm trying not to make this complex"

That makes no freaking sense.

Quote: "Once again there really isn't much extra to learn when it comes to DarkScript, just the use of a few extra symbols, a simple syntax on conditionals, and some new commands that extend the script. In my personal opinion I attempt to follow standards of the industry because at the end of the day it's the industry that writes the checks that helps to pay my bills."


What bills are you going to pay with a free plug-in?!
Shouldn't this be about providing a Scripting Language that makes it easier for people to extend this Dark Basic Professional programs without creating thier own scripting system internally that could be quite detramentally slow?

I don't see how forcing them to use a new syntax style is going to help them easily extend the program.

John Carmack didn't create QuakeC to mimic C simply because he got a kick out of it. Neither did Francois Bjorne create C# Scripting for C# simply because it's a wonderful language to program with.

If you look Microsoft use thier MSXML System to create language based Script Systems THAT MIMIC THE LANGUAGE YOU ARE USING.

J# uses a J# Scripter
C# uses a C# Scripter
VB uses a VB Scripter

It's all the same bloody core scripting language MSXML, but the front-end is always altered to the Syntax of that language to provide a much easier integration for programmers.

Hell Lua isn't developed like a C-Style because it's a lovely format to use; they did it because it's based almost entirely within the C-System. They also have a Python variant with oddly seems to be seriously object-orientated, and a PERL variant.

Everyone else has scripting languages designed to mimic the parent script. Why the hell does everyone believe that DBP REQUIRES a C-Style Scripting Language?!

Torrey
20
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 30th Sep 2005 13:53
How about this, keep your opinions to yourself. You're starting to boil my blood by using this thread to cause unnecessary problems (which is starting to feel like an attack against me). Please remove your statements from this thread, unless you have something useful to say about the work I've done after I release it. MODS I'd appreciate a little help here by removing his useless content.

The best audio plugin for DarkBASIC Pro!
Plays Ogg Vorbis,MP3,FLAC,uncompressed WAV,AIFF,MOD,S3M,XM,and IT files.
Raven
19
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 30th Sep 2005 14:50
If your going to do something that has been done numerous times before, forgive me for not jumping for joy at seeing yet another Scripting language that once again means harder integration between Scripting and Dark BASIC Professional.

It's stupid really, given you don't even care that perhaps there is a fact that this could be an issue for some people.

Look around the forum. Sure people Marvel each time a new one of these or anything new shows up. Yet how many people are actually using them?

You can't even offer a valid arguement to WHY this is C-Style.
"Because the Industry does it and the Indstry pays the bills."

Is not a valid counter-argument on the subject. Your not serveing a market who cares what the industry can do past the end-result of thier actions.

People don't care if they can make a Normal Map Shader by a single command, provided it looks the same as Doom 3 they're as smiten as kittens. If your not thinking about your primary market then instantly, who cares what the industry is doing; you'll fall flat on your face in terms of business decisions. As it is a poor one that doesn't supply something the market needs rather than wants.

CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 30th Sep 2005 15:31
Quote: "I don't mean to detract from this being a lot of work and another cool scripter, but seriously... is ANYONE going to make a scripting language that actually looks and feels like atleast BASIC if not DarkBASIC!?"


have you heard about XScape?

Torrey
20
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 30th Sep 2005 15:45 Edited at: 30th Sep 2005 15:52
Quote: "If your going to do something that has been done numerous times before, forgive me for not jumping for joy at seeing yet another Scripting language that once again means harder integration between Scripting and Dark BASIC Professional.

It's stupid really, given you don't even care that perhaps there is a fact that this could be an issue for some people.

Look around the forum. Sure people Marvel each time a new one of these or anything new shows up. Yet how many people are actually using them?

You can't even offer a valid arguement to WHY this is C-Style.
"Because the Industry does it and the Indstry pays the bills."

Is not a valid counter-argument on the subject. Your not serveing a market who cares what the industry can do past the end-result of thier actions.

People don't care if they can make a Normal Map Shader by a single command, provided it looks the same as Doom 3 they're as smiten as kittens. If your not thinking about your primary market then instantly, who cares what the industry is doing; you'll fall flat on your face in terms of business decisions. As it is a poor one that doesn't supply something the market needs rather than wants."


This thread isn't about arguing why I decided to use C-Style structure for a script format. Any design format I choose is my decision. When I post examples feel free to look at them. If you decide it's not something you'd like to use, then maybe post a critism about what you found while testing. If you chose to use it, then great, leave me some feedback!

The integration between the two (script and dbpro) is very tight and seperate at the same time. For example, the script engine only binds dbpro commands that are currently available instead of attempting to load the entire set and causing the user to put a lot of useless dbpro commands at the end of their source code to get the libraries included. The engine also makes available the ability to return strings, integers, and floats back to dbpro. I have been making use of Olly for this project as well to make sure the entire thing is extremely seamless and without bugs. So far in all tests the use of my scripts function at very good speeds, this is why I'm scrambling to get more work done to provide examples to show the results.

I work in the programming industry, that is why I said they pay the bills. Whether or not I decide to make my plugins free, I still get paid and bring home money for the work I've done.

As far as a market for scripting plugins goes for DarkBASIC Pro, it's looking a little slim. Once I upload more examples people will really see the capabilities this engine has when combined with dbpro.

[edit]
Extra piece of info I don't think anyone has seen about this engine is that in the script anything that is outside of the function blocks will execute when the script loads (currently), so the format doesn't have to look like C-style completely!

The best audio plugin for DarkBASIC Pro!
Plays Ogg Vorbis,MP3,FLAC,uncompressed WAV,AIFF,MOD,S3M,XM,and IT files.
Raven
19
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 30th Sep 2005 23:32
Quote: "have you heard about XScape?"


Rememeber seeing the post heading and thinking it was like some mapping tool; because Freddix also released something called XScape that was a matrix editor or something.

Just checked out the thread and all of the links are dead.
Couldn't even find much about it really, what it looks like or the design. Most of the chat is about it not working.

Quote: "This thread isn't about arguing why I decided to use C-Style structure for a script format. Any design format I choose is my decision. When I post examples feel free to look at them. If you decide it's not something you'd like to use, then maybe post a critism about what you found while testing. If you chose to use it, then great, leave me some feedback!"


Great.. so how about PUTTING UP A DEMO THEN.
Until then I'm going to keep bitching about what I can see rather than what I've used.

I know the design decisions are up to you, but out of the 4(5 including yours) Scripting Engines I've seen over the past years for DBP. None have really peaked my interest much.

Currently I'm using David-T's LUA for the AI System in Deliverance, but quite honestly I hate it. Sure it's quite but it STILL is forcing me to change pipelines between programming the engine itself and programming the externally upgradable parts.

I'm at that point where quite frankly I was much happier using my Script Compiler that used DBP Syntax that compiled all of my scripts to OpCodes that used a DLL to access everything available in DBP. It was one hell of a lot of work to do, and wasn't exactly a quick solution because each time I needed a new script done I would have to recompile it. My compilers have never been anything of particular speed so it takes a while.

This is on-top of the DBP Compile speed which isn't exactly quick itself for later projects.

When your talking about nitché markets for products, your talking about a handful of people, basically like me who could be using your product.

I asked you several times if you could add WMA to your Audio Plug-in because until you do it's pointless for what I want. Not only like here have you dismissed the request but you've also completely ignored it was made in the first place.

What good is making something if your not going to spend time to listen to what your comsumers actually want. I can't exactly see a swarm of other people in this thread ewcited about this.

PowerSoft
20
Years of Service
User Offline
Joined: 10th Oct 2004
Location: United Kingdom
Posted: 1st Oct 2005 12:20 Edited at: 1st Oct 2005 12:21
Torrey, If you did want to consider turning it to BASIC style then just convert it to c style at compile if whats worrying you is where codeblocks start and end...

eg>

if x=1 then
print x
endif

convert it to>
if x=1
{
print x
}

[edit, this will obviously effect the time]

also the point Raven is saying about C style syntax is a valid point. However there are stages where having it C style would mean you could copy a function straigh from C without needing to change it much. There are for and against points.


Raven, you have made some valid points but just chill yeah? He (or she) has spent time on this and belittling it is unfair. At the end of the day it is personal prefernece.

Torrey
20
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 1st Oct 2005 13:18
Before starting this project I looked at the choice of scripting libraries available, read lots of user reviews of each, downloaded and tested the libraries, and finally decided to build upon GameMonkey Script. Even though I have added my own user object types to the engine itself it would be very difficult to go through the entire GM source to edit for syntax changes. This project will unfortunetly stay with a C-style syntax, but I believe that the speed and feature set of this plugin will exceed the idea of using the syntax.

As you can see from the first example I uploaded I wanted to test the speed ability from executing pure dbpro commands against it's native binary. The speed turned out to be the same or 1-5 fps higher, I was more then happy with the results.

Just this week alone I've put in more then 40 hours working on this plugin. I've built so much on top of the engine that I'm too far into the project to even want to turn back. Like what you saw with my audio plugin it'll work with dbpro seamlessly. I personally test each function all the way down to the assembler level by using ollydbg to make sure the data isn't getting screwed up along the way.

So please forgive my use of the c-style and enjoy the plugin as it is, you might end up really liking it!

The best audio plugin for DarkBASIC Pro!
Plays Ogg Vorbis,MP3,FLAC,uncompressed WAV,AIFF,MOD,S3M,XM,and IT files.
Seppuku Arts
Moderator
20
Years of Service
User Offline
Joined: 18th Aug 2004
Location: Cambridgeshire, England
Posted: 1st Oct 2005 13:27
Quote: " can i ask you a question... and i'm extending this to everyone making a scripting language for DarkBASIC Professional, but;

Why the hell does everyone keep using C-Style Structured Languages?!
Not to be funny but if you know C, and want to use it then we'd all just be using Dark GDK and Microsoft's Scripting Languages.

I don't mean to detract from this being a lot of work and another cool scripter, but seriously... is ANYONE going to make a scripting language that actually looks and feels like atleast BASIC if not DarkBASIC!?"


Hell must of frozen over today, because I am agreeing with Raven

I know it looks like a great set of work, great principle, personally I would prefer an easy bit of script in DB style, because really people buy DB for the easiness.

Alternatively, opposing to Raven's thought, I understand people use DBP to learn the principle of programming, and the C++ like bits direct them closer to learning C++, so really most of these dlls are directed at them, wonder if someone will care about us *sobs*

The name is back dudes!
http://seppukuarts.afraid.org
xtom
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Ireland
Posted: 1st Oct 2005 18:12
What is the story with these scripting things? I have no idea why I might need it. You say it has this feature and that feature but what exactly is the purpose for using it in the first place? It seems to me like it's a programing language within another language. Why not just make plugin commands through dlls to do stuff that can't be done in DBPro. I could still code in a BASIC style and it's much easier for someone like me and other users that use DBPro for it's simplicity.

It seems to me that if you want to go deeper and more complex it would make more sense for someone to just use C or C++ or DarkGDK or something. I don't want to sound discouraging though because I'm sure what your doing is good and anything that adds more flexibility to DBPro is surely a good thing but I just don't get these scripting things and wouldn't want to spend time learning the syntax or whatever.

David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 1st Oct 2005 18:28
Xtom - I've made a Lua plugin that has a variety of uses. As well as making games moddable, it simplifies AI, provides a wonderfully flexible data storage system (to make up for DBPro's lacklustre arrays), and it's wonderful for data description. Reading/writing level files / save games etc. has never been so easy

Torrey - interesting dll. I have competition

"A book. If u know something why cant u make a kool game or prog.
come on now. A book. I hate books. book is stupid. I know that I need codes but I dont know the codes"
xtom
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Ireland
Posted: 1st Oct 2005 22:07
Quote: "Reading/writing level files / save games etc. has never been so easy"


I find these are easy enough things to do in DBPro without using a scripting plugin.

I can see how it would allow you to make games more moddable though. Allowing people to customise AI and changing the game mechanics but I don't think any games I make will ever reach a level where they would need to be moddable to that degree. Anyways that's just me, good luck to you both with your projects.

Torrey
20
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 2nd Oct 2005 02:14
Quote: "I've made a Lua plugin that has a variety of uses. As well as making games moddable, it simplifies AI, provides a wonderfully flexible data storage system (to make up for DBPro's lacklustre arrays), and it's wonderful for data description. Reading/writing level files / save games etc. has never been so easy

Torrey - interesting dll. I have competition"


My plugin has the same exact features as your Lua one, although with this c-style it's making me feel like I'm working with DGDK. You do have one up when it comes to competition of plugins, you're a lot better at creating nice demos.

Quote: "I find these are easy enough things to do in DBPro without using a scripting plugin.

I can see how it would allow you to make games more moddable though. Allowing people to customise AI and changing the game mechanics but I don't think any games I make will ever reach a level where they would need to be moddable to that degree. Anyways that's just me, good luck to you both with your projects."


Both my plugin and David's offer something that is precious to dbpro and that is speed. If you code your own routines in dbpro you are more likely to slow your game/program down thus taking away from its full potential.

When it comes to the idea of whether or not you'll use a plugin like this, it all depends on the type of game/program you create. If you create something small and simple, then I'd say it is much easier to stick with just the dbpro language. If you were working on a much larger project then a plugin like mine would definetly come in handy, it can control lots of different aspects of the game including; character movement and control, different entity behaviors, inventory handling, and things like saving/loading games. Lots more things are possible, but it's only as powerful as the users imagination.

--

On another note, the development took big strides this weekend even though at times I got caught in a bind. I finished off another 3-4 dbpro commands for working with the scripts. There is still a lot more dbpro commands to include, and other various bindings (file, net, string, etc) that will create a bigger command set. The plugin is very usable at this point, but I'm holding off just a little longer to get more work done.

The best audio plugin for DarkBASIC Pro!
Plays Ogg Vorbis,MP3,FLAC,uncompressed WAV,AIFF,MOD,S3M,XM,and IT files.
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 2nd Oct 2005 12:15
I'd be careful including DBPro commands. I'm not sure how happy Mike J would be with somebody exporting all his commands to a scripting language - then it's trivial for somebody to create a thin wrapper that simply loads a script into a DBPro app. And you've then got a free version of DBPro

Dark SDK does have a similar license, stating you can only make games with it.

"A book. If u know something why cant u make a kool game or prog.
come on now. A book. I hate books. book is stupid. I know that I need codes but I dont know the codes"
Torrey
20
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 2nd Oct 2005 15:52 Edited at: 2nd Oct 2005 15:52
Quote: "I'd be careful including DBPro commands. I'm not sure how happy Mike J would be with somebody exporting all his commands to a scripting language - then it's trivial for somebody to create a thin wrapper that simply loads a script into a DBPro app. And you've then got a free version of DBPro

Dark SDK does have a similar license, stating you can only make games with it."


That is definetly true, in reality the commands I put in the script so far are the ones most needed with scripts: some commonly used object commands (after the object has been loaded), camera commands to get location and distance, screen fps, printing commands, and maybe a couple other things I can't remember since I just woke up. The most a person could do if someone decided to make a thin wrapper is print text and display fps of a black screen.

The best audio plugin for DarkBASIC Pro!
Plays Ogg Vorbis,MP3,FLAC,uncompressed WAV,AIFF,MOD,S3M,XM,and IT files.
Torrey
20
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 2nd Oct 2005 22:46 Edited at: 3rd Oct 2005 00:30
I ended up using that free dwarf model that David used to see what I could make him do. It would be really nice if the guy that created the dwarf would convert more of his free models to the X format, they are excellent work!

Alright, in this rinky dink demo you use the arrow keys to move around. The dwarf will randomly walk and idle around the matrix, if you get within a distance of less than 10 units from him he'll start one of his attacks.



[edit]
I added in some extra error control for displaying the errors in scripts after the plugin attempts to load the script.

The best audio plugin for DarkBASIC Pro!
Plays Ogg Vorbis,MP3,FLAC,uncompressed WAV,AIFF,MOD,S3M,XM,and IT files.

Attachments

Login to view attachments
Torrey
20
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 9th Oct 2005 19:50 Edited at: 10th Oct 2005 15:07
Due to the demand for this plugin I've decided to do an early pre-release to let users play around with what is already created. Even though I haven't had any problems with normal usage I expect there to be bugs with this release.

Below is the list of commands (dbp):

LOAD SCRIPT script file
Syntax: load script "somefile.gm"
Note: It is possible to load more then 1 script. If a second script loads with a variable or function with the same name, the newest one that is loaded overwrites the old one.

SCRIPT FUNCTION script function name (no returns)
Syntax: script function "somefunc"
Note: Use this command for functions that return no value.

SCRIPT FUNCTION INT script function name (returns a integer)
Syntax: someint = script function int("someintfunc")
Note: Use with functions that return an integer back to DarkBASIC Pro.

SCRIPT FUNCTION FLOAT script function name (returns a float)
Syntax: floatval# = script function float("floatfunc")
Note: Use with functions that return a float value back to DarkBASIC Pro.

SCRIPT FUNCTION STRING script function name (returns a string)
Syntax: stringval$ = script function string("stringval")
Note: Use with functions that return a string back to DarkBASIC Pro.

SCRIPT INT VARIABLE script global variable name (returns a integer)
Syntax: intval = script int variable("some_variable")
Note: To use this function with a variable the variable in the script needs to be declared as global.

SCRIPT FLOAT VARIABLE script global variable name (returns a float)
Syntax: floatval# = script float variable("some_variable")
Note: To use this function with a variable the variable in the script needs to be declared as global.

SCRIPT STRING VARIABLE script global variable name (returns a string)
Syntax: intval = script int variable("some_variable")
Note: To use this function with a variable the variable in the script needs to be declared as global.

SCRIPT SET INT VARIABLE script global variable name, integer value
Syntax: script set int variable "some_variable",521
Note: To use this function with a variable the variable in the script needs to be declared as global.

SCRIPT SET FLOAT VARIABLE script global variable name, float value
Syntax: script set float variable "some_variable",1.213
Note: To use this function with a variable the variable in the script needs to be declared as global.

SCRIPT SET STRING VARIABLE script global variable name, string value
Syntax: script set string variable "some_variable","DarkScript is cool!"
Note: To use this function with a variable the variable in the script needs to be declared as global.

This release uses an automated installer, you can download the file by clicking here.

[I will now edit this message to include very simple scripts so you get an idea of how the script format works and know how to perform basic things with this script engine. If you have any questions feel free to ask!]

[example 1 - cube script]


[example 2 - dwarf script from the above post]


[example 3 - Use of the keyword 'for']


My wife wants me to come to the park, so I'll put some more examples up later. Have fun playing with this!

The best audio plugin for DarkBASIC Pro!
Plays Ogg Vorbis,MP3,FLAC,uncompressed WAV,AIFF,MOD,S3M,XM,and IT files.
Louiz ofRohr
20
Years of Service
User Offline
Joined: 11th Nov 2004
Location:
Posted: 10th Oct 2005 02:13
Quote: "And you've then got a free version of DBPro "

Make it shareware How about U$50,00?

Another great work from you, Torrey!
Keep it up..

The worst foe lies within the self..

>WorstGame<
Torrey
20
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 10th Oct 2005 15:55 Edited at: 11th Oct 2005 08:49
Quote: "Another great work from you, Torrey!
Keep it up.."


Thanks for the comments!

----

I upload a new beta that is now packed with lots of extra commands for the scripting engine. Included in this release is the SQLite binding.

Here's an example script for the SQL script commands:

DarkScript source


DBPro source


Today/Tonight I'll be working on a new dbp command that will allow for dynamic parameters to be passed to functions. It's an extremely helpful feature that will help you integrate dbp and DarkScript even more. Even in the example above with SQL, it'd be even more useful to directly transfer values to and from dbpro instead of using global script variables all the time.


Check out my site!
Torrey
20
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 12th Oct 2005 08:54
I have put up a website for my works, and maybe other people can join in the fun as well.

http://darkbasicpro.blackgate.us

If you're wondering what the status is with the updates to my scripting plugin...I haven't had the opportunity to write any updates, but in another hour or so I'll be scripting out another SQL example using more then one data type. DBPro & scripting commands will be added as needed.


Check out my site!
Torrey
20
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 22nd Oct 2005 14:17
I finished off a very important update. You can now compile scripts to bytecode, and load them.

The new DarkBASIC Pro commands are:

SCRIPT COMPILE TO LIB script file name, script lib name
LOAD LIB SCRIPT lib script file

The setup file has been updated for this new addition, click here to download the beta of DarkScript.


Check out my site!
Maleck
20
Years of Service
User Offline
Joined: 12th May 2004
Location: US
Posted: 24th Oct 2005 05:56
This is sounding really interesting. i have been watching David's Lua plugin with great interest, and will keep up with this one as well.

Thanks for the effort.
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 24th Oct 2005 16:35 Edited at: 24th Oct 2005 17:19
Nice . May I ask, is it possible to call the script functions from within the script? Also, are you planning to add passing of values into functions a feature?.

The way that I would want to use a plugin like this, is not to use the DBPro commands directly from within it, but to be able to call functions in the DBPro code. While this may be hard/impossible for you to do directly (if it isn't, please impliment !), I figure it wouldn't be that hard to do indirectly.

In the program I would want to use it in (Blackout community project) I have already implimented basic console commands that can be called to do certain things (explode objects, draw text, move players). Anything that I would want users to be able to script would be accessable by those functions, but your plugin would be ideal for users to code logic into their scripts. Here is an example of what I would like to do.

Update is the central function, the call to this is hardcoded into the program. Users can add calls to their functions within this function. It would be good to be able to store functions in separate files (is this possible?). The globals would be used to pass functions in and out of the DBPro program. It would be good to be able to have dynamic arrays (in this example, changing numbers of players).

mainScript.txt


userScript.txt


Etc. I would then read the functionCalled[] array in DBPro, and plug the values stored in there straight into the console. Dynamic arrays would be essential, given the above is just a pseudo code of how it might happen .

Maleck
20
Years of Service
User Offline
Joined: 12th May 2004
Location: US
Posted: 24th Oct 2005 19:52
I like your thinking, Hamish
Torrey
20
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 25th Oct 2005 00:29
Quote: "May I ask, is it possible to call the script functions from within the script? Also, are you planning to add passing of values into functions a feature?"


You can call script functions from within the script, even passing params to those functions from within the script, but I haven't coded the dbpro commands that will pass params with functions called from dbpro yet. Know what I mean there?

Quote: "The way that I would want to use a plugin like this, is not to use the DBPro commands directly from within it, but to be able to call functions in the DBPro code. While this may be hard/impossible for you to do directly (if it isn't, please impliment !), I figure it wouldn't be that hard to do indirectly."


The memory address of your functions within your dbpro code will be different for every machine the game runs on, even though this is hackable I wouldn't go that extreme. It's much easier to create that needed function in DarkScript. Since I imagine you don't want these functions editable by a user, just create a seperate tool to compile those scripts that you don't want changed.

Quote: "In the program I would want to use it in (Blackout community project) I have already implimented basic console commands that can be called to do certain things (explode objects, draw text, move players). Anything that I would want users to be able to script would be accessable by those functions, but your plugin would be ideal for users to code logic into their scripts. Here is an example of what I would like to do.

Update is the central function, the call to this is hardcoded into the program. Users can add calls to their functions within this function. It would be good to be able to store functions in separate files (is this possible?). The globals would be used to pass functions in and out of the DBPro program. It would be good to be able to have dynamic arrays (in this example, changing numbers of players)."


You can store other functions and globals in multiple files. When you load a script it adds it to the virtual machine. To grab the value of one of your script globals in dbpro you'd use the command script int|float|string variable "somevariable". I'm not sure about changing the size of arrays, but I'll check into it. For your example of changing the number of players you could set the global variable from dbpro, then call some function in the script or your dbpro code to handle the after effects.


Check out my site!
Torrey
20
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 31st Oct 2005 07:09 Edited at: 31st Oct 2005 07:24
I have completed a way to pass params to DarkScript functions by use of a new dbpro command, which is:

SCRIPT EXECUTE script command
Syntax: script execute "PrintString("Testing");"
Note: Other way to write the command above would be script execute "PrintString(`Testing`);"

Using this new command it will now be possible to pass params to your functions written in DarkScript. I have included a quick example of how to do this with this posting. Here's the source code:

DarkBASIC Pro Source


Variables.gm Source Code


Also, the updated DarkScript Beta with this update can be found by clicking here.


Check out my site!

Attachments

Login to view attachments
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 31st Oct 2005 11:50
Nice one .

Quote: "The memory address of your functions within your dbpro code will be different for every machine the game runs on, even though this is hackable I wouldn't go that extreme. It's much easier to create that needed function in DarkScript. Since I imagine you don't want these functions editable by a user, just create a seperate tool to compile those scripts that you don't want changed."


Many of the functions cannot be scripted, as they alter the central engine data stored in UDT arrays in DBPro. However, your plugin would illiminate the need to hardcode the really high level functions, like game modes or extra visual effects. I didn't really expect calling DBPro functions to be feasable, so it doesn't matter .

Quote: "You can store other functions and globals in multiple files. When you load a script it adds it to the virtual machine. To grab the value of one of your script globals in dbpro you'd use the command script int|float|string variable "somevariable". "


Sounds good!

Quote: "I'm not sure about changing the size of arrays, but I'll check into it. For your example of changing the number of players you could set the global variable from dbpro, then call some function in the script or your dbpro code to handle the after effects."


I'm not really sure what you mean. I could for example, set a flag to show that I want a certain player's data, and wait one loop for DBPro to pass the data to the DarkScript, but that would be a big pain to code. It would be much easier to allow expandable/shrinkable arrays to store data (eg. player), and have DBPro syncronise the DarkScript and DBPro data once every loop.

Torrey
20
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 31st Oct 2005 12:43 Edited at: 31st Oct 2005 14:30
I found what your looking for, check out this example:

global something = array(2);
something[0] = 101;
something[1] = 102;
something.Resize(3);
something[2] = 103;


It is even possible to have multidimensional arrays!

One feature of my plugin that you could most definetly find a use for is tables, because it creates a class type system (kind of like what you see in C++). Structures similar to the ones below:

Player.Health.Self
Player.Health.Armor
Player.Weapon.SniperRifle.Ammo
etc...

Example of the table setup:

global Player = table(Weapon = table(SniperRifle = 0, Axe = 0),Health = table(Self = 100, Armor = 20));

For future reference here's the list of script commands dealing with arrays:

Quote: "
Size
Brief: Size will return the current size of the fixed array
Return: int array size
Example: array_size = something.Size();

---------------------------------------------------------------------

Resize
Brief: Resize will resize the array to a new size
Param: int size optional (0)
Return: null
Example: something.Resize(10);

---------------------------------------------------------------------

Shift
Brief: Shift will shift slide the array elements by a delta, nulls are shifted in
Param: int delta
Return: null
Example: something.Shift(1);

---------------------------------------------------------------------

Move
Brief: Move will perform a non destructive move on the array
Param: int dst
Param: int src
Param: int size
Return: null"



Check out my site!
Torrey
20
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 1st Nov 2005 07:09 Edited at: 1st Nov 2005 07:25
Here's a script I threw together while sitting here at work for an AI bot evaluating if his/her weapon is right for the situation or not.



Using decision scripts like this one can make it possible for enemies in the game to have attack personalities, or any other behavior that your game would need. Several factors could be used to make the script more complex depending on how you are controling the internal features of your game. For example if you were creating a fairly complex FPS game I'd suggest making the evaluating weapon function more complex and analytical to save processing time.


Check out my site!
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 5th Nov 2005 18:39
Nice! Now I just have to figure out the best way to integrate with the engine. Nice job.

adr
21
Years of Service
User Offline
Joined: 21st May 2003
Location: Job Centre
Posted: 6th Nov 2005 23:26
It's really cool to see that DBP is maturing in this way. I share the same concerns as David T in that if TGC get a little edgy about what's possible with this plugin, development could be restricted.

If I can be perfectly honest about what I'm looking for in a scripting language, then it would be to keep the 3D stuff to DBP. Controversial I know, but the scripting language should focus on being stable and fast with the complex storage types. DBP should call the engine routines based on what the scripting functions return.

Just some thoughts there. Needless to say, if your scripting language fits the bill then I'll just use it in my own way and still be happy.

Good work.

New 'n' Improved sig details how little I accomplish
Torrey
20
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 7th Nov 2005 05:50
Quote: "Nice! Now I just have to figure out the best way to integrate with the engine. Nice job."


Thanks, if you need any ideas or help let me know.

Quote: "It's really cool to see that DBP is maturing in this way. I share the same concerns as David T in that if TGC get a little edgy about what's possible with this plugin, development could be restricted.

If I can be perfectly honest about what I'm looking for in a scripting language, then it would be to keep the 3D stuff to DBP. Controversial I know, but the scripting language should focus on being stable and fast with the complex storage types. DBP should call the engine routines based on what the scripting functions return.

Just some thoughts there. Needless to say, if your scripting language fits the bill then I'll just use it in my own way and still be happy.

Good work."


The 3D commands will be in place for you to use. Even though this was meant as a beta release from the testing done so far it's just as fast as dbpro or faster sometimes, and really hasn't crashed once, unless you count the error control messages I've added in the plugin. At this point there is a lack of documentation so if you need to know if the scripting plugin contains certain features or functions just ask.

Development continues with this plugin, right now the current tasks are getting the dbpro functions generated so the rest of the commands can be binded to the script.

I'm also curious as to whether or not dbpro can handle more then 1 thread running dbpro code, most likely I will do some testing to find out what the result is. If a test would work with this idea it would be possible for me to use the thread features of my plugin to automate enemy/character ai without needing the person using the plugin to keep calling the functions needed for character ai.


Check out my site!
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 8th Nov 2005 19:55
Can you have table-arrays as such? Ie. UDT arrays like:

Player[i].position.x = 10;
Player[i].weapon = "Pistol";

Torrey
20
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 8th Nov 2005 20:26 Edited at: 8th Nov 2005 20:26
Sure can. Here's how it looks:

global Player = table(Position = table(X = 0, Y = 0, Z = 0),Weapon = "Pistol");

Then using script commands you can refer to those values the same way you did above.

Player.Position.X = 10;
Player.Weapon = "Pistol";


Check out my site!
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 8th Nov 2005 21:33
Oops, sorry, I didn't mean that! It took [ i ] to be an italics tag. I mean't something like this...



Torrey
20
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 8th Nov 2005 22:50 Edited at: 8th Nov 2005 22:50
Here's the code to do what you need. Remember that you need to have the array one size larger then the total number of items you'll be adding. Understand what I mean?




Check out my site!
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 8th Nov 2005 23:00
Ahh, I see now. Thanks.

Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 8th Nov 2005 23:23 Edited at: 8th Nov 2005 23:34
Hmm, I've run into another problem. Is there any way to be able to pass parameters into a script function from DBPro (a la SCRIPT EXECUTE), but to also return a value to DBPro?

Also, when I try to retreive the value of an array slow using script string variable(), it just returns null. Ie.



Torrey
20
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 9th Nov 2005 00:41 Edited at: 9th Nov 2005 07:08
Looks like I might need to make an adjustment sometime soon to the retreiving of a string for arrays if I can.

For now you might want to use a temporary buffer variable.

Example:

script execute "global tempbuf = test[0];"
var$ = script string variable("tempbuf")

[edit]

After thinking a lot about this subject it'll be much easier to keep it the way it is by using a temporary buffer for arrays. I chose to keep it this way because fixing this problem would require changing several places in the core source code and the overall code increase would outweigh the code used to perform the above operation.


Check out my site!
PowerSoft
20
Years of Service
User Offline
Joined: 10th Oct 2004
Location: United Kingdom
Posted: 9th Nov 2005 17:56
Looking REALLY REALLY good.


Good Job!

Torrey
20
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 10th Nov 2005 20:37
Quote: "Looking REALLY REALLY good.


Good Job!"


Thanks! If you use this with any of your projects, or just playing around with the scripting language let me know if you need help of any kind.


Check out my site!
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 13th Nov 2005 22:36
I've been trying to integrate your plugin with BlackOut, but the SCRIPT EXECUTE command seems to be causing some problems. I am calling it about 20 times in a loop, and the frame rate has slowed down significantly (halved) and the program often freezes for seconds, or even tens of seconds at a time. Surely this command should really be no different than the script executing a line? Here is an example program, it runs very slowly and the frame rate is very jittery:



Torrey
20
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 14th Nov 2005 07:52
The reason why it was slow for you was that the beta you have is getting a bit outdated and there was binding commands in the SCRIPT EXECUTE function. Who knows why I had them there a while ago? I updated the plugin a long time ago, but didn't upload it yet since I was waiting for Ian to contact me back.

The link at the beginning of this thread has been updated, reinstall overtop the plugin and it will update itself. You will see the difference.


Check out my site!

Login to post a reply

Server time is: 2024-11-23 17:08:30
Your offset time is: 2024-11-23 17:08:30