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 / Scripting System (LightBasic) :-)

Author
Message
Digital Dragon
19
Years of Service
User Offline
Joined: 17th Dec 2004
Location: ...
Posted: 24th Apr 2005 23:46
I am currently working on a simple scripting system based on Dark Basic but now i neeeds some moee help,since I had some help at the beggining

I would like it if someone could maybe help on some of the commands and also if anyone knows a dll that could let me run one file in another programme since so far in mine to compile it you have to input the drive and filename of the file.....

This isn't meant to be a team request and a zipped file of light basic so far is on this site - http://www.freewebs.com/jack386-mrnaughty/

Digital Dragon
19
Years of Service
User Offline
Joined: 17th Dec 2004
Location: ...
Posted: 25th Apr 2005 03:03
About 3 hours and not a single comment or idea?

PowerSoft
20
Years of Service
User Offline
Joined: 10th Oct 2004
Location: United Kingdom
Posted: 25th Apr 2005 03:18
Why should we use it? Detailed reasoning. What can it do?

[b]PowerScript: Currently Working on Expression Evaluating, thanks alot DavidT for the help
The Nerd
20
Years of Service
User Offline
Joined: 5th Jun 2004
Location: Denmark
Posted: 25th Apr 2005 03:53
I would say that you should make it more user-friendly

But apart from that good job!

*************
*panzergames*
http://www.panzergames.tekhawk.com
Digital Dragon
19
Years of Service
User Offline
Joined: 17th Dec 2004
Location: ...
Posted: 26th Apr 2005 01:41 Edited at: 26th Apr 2005 01:41
@Powersoft - Yea thanks for pointing this out, suppose i mainly posted this because, for me it was an achievment and now i have made it so it can use your code without having to input the drive and filename,it does it for you

@The Nerd - Thanks and I just used your comment to make it better

And also could someone please out a code snippet or something like it on how to make an exe like darkbasic does...thx


Light Basic
-----------

Clear-cls
Print ' '-print " "
red 255-ink rgb(255,0,0),0
blue 255-ink rgb(0,255,0),0
blue 255-ink rgb(0,0,255),0
pause-wait key
pause_for 2-wait 2000
exit-end

PowerSoft
20
Years of Service
User Offline
Joined: 10th Oct 2004
Location: United Kingdom
Posted: 26th Apr 2005 01:54
Detailed reasoning and why should we use it?

[b]PowerScript: Currently Working on Expression Evaluating, thanks alot DavidT for the help
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 26th Apr 2005 23:39 Edited at: 26th Apr 2005 23:41
Also, how fast is it?

[EDIT] Infact I'll download and examine myself.


Home of the Cartography Shop - DarkBASIC Professional map importer
Digital Dragon
19
Years of Service
User Offline
Joined: 17th Dec 2004
Location: ...
Posted: 27th Apr 2005 05:27
hey APEXnow - I saw you created a scripting engine(just a quick look) - but 1 queation how do you make exe's like when you comile the code it makes an exe that you can run? thx

David R
21
Years of Service
User Offline
Joined: 9th Sep 2003
Location: 3.14
Posted: 27th Apr 2005 05:54
Try a 3rd party tool? Steal the DB compiler?

[url=www.lightningstudios.co.uk][/url]
Sephnroth
22
Years of Service
User Offline
Joined: 10th Oct 2002
Location: United Kingdom
Posted: 27th Apr 2005 07:52
Scripting languages are rarely compiled into an exe - at most you might compile them to opcode.

No, what you need to do MrNaughty is write what is called a virtual machine. a virtual machine (or VM) processes the script file and executes the commands inside. They are however very complex and I really cant explain how to make one here, my forum post would be book sized.

If its any help though the system lay out is such:

take the script file
parse it into what they call OPCODES (a bit like asm, they are basically short commands which the VM understands, like ADD would be a command to add two numbers together)
feed the opcodes into the VM and have it execute them.

