Sign in to follow this  

In-Game Scripting

This topic is 2635 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi there,

Made this post different from another in this section because they had different topics.
Anyway, I have some idea for my future project. I'm looking for some addon to my game in the way the users can write some kind of script in-game so they can build, manipulate, etc objects and features of the environment.
By writting themselves some "instructions" they can create new objects, modify, mix them and so on.
One game that is close to this idea is Colobot (http://www.ceebot.com/colobot/index-e.php)
That could be accomplished by implementing some scripting Language like Lua?

Share this post


Link to post
Share on other sites
You're thinking of a dev console.

Quote:
That could be accomplished by implementing some scripting Language like Lua?


Implementing Lua is a totally different job than integrating it into your engine.

Lua can be used as your scripting language. Just read the documentation. Speaking from my experience with it, it's hard to ask for something more elegant. [smile]

Share this post


Link to post
Share on other sites
Thanks for the answer. So do you mean that my goal can be accomplished by a Dev Console? That Dev console should use Lua? And so the user that may use it, he may enter commands in Lua?

Maybe I'm wrong and "Scripting" is not the word for my goal. What I want is the users can input some commands, but not pure game code so they can mess up the game engine xD.

Thanks!

Share this post


Link to post
Share on other sites
Quote:
Original post by b3y0nd3r
Thanks for the answer. So do you mean that my goal can be accomplished by a Dev Console? That Dev console should use Lua? And so the user that may use it, he may enter commands in Lua?

You could pass the input of your dev console directly into your Lua interpreter, yes. But a dev console can also be as simple as a dictionary that maps strings to (hard-coded) functions. If you want to pass arguments, a simple approach would be to split the input string on whitespace and have these functions accept an array of strings. You would need to 'register' the functions you want to expose somewhere, but that shouldn't be too much of a hassle.

As an example, if you register your game.createObject function with the string "create", then typing "create box 0 0 15" would result in the following function call: game.createObject({"box", "0", "0", "15"}).

Share this post


Link to post
Share on other sites

This topic is 2635 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this