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.

Program Announcements / KaosScript v1.0

Author
Message
Zuka
14
Years of Service
User Offline
Joined: 21st Apr 2008
Location: They locked me in the insane asylum.
Posted: 29th Dec 2008 06:57
I put this off for quite a bit, but I got it working now. This is the third re-write. Enjoy!

KaosScript.h


KaosScript.cpp


Value names must be unique, but everything else can share names. Since that example explains the syntax, I don't need to say much more, but that it is solely line-based, so you can't have multiple statements per line, sorry.

I've thought of several uses, especially as a world saving type format. You make a block for each object in your world, and then load it.

Lines cannot be longer than 512 characters, but you can change that in KaosScript.h, the #define for MAX_LINE_LENGTH.

KaosScript is also loosely typed. Everything is a string until you cast the value. I don't know what happens if you cast a value with letters to an int or float, though. Probably turns to the ASCII values or something.

My next project is a world editor, saving to .kaos files.

Example - in my FPS's format (called Kaos, which KaosScript was made for), loads the player, a plane to stand on, and a box to push around.


This probably won't work with "vanilla" KaosScript. I mean, it will, but it won't do anything, since KaosScript is just a data formatting language. It's very flexible, though, and it's more like XML than anything (not syntatically.)
--------------------------------------------
New: C++ Usage Example
This is an excerpt from my game engine, it's not DarkGDK, but that doesn't apply to this.


"settings" is a struct containing three values indicating whether it's fullscreen or not, and the screen resolution.

Here's the relevant part of the .kaos file, "cfg/XarxesSettings.kaos".


As you can see, the block type isn't necessary. Neither is the block name, but then, how else would you find it?
General Reed
16
Years of Service
User Offline
Joined: 24th Feb 2006
Location:
Posted: 31st Dec 2008 14:49
Cool, Bit strange tho that my engine is called "Chaos" engine (Which im currently developing), and my script system header is ChaosScript.h lol.

CPU: AMD X2 6000+ 3.0ghz GFX: NVIDIA BFG Geforce 8800GTS 640MB OC-550mhz core RAM: 2048mb

Hayer
17
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Norway
Posted: 15th Feb 2009 02:59
Mh-m, nice.
Could you explain how it works?

Mulderman
19
Years of Service
User Offline
Joined: 8th Jan 2004
Location: C:\\
Posted: 16th Feb 2009 12:25
Hmm, old thread but anyway.

You are calling many times "new" in different places.
For example KaosBlock *NewBlock = new KaosBlock();


But where are "delete" ? Why there is no destructor in your class?
I think that stuff eats memory and does not return it.
I haven't tested but by looking at the code i think so.
Hayer
17
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Norway
Posted: 16th Feb 2009 15:30
well, new int dosnt take much memory, so saying that it "eats" memory may be unfair.

Keep it simple.
Questions? Mail me
FIGHTEX
14
Years of Service
User Offline
Joined: 30th Nov 2008
Location:
Posted: 1st May 2009 00:12
looks, great a bit confusing doe. but just what i need

Game.Love
coolgames
17
Years of Service
User Offline
Joined: 26th Sep 2005
Location: Oregon, USA
Posted: 1st May 2009 07:36
You need to fix the memory leak like Mulderman said. If you use "new" to allocate memory, then you must free it later with the "delete" command, or else there will be memory leaks.

Login to post a reply

Server time is: 2023-02-08 23:02:32
Your offset time is: 2023-02-08 23:02:32