Game Engine>Scripting Language interaction
Well, if you''re not implementing your own language, I imagine there would be constrained by API of the language first off. If you want an example, I''m pretty sure the source code to Abuse(an older side scroller) is out on the internet, and it used a full blown LISP interpreter for its scripting language(you could edit the LISP source in a director and change the game, even the config file was in LISP).
Doing a typical language with functions, I would probably tie a "function" in the script to the actions of entities, e.g. when its time to run the AI for a monster, you call the scripting engine with a script that was attached to the monster script.execute(monster.script);
As far as interacting with the game world, providing some sort of functions that can be called from the scripting language would be the simplest way.
If you want to discuss more, try Babel its a discussion board with articles and links with lots of info about designing/implementing languages(both interpreted and compiled).
Imagine I have an IDispatch compliant 3D engine, so a jscript code can deal with it, but can I define a variable with the instance of this engine before interpret the script?
Why English rules?? C pas très malin tout ça!
quote:
Original post by jesterlecodeur
Just an idea, is it possible to use jscript w/ and to interpret it by windows?
Imagine I have an IDispatch compliant 3D engine, so a jscript code can deal with it, but can I define a variable with the instance of this engine before interpret the script?
Yes - so long as you follow all of the written & unwritten Automation Rules you can use VBScript, JScript, and even Python I beleive. If you provide a typelibrary, you can use it with less of a performance hit with VB and Java, you still need to follow all of the automation rules. If you break the automation rules, it will only work with C++ and Delphi.
Windows provides a COM object to interpret JScript and VBScript.
Magmai Kai Holmlor
"Oh, like you''ve never written buggy code" - Lee
"What I see is a system that _could do anything - but currently does nothing !" - Anonymous CEO
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.