Parsing usually involves something called a lexer, but really i cant even begin to explain - im not too sure on some of this stuff myself XD

[07:16:59-pm] « Sephnroth » you were dreaming about lee...
[07:17:13-pm] « Mouse » stfu
[07:17:22-pm] « Mouse » he was hanging himself lol
APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 27th Apr 2005 09:02
Mrnaughty, as Seph has explained, scripting is rarely compiled into executable form. My XScape scripting engine does not compile into executables. The whole system is coded in C/C++ to acheive faster processing, but basically it is exactly as described above.

I parse my scripts using a textual recognition lexer that converts commands etc into OPcodes. An OPcode can be either a command or an expression index. Expressions are things like variable names, user defined function names, values or text entries ("text"). Command OPcodes, are integer bytes which reference an index into a function pointer table which stores the locations of the C/C++ functions to process that command.

So for example, the following piece of script code:

Dim nVar As Integer
nVar = 100

Would be converted to:

9057 - OPcode for DIMension
5 - Expression index, where the index table lists all variable entries, text etc. In this case, entry 5 is the name "nVar".
9022 - AS, checked by the preparser to ensure it's syntactically correct
9001 - INTEGER - Which from this point, a new Var entry is created for the current process scope. With the name, and type
9999 - Line terminator
5 - Expression index, since this is the first entry on this line, it is going to be an assignment of somesort, so a recursive descent algorithm is called to process the expression.
9100 - EQUAL operator
7 - Expression index, points to the value "100"
9999 - Line terminator.

Ok, this is a simplified example of what I do when processing script files, but the general point here is that instead of comparing values in your script like:

If Command$="DIM" Then

Which is hideously slow, because your actually doing a string comparison of 3 bytes, hence 3 cycles of the program execution etc, a VM or Virtual machine processor can do a check on the OPcode and call the function straight away because the function details are stored directly with the OPcode data - (In C/C++ anyway). It's a different kettle of fish in DBPro.

I did implement this kind of system with Thrust, an earlier attempt at a scripting system which was coded in DarkBASIC Professional native code. I did a hell of a lot of preparsing on the script files to get the best speed out of the system. The only two things that let it down was that scanning dynamic arrays, large ones to find an entry based on an index (not an array indice), was slow. Hash tables would have seriously benefited this system if they existed at the time.

All the OPcodes, their Textual equavalents etc, were stored in Data statements for each module, where a module was like Object, Sound, Entity, Image, Sprite etc.

They were stored like:

DATA "REM", OP_REM, ""
DATA "`", OP_REM, ""
DATA "CLS", OP_CLS, ""
...
...
DATA "TEXT", OP_TEXT, "II"

The third entry defined what the command operands were. In the case of TEXT, it was "II", or two integers.

Paul.


Home of the Cartography Shop - DarkBASIC Professional map importer
Digital Dragon
19
Years of Service
User Offline
Joined: 17th Dec 2004
Location: ...
Posted: 28th Apr 2005 03:25
I have a ...different way... for makig someone else play the games you code
You make a little compiler like i ahve already made to run the programme straight after the code input then send one of those with a .lightdat file then it looks for that in the mini compiler and runs it
It hopefully will work .....

APEXnow
Retired Moderator
21
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 28th Apr 2005 05:19
I'm still somwhat mistified as to the purpose of creating a basic language, targetted at creating any type of program as an interpreted script file though. What is the goal of lightbasic? I can understand if it's going be used as a way to MOD an existing game concept or to allow easier implementation of a game function for controlling AI or triggers etc. But ask yourself the question, are you developing this as an independent language or is it just a learning excersize for something planned as a way to provide scriping for particular game concept?

If your aiming to produce an independent language with a wide scope. Will it perform as well as DarkBASIC Professional? As an interpreted scripting language, I seriously doubt it. But, not to say that this is a negative thing because you may decide to provide script processing as an addon to existing DarkBASIC Professional development projects where by scripts can be used for accessing database files, or managing images and objects in bulk.

