Creating your own scripting language in Unity?

Note: All of this is hypothesised, I am not a fluent JavaScript / C# programmer. Since this isn’t actually scripting, I wasn’t sure if it should be in the Scripting section, or the Game Design. However, for whatever reason I keep getting a error when trying to start a new thread in the Scripting section.

Is this possible?

I came over here from another game engine that used a very easy scripting language to function on, but in the backround was developed by the original languages code. Could essentially this be recreated in JScript / C#? I am sure it can, I am just wondering how exactly.
I think, just my thoughts rambling, you could develop one massive script in Java (or C#) and call all the functions in another script that would reduce the total time needed to program say, AI for example.

Example: (not actual code)

NewLanguage.js
function SetTargetDestination(gameObject, vector3(X,Y,Z)) {
// insert code that would take the gameobject that is sent to it frm another script, and the xyz cords and send the object to the xyz cords on a path according to the gameobjects set attribute: moveSpeed
}

SetDestination.js
@scriptinclude NewLanguage.js

var targetAI : gameObject;
var targetX : float = 0;
var targetY : float = 0;
var targetZ : float = 0;

function Start {
SetTargetDestination(targetAI.gameObject,targetX.float,targetY.float,targetZ.float)
}

Would this be possible? If so how exactly? Thank you for your time.

If I’ve understood what you’re describing correctly: Sure, you can create your own ‘library’ of useful code that does stuff like this. My UnityScript is a little rusty but I think you’d do something like this:

class AIHelpers
{
   static function SetTargetDestination(agent : GameObject, xPos : float, yPos : float, zPos : float) : void
   {
      // do whatever you need to do to set the agent going
   }
}

You’d put that in ‘AIHelpers.js.’ Then in other scripts you’d just do:

function Start()
{
    AIHelpers.SetTargetDestination(targetAI, targetX, targetY, targetZ);
}

Yes I think that is what I am talking about, thank you very much. Does anyone know of a currently exsisting asset that does this?

I would say the best asset to do what superpig outlined would be a text editor.

I get the feeling I’m misunderstanding your question though, so… have you checked into Playmaker? It lets you do a bunch of cool stuff without any coding at all, but if you do want to code, you can write actions to work with it, and they are all contained in the Playmaker library, ready to use. That might be close to what you’re looking for.

I will look into it as a possible solution to what I am thinking of. Thank you.

1 Like