Advertisement

scripting language: why? what? where?

Started by June 12, 2001 05:14 PM
0 comments, last by TechnoHydra 23 years, 8 months ago
I was reading through some of the threads and read something about making your own scripting language for an RPG. My questions are these: What exactly is a scripting language? Am I right in assuming ASCII is example of a scripting language? Also, what would I need to have to make my own scripting language? And, finally are there any good tutorials for beginners on making a simple scripting language from scratch that could later be modified as needs or abilities change? Hope someone doesn''t mind taking the time to answer these extremely newbish questions.
quote:

What exactly is a scripting language? Am I right in assuming ASCII is example of a scripting language?



A scripting language is much like a p[rogramming language, only rather than compiling it into machine code, its either translated real-time or compiled into some format of your choosing, which is read, parsed, and executed by your own program (the RPG, in this case). And ASCII is a character set; a way of storing strings... NOT a scripting language.

quote:

Also, what would I need to have to make my own scripting language?



Knowledge is good. If you have the tools to make an RPG, you should be able to write a script parser. You scripts should be writen in an uncompiled form, so NotePad or any other text-editor will do nicely to write scripts. Besides a parser, you may also wish to write a script compiler. Basically, though, if you can write and execute a program, you can create a script interpreter. After all, an interpreter is just another program, or perhaps a part of a larger program.

quote:

And, finally are there any good tutorials for beginners on making a simple scripting language from scratch that could later be modified as needs or abilities change?



There have been several articles posted on scripting, here at GameDev. If you want tutorials, etc, you should look in the "previously featured articles" section, probably under the category "Programming".

My personal advise:
Write a Forth parser. It''s the easiest, most scalable language you can use. Adding new commands is a piece of cake, once you have a working interpreter. Passing and returning parameters is such a no-brainer, it''s almost riddiculous. It''s also one of the easiest languages to parse. On the down side, the bottom of the learning curve for Forth is rather steep, becuse the syntax is probably unlike anything you''ve used before, but it can be a very enjoyable, elegant language once you get used to it.

Use OpCodes. You can pass parameters without worrying about type-checking or anything by havingthe interpreter run the first line as an opcode, and grab its parameters out of the file stream. That way you just compile the values into the file without worrying about any sort of alignment; as long as you passed the correct number and type of parameters, the file position cursor will get moved up to the next OpCode automatically. Type-checking is then the job of a compiler.

--Tr][aD--
--Tr][aD--

This topic is closed to new replies.

Advertisement