Just a thought

Paul.


Home of the Cartography Shop - DarkBASIC Professional map importer
Digital Dragon
19
Years of Service
User Offline
Joined: 17th Dec 2004
Location: ...
Posted: 28th Apr 2005 05:24
yeh mine was mainlt for creating programmes easier and it will be free so alot of my friends could try it out easily And It mainly is something to expand my db knowledge and I have found it fun so far since usually i have nothing to do

Digital Dragon
19
Years of Service
User Offline
Joined: 17th Dec 2004
Location: ...
Posted: 28th Apr 2005 05:34
Right now i got exe's sorted now onto more commands....
I need to work out how to do input but no sure how to get 2 different variables from a string that i read from a file,can any1 help?

TEH_CODERER
21
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 28th Apr 2005 06:16
My scripting system for my RPG worked by making a script like this:

It had many other commands but that is just an example. The game would then open and read through the file and run each command. For instance:
SpawnEnemy("Troll",100,50,25,1000)
would create a troll of scale 1000 at position 100x50x25.

[url]andrewneale2004@yahoo.com[/url]
http://www.elbsoftware.tk
PowerSoft
20
Years of Service
User Offline
Joined: 10th Oct 2004
Location: United Kingdom
Posted: 28th Apr 2005 15:53
Well i have made a scripting engine designed for MOD ability. Its no mean feat. Do you have expression parsing and evaluating? Can you create variables in your program (eg user types in script file HELLO$="hello" can you output the contents of HELLO$?)

Just some questions

[b]PowerScript: Currently Working on Expression Evaluating, thanks alot DavidT for the help
Digital Dragon
19
Years of Service
User Offline
Joined: 17th Dec 2004
Location: ...
Posted: 29th Apr 2005 02:02
@Powersoft - No cause it simple and u just asking these questions coz u got better one that started WAY before me... (not ment to be insulting... )

@Andrew - Yh I would love to do that but i dn't know how i can get my comiler to regonise each individial number,could u maybe shed light on this?


thx

Yeah There Might Be A Edit Button, Who Says I Have To Use It?
David R
21
Years of Service
User Offline
Joined: 9th Sep 2003
Location: 3.14
Posted: 29th Apr 2005 02:10
PowerSoft - are you trying to destroy his confidence?


@Mrnaughty: I think Powersoft is trying to reinforce the fact that HE is the guy making scripting systems - your a competeitor.......

[url=www.lightningstudios.co.uk][/url]
Digital Dragon
19
Years of Service
User Offline
Joined: 17th Dec 2004
Location: ...
Posted: 29th Apr 2005 02:24
lol i agree but to be honest, i dn't care


Yeah There Might Be A Edit Button, Who Says I Have To Use It?
PowerSoft
20
Years of Service
User Offline
Joined: 10th Oct 2004
Location: United Kingdom
Posted: 29th Apr 2005 03:23
No im merely asking for a "Blurb" on the product. It will help others to see what this scripting engine can do.


@Lightning Studios. Im not destroying his confidence i provide help and support wherever i can. Anyway he should have answered properly first time rather than making me post again and aga...

Regards,
Rich

[b]PowerScript: Currently Working on Expression Evaluating, thanks alot DavidT for the help
Digital Dragon
19
Years of Service
User Offline
Joined: 17th Dec 2004
Location: ...
Posted: 29th Apr 2005 03:28
lol i didn't get you first time that why and could u maybe share your amazing knowledge on how to read a file then find variables in a string?


thx


Yeah There Might Be A Edit Button, Who Says I Have To Use It?
Raven
19
Years of Service
User Offline
Joined: 23rd Mar 2005
Location: Hertfordshire, England
Posted: 29th Apr 2005 03:35
Who cares who makes the scripting system, the best one will always be chosen though.

