Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now
- - - - -

Parsing expression with functions -- AS vs boost

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1 paul424   Members   

119
Like
0Likes
Like

Posted 22 April 2013 - 03:45 AM

Thing is , I started writing some fancy functions for map modification, which would be called by various Game parts, especially the console and AS :

    TileContainer* create(int x , int y , Tile::TileType tt );

    TileContainer* copy(TileContainer* tc1 , TileContainer* tc2 );

    TileContainer* embed(TileContainer* tc1 , TileContainer* tc2 );

    TileContainer* rotate90(TileContainer* tc );

    TileContainer* reflectX(TileContainer* tc);

    TileContainer* reflectY(TileContainer* tc);

    TileContainer* tilePermute(TileContainer* t, int x , int y , Tile::TileType tt );

    TileContainer* clone(TileContainer* tc );

    TileContainer* tileReplace( TileContainer* tc , Tile::TileType tt1, Tile::TileType tt2  );

 

That's not only such set of functions , but it illustrates well the problem : How to compute any expression like f(g(h(4 + 5 ) ) ) for which some of f,g,h ... comes from the binary some from AS ? How do I extend that so I have mini-language at Console  ? The first concrete question is : How do I get abstract tree of such expr ? Do I use the AS or use some 3rd lib like boost and there get parser/ lexer for it ?



#2 saejox   Members   

714
Like
0Likes
Like

Posted 22 April 2013 - 08:43 AM

ExecuteString function in ScriptHelper addon seems to be what you are look for.

 

http://www.angelcode.com/angelscript/sdk/docs/manual/doc_addon_helpers.html#doc_addon_helpers_1



#3 Andreas Jonsson   Moderators   

4628
Like
0Likes
Like

Posted 22 April 2013 - 08:58 AM

In addition to that I recommend that you take a look at the 'console' sample in the AngelScript SDK. It shows one way that you may implement an in-game console with support for executing expressions, etc.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.