Update (5 Months later >_>):
Having noticed someone posting about this, I've updated this topic with a new link to an updated version, which is more optimized and includes the Switch statement. Please be aware that no updates are forthcoming as this module was ditched shortly after posting the first version of this topic, in favour o a more optimized and organised version.
The new download link is:
www.binaryphoenix.com/?action=software&step=view&id=11
Its also in the toolbar here:
http://www.blitzbasic.com/toolbox/toolbox.php?tool=169
Old Post:
Well I've been developing an rpg engine recently (worklog - http://www.blitzbasic.com/logs/userlog.php?user=7531&log=631) and while I was designing it I was working on a scripting language for it, i fiqured some people might like it so im releasing a module for it, its pretty much the same thing im using in my engine but all the game specific stuff has been stipped out of it.
It may also be of some help to people who want to develop there own scripting language as its a pretty good base but unfortunatly its not particualy fast.
Lol the fact that it wasent designed to be released explains why it dosent have a proper name XD.
Heres a one of the examples supplyed with the exe to give you an idea of what it is.
BPScript
Bmax source
Unfortunatly the bmax source is badly missing an abstraction layer to make it easier to use but it should be good enough to use.
Feel free to poke around in the source and make changes and post any tweaks you think are usfull (it could use a LOT of tweaking i know!). And if you dont like the syntax try modifying the lexer in the TScriptCompiler type its very easy to change it to a basic style if you prefer.
DOWNLOAD LINK - http://www.savefile.com/files/6012948
And heres a list of supported operators / statments, just because im so nice :P.
Operators:
Statments:
Having noticed someone posting about this, I've updated this topic with a new link to an updated version, which is more optimized and includes the Switch statement. Please be aware that no updates are forthcoming as this module was ditched shortly after posting the first version of this topic, in favour o a more optimized and organised version.
The new download link is:
www.binaryphoenix.com/?action=software&step=view&id=11
Its also in the toolbar here:
http://www.blitzbasic.com/toolbox/toolbox.php?tool=169
Old Post:
Well I've been developing an rpg engine recently (worklog - http://www.blitzbasic.com/logs/userlog.php?user=7531&log=631) and while I was designing it I was working on a scripting language for it, i fiqured some people might like it so im releasing a module for it, its pretty much the same thing im using in my engine but all the game specific stuff has been stipped out of it.
It may also be of some help to people who want to develop there own scripting language as its a pretty good base but unfortunatly its not particualy fast.
Lol the fact that it wasent designed to be released explains why it dosent have a proper name XD.
Heres a one of the examples supplyed with the exe to give you an idea of what it is.
BPScript
/* ============================================================================= * Example 03 - Basic threading * Copyright (C) 2005 Binary phoenix * ============================================================================= */ //----------------------------------------------------------------------------- // Entry point for thread 1 Function Example03a() { // Local variables Var i; // Say that we're starting Print("Thread 1 is starting!"); WaitMS(4000); // Print a message Print("Thread 1 message 1!"); WaitMS(8500); // Print a message Print("Thread 1 message 2!"); WaitMS(300); // Say thread 2 testing 20 times with a 0.2 // second pause in between For(i=1;i<=10;i++) { Print("Thread 1 illteration "+i); WaitMS(200); } // Say that we're ending Print("Thread 1 is ending!"); } //----------------------------------------------------------------------------- // Entry point for thread 2 Function Example03b() { // Local variables Var i; // Say that we're starting Print("Thread 2 is starting!"); WaitMS(500); // Print a message Print("Thread 2 message 1!"); WaitMS(800); // Print a message Print("Thread 2 message 2!"); WaitMS(1000); // Say thread 2 testing 10 times with a 1 // second pause in between For(i=1;i<=10;i++) { Print("Thread 2 illteration "+i); WaitMS(1000); } // Say that we're ending Print("Thread 2 is ending!"); }
Bmax source
Rem BPScript - Scripting language Example02 - Basic threading Copyright (C) 2005 Binary phoenix Coded by Helios (Aka. Tim Leonard) For more infomation, support and updates please go to BinaryPheonix.com End Rem ' Import modules Import BinPhx.BPScript ' Simple command set (you can register commands seperatly to each VM, but this .. ' .. is easier as all vm's automatically register all command sets) Type TExample01CommandSet Extends TVMCommandSet ' Register the commands Method RegisterCommands() RegisterCommand("Print",C_Print) RegisterCommand("WaitMS",C_WaitMS) End Method ' Simple print function Function C_Print(Thread:TScriptThread) ' Unfortunatly the GetParam* functions get the parameters in reverse order ' to get the parameters in the correct order use the GetParamAbs* functions. Print Thread.GetParamAsString(0) End Function ' Simple wait function Function C_WaitMS(Thread:TScriptThread) Thread.Pause(Thread.GetParamAsInt(0)) End Function End Type ' Install command set by creating a new instance of it New TExample01CommandSet ' Create a virtual machine to run the script on Local VM:TScriptVM = New TScriptVM ' Load the first thread and invoke its functions Local Thread:TScriptThread = VM.LoadScript("Scripts\Example03.bp") Thread.InvokeScriptFunction("Example03a",False) ' Load the first thread and invoke its functions Local Thread2:TScriptThread = VM.LoadScript("Scripts\Example03.bp") Thread2.InvokeScriptFunction("Example03b",False) ' Run until the thread has finished Repeat ' Run all threads in the VM with an infinate timeslice VM.RunThreads(-1) ' Check if the thread is finished if so quit If (Thread.IsActive = False) And (Thread2.IsActive = False) Then Exit Forever
Unfortunatly the bmax source is badly missing an abstraction layer to make it easier to use but it should be good enough to use.
Feel free to poke around in the source and make changes and post any tweaks you think are usfull (it could use a LOT of tweaking i know!). And if you dont like the syntax try modifying the lexer in the TScriptCompiler type its very easy to change it to a basic style if you prefer.
DOWNLOAD LINK - http://www.savefile.com/files/6012948
And heres a list of supported operators / statments, just because im so nice :P.
Operators:
-- ++ <<= >>= %= &= |= ^= #= /= *= += -= != == >= > <= < << >> % & && || | ~ ! ^ # / * + -
Statments:
Function Variables Constants Return While For If Break Continue Function calls Mutexs Assignments Expressions