This doesn't always mean best in speed, but the person who can make the biggest deal out of what they're creating can get a large following. Good or bad, your still going to get alot of people noticing the product.

Personally I would try to make a goal for the Scripter to achieve.
There will always be something technically better on the market, so remember this and try to make sure yours is the simplist to use.

People will use yours because it's easier.
Why do you think so many companies used Havok over Karma? Karma is a right Biatch to use. Technically was years ahead, but using it was a pain in the arse.

Personally I've been tinkering with a C# Script DLL for Dark Basic Professional, can't do anything serious until the Interface is released.. but for the most part you can load a script that runs inside DBP executing using an internal OPCode solution. Similar to how APEX has his no doubt..

All of the OPCodes relations are stored in a standard 3 Element Array, and then it's parsed via a generic script.

So you have like ... External Function, OpCode Number (for..Select), Internal Function. It then constructs and #includes the .dba at runtime.

It's not exactly the perfect solution due to DBPs speed, but once the functionality is run once you can keep it. Provided you don't mind exposing some of the engine. Was working on a way to create an Inheriter, so you could compile the additional code from the SDK then it would replace the predefined code area in the machine code _virtual.dat.

Still think it's possible, but figuring out how the internals of DBP worked gave me more than a little headache.

Your signature has been erased by a mod. Please resize it to under 600x120. Thanks!
David R
21
Years of Service
User Offline
Joined: 9th Sep 2003
Location: 3.14
Posted: 29th Apr 2005 03:36
Sorry PS... didnt mean it its just what is looks like from a distance....

[url=www.lightningstudios.co.uk][/url]
PowerSoft
20
Years of Service
User Offline
Joined: 10th Oct 2004
Location: United Kingdom
Posted: 29th Apr 2005 04:10
@MrNaughty: Well it depends how your going to show variables. Firstly i always split the parameters up into a parametr array so i can access parameters by its index.

@LightningStudios: Dont worry i took no offence i was just clearing things up.

@Raven:

[b]PowerScript: Currently Working on Expression Evaluating, thanks alot DavidT for the help
Digital Dragon
19
Years of Service
User Offline
Joined: 17th Dec 2004
Location: ...
Posted: 29th Apr 2005 16:10
I just made up a way so I can print many things that a user puts in by a shortcut and i have created a simple input command and a print var command


Yeah There Might Be A Edit Button, Who Says I Have To Use It?
PowerSoft
20
Years of Service
User Offline
Joined: 10th Oct 2004
Location: United Kingdom
Posted: 2nd May 2005 19:30
? sorry didnt understand what you meant.

[b]PowerScript: Currently Working on Expression Evaluating, thanks alot DavidT for the help
MikeS
Retired Moderator
21
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: United States
Posted: 3rd May 2005 08:08
I've actually made several small scripting engines, a few of which were named "Light Basic". Since then though, I've of course changed the name, so feel free to use it all you want.

Basically, the things you want to focus on for a scripting engine are parsing. Once you have a solid parser in place, it's as simple as checking the script file for a command and carrying it out in an if-endif statement. Once you get 50+ if-endif statements, there may be a little slowdown, so this probably isn't the fastest way to do things. However, it'll work and still be fairly fast.

Search for "compiler" in the general section and you should see a thread filled with 100s of posts on links for things like interpreters, script engines, and compilers. Hopefully that should help you out a bit.

Keep up the good work with your project.



A book? I hate book. Book is stupid.
(Formerly Yellow)
PowerSoft
20
Years of Service
User Offline
Joined: 10th Oct 2004
Location: United Kingdom
Posted: 3rd May 2005 15:58
(20 of them probably mine )

[b]PowerScript: Currently Working on Expression Evaluating, thanks alot DavidT for the help

Login to post a reply

Server time is: 2024-11-23 03:44:12
Your offset time is: 2024-11-23 03:44:12