• entries
707
1173
• views
434744

# Teh scriptyness

83 views

Well, I didn't get crap done today. Half of it my power was out (due to very LITTLE rain. Thats right, little. It barely rained and our power was out for around 5 hours.)

So, I just changed the header for my journal to show the webcomic links. ATM 0 is the only one done, but I'll get episode 1 done pretty soon (by Saturday.)

Other than that I tried my hand at a scripting engine. It's probably slow as hell, but it works (well, its not really a scripting engine yet, right now it can only calls C++ functions that you register.)

Here is an example script:
Print("I am ", 19, " years old. Boolean = ", true, ". NULL = ", null, ".")Print("This is my script system ATM. It reads through the file per line (upto 1024 characters per lines.)");Print("It supports variable argument lists (as long as you handle it in your function!)");

The first Print() function call is typewise compiled to:
string, integer, string, boolean, string, null, string

And then Print() converts it to strings and combines them into a single string. Here's my Print() function (yes, it sucks. Really bad. But it works!):
void Print(ScriptEngine::ValueList Values){	std::string Buffer = "";	for(ScriptEngine::ValueList::iterator Itor = Values.begin(); Itor != Values.end(); ++Itor)	{		std::string Str = (*Itor).GetStringVersion();		Buffer += Str;	}	std::cout<}

And my example consists of:
ScriptEngine Engine;Engine.RegisterFunction("Print", Print);Engine.RunScript("Test Scripts\\print.dfts");

Its not the best, but I don't think I did too bad for my first run at it (and under 2 hours.) It also COULD create and store variables as I have the code, but it's commented out. This is because I haven't coded operator parsing yet.

I'll probably discuss how I handle everything once it's finished. I plan on atleast adding the basic operators: +, -, /, *, and =. Even if I don't discuss it, I'll post the source code for it.

On my entry's side I got a little bit of it designed out. I know what kind of map system I'm going to be using, how I'm going to arrange everything, and I'm starting now on my skill system.

On Malathedra, I'm working on a map at the moment. Me and Raymond got a ton of the storyline done yesterday, but we still need to do a good chunk. We were planning on having it done this weekend (and he might have gotten it done with someone else; I haven't talked to him all day), but my power isn't cooperating.

Edit: Oh, btw I'm not going to be using this scripting engine for my entry or anything, it's just something that I wanted to try to get working. I'll probably use lua for that.

There are no comments to display.