So what we really need is a flexible standardised platform á la .NET/Parrot with pluggable interpreters/compilers!
Nullable
@Nullable
Best posts made by Nullable
Latest posts made by Nullable
-
RE: I suppose concating a number from a loop to a string doesn't work any more
-
RE: I suppose concating a number from a loop to a string doesn't work any more
Also don't forget that some games are starting to use Stackless Python for scripting too.
-
RE: I suppose concating a number from a loop to a string doesn't work any more
TS has no GC, you have to manually delete each object to prevent memory leaks. So each object in TS has a .delete() method for nuking the object. In vanilla TS you can also create destructors by overriding .onDelete(), but this functionality was patched out in the game in question.
-
RE: I suppose concating a number from a loop to a string doesn't work any more
Yep.
In TS % is the prefix for local variables and $ is the prefix for global variables. When it looks like JavaScript identifiers it's actually implicit strings. All syntax-helped string operations are case-insensitive.
There are no arrays, $A["b"] is equivalent to $Ab. @ is string concat, $= is (case-insensitive) string match, == is for comparing numbers and (if it's a string,) the IDs of objects. -
I suppose concating a number from a loop to a string doesn't work any more
While going through a mod that I and another guy had "joined" to see how to add "ores" I was instantly greeted by this function:
function loadOres() { %file = new FileObject(); %file.openForRead("./ores.txt"); while(!%file.isEOF()){ %line = %file.readLine(); echo(%line); readOreFile(%line); } %file.close(); %file.delete(); } loadOres();
While this wasn't too bad, it still wasn't what I was looking for, so I decided to dig deeper, thus getting this:
if(!isObject(OreSO)) new ScriptObject(OreSO); function readOreFile(%name) { %file = new FileObject(); %file.openForRead("./types/" @ %name @ ".txt"); %health = %file.readLine(); %name = %file.readLine(); %db = %file.readLine(); %print = %file.readLine(); %dirt = %file.readLine(); %level = %file.readLine(); %file.close(); %file.delete(); if(%name !$= "grass") { %levelobj = "Level" @ %level; echo(%levelobj); if (%levelobj.count $= "") %levelobj.count = 0; %levelobj.ore[%levelobj.count] = %name; %levelobj.count += 1; } eval("new ScriptObject(" @ %name @ "SO) { health = " @ %health @ "; name = \"" @ %name @ "\"; print = \"" @ %print @ "\"; dirt = \"" @ %dirt @ "\"; };"); OreSO.count++; OreSO.ore[OreSO.count] = %name; }
A data file for this would look like this:
10 Dirt DirtDB 31 3
(yes, %db was completely unused.)
This was immediately followed by this code used to create the "level" objects:
function scriptObjectOre() { if(!isObject(Level1)) new ScriptObject(Level1); %c++; if(!isObject(Level2)) new ScriptObject(Level2); %c++; if(!isObject(Level3)) new ScriptObject(Level3); %c++; if(!isObject(Level4)) new ScriptObject(Level4); %c++; if(!isObject(Level5)) new ScriptObject(Level5); %c++; if(!isObject(Level6)) new ScriptObject(Level6); %c++; if(!isObject(Level7)) new ScriptObject(Level7); %c++; if(!isObject(Level8)) new ScriptObject(Level8); %c++; if(!isObject(Level9)) new ScriptObject(Level9); %c++; if(!isObject(Level10)) new ScriptObject(Level10); %c++; echo("Created " @ %c @ " Script Objects."); } scriptObjectOre();