Is this feature enough of an excuse to use my scripting language?
I haven't programmed in months (been busy away from the computer) but before I stopped I was coding this scripting language. It's geared specifically towards games, and it has a few key features that make it stand out in the crowd (once it's completed of course). For example, it has a better model for handling structures and objects, but I won't get specific on that. The most distinctive feature is that, when defining the objects and functions that are exposed to the script, you get to also define their syntax. So, basically, your language can look like anything from BASIC, to C++, to Lua, or even a sort of pseudo-code. Care has been taken in order to not allow ambiguity in the syntax so don't worry about those details - you simply type the name of a function and then how you want the parameters; if you want them to be comma-seperated just type that, if you want them enclosed in brackets it's also possible, and you can also include keywords and stuff. It's also possible to change the names of keywords and variable types, and the syntax of control structures like IF and WHILE. Of course, this is all cosmetics and the internals of the language never change. It started out as a language that looks like pseudo-code but it evolved into this with very little effort. Now, I'm considering whether to continue working on this or use an existing language for any future projects. What do you think?
Without having seen it, I can say it sounds interesting but has the potential for getting really confusing, especially if you mix and match within a project or cross projects. Maybe an example of the syntax and use would help?
There is no excuse for using your own language; just use it.
--Slashstone - www.slashstone.comNerveBreak free scripting system.
I don't think that my personal use is enough of an excuse because I don't plan on using it for a while, so I wanted to know if it would be useful for anyone else.
It's not confusing at all, there are no special rules so you can learn any "dialect" by just looking at the functions list. There is also no mix and match, because you define how you want it to look like for your project (game, whatever). When used as a sort of pseudo-code, it looks really natural and I think that with a set of high-level functions it would be easy for anyone to pick it up, which is good since it's aimed towards games. For hobby projects it's good because it allows a much larger audience to edit levels and mod the game (like with Starcraft's simple trigger system, for example), and for professional games too since it's a big plus if designers, level builders and story writers are able to script simple behaviours and story elements.
An example definitions file, this is the last one I used for testing and it looks like C++ except with some optional keywords (the ones ending with '?') so that the parameters are more self-explanatory:
--------------------------------------
// Variable types //
//Native types are followed by the keywords [int], [float] or [bool]
vartype int [int], number [float], bool [bool], string, player, item
// Functions //
number = sin(number)
number = cos(number)
number = mult(number, number)
move(from? number, number, to? number, number)
wait(for? number seconds? secs? s?)
dostuff()
player.move(to? number, number);
prop number = player.x
prop number = player.y
prop number = player.item[number]
prop number = item.type
--------------------------------------
As you can see, the functions "move" and "wait" can easily be defined like this to look more natural:
move from (number, number), to (number, number)
wait for number seconds? secs? s?
Other examples:
if x=2 then
assign 30 to y
popup message "hello!"
It's not confusing at all, there are no special rules so you can learn any "dialect" by just looking at the functions list. There is also no mix and match, because you define how you want it to look like for your project (game, whatever). When used as a sort of pseudo-code, it looks really natural and I think that with a set of high-level functions it would be easy for anyone to pick it up, which is good since it's aimed towards games. For hobby projects it's good because it allows a much larger audience to edit levels and mod the game (like with Starcraft's simple trigger system, for example), and for professional games too since it's a big plus if designers, level builders and story writers are able to script simple behaviours and story elements.
An example definitions file, this is the last one I used for testing and it looks like C++ except with some optional keywords (the ones ending with '?') so that the parameters are more self-explanatory:
--------------------------------------
// Variable types //
//Native types are followed by the keywords [int], [float] or [bool]
vartype int [int], number [float], bool [bool], string, player, item
// Functions //
number = sin(number)
number = cos(number)
number = mult(number, number)
move(from? number, number, to? number, number)
wait(for? number seconds? secs? s?)
dostuff()
player.move(to? number, number);
prop number = player.x
prop number = player.y
prop number = player.item[number]
prop number = item.type
--------------------------------------
As you can see, the functions "move" and "wait" can easily be defined like this to look more natural:
move from (number, number), to (number, number)
wait for number seconds? secs? s?
Other examples:
if x=2 then
assign 30 to y
popup message "hello!"
It's possible to implement something like that, but with a different syntax. As I said, the "flexible syntax" is cosmetic only - you can't make it a functional language like LISP. It still follows a C++ based structure, but with no overloading (as with a system like this it would make for a lot of ambiguities).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement