### TorqueScript 2

Scripting questions, discussions, etc

#### Re: TorqueScript 2

JeffR
Steering Committee
Posts: 863
Joined: Tue Feb 03, 2015 9:49 pm

KorkScript, duh.

#### Re: TorqueScript 2

MangoFusion
Posts: 50
Joined: Wed Feb 04, 2015 12:00 am
Yo guys, just an update.

While I was going to push stuff out last weekend, I bumped into a little problem with the console interop which put a spanner in the works (i.e. i have to refactor stuff earlier than I thought). My current initial release goal is sometime tomorrow.

@
rlranft

Arrays are just types with accessor implemented for []. ATM I just have a simple array of console values type. You could implement a lua table fairly easily.

@
chriscalef

All numbers are F64s, and they aren't converted to strings unless neccesary (e.g. for concat operators and string accessors). So there should be less of a problem.

#### Re: TorqueScript 2

chriscalef
Posts: 381
Joined: Mon Feb 09, 2015 7:48 pm
Ah, that's good to hear, @ MangoFusion! Keep them as floats the whole time, what a thought!

#### Re: TorqueScript 2

MangoFusion
Posts: 50
Joined: Wed Feb 04, 2015 12:00 am
Just another update...

I'm taking the time to address another long-standing the torquescript interop has... namely with strings. Usually Con::getData, Con::getVariable and such return "const char*" pointers, sometimes to temporary strings and sometimes to dynamic strings. The problem however is there are no guarantees placed on if this pointer remains valid, especially if you call another console-related function. This leads to all sorts of weird hacks in various places in the engine in order to account for parameter values being clobbered.

Code: Select all

const char* myStringValue = Con::getVariable("$whatever"); // Do something with myStringValue, assuming it wont ever change (it *might*)  You do something like this... Code: Select all ConsoleStringValuePtr value = Con::getVariable("$whatever"); const char* myStringValue = result.c_str(); // myStringValue remains constant as long as value still exists on stack 
In some ways this is similar to the String type in T3D (or your classic std::string), though I am aiming to wrap in support for static unallocated strings, as well as a sensible allocator for small strings into this too.

#### Re: TorqueScript 2

MangoFusion
Posts: 50
Joined: Wed Feb 04, 2015 12:00 am
Another update...

I've finished refactoring everything to use the new interfaces, just dealing with a few regressions of behaviour.

Hopefully should push something initial to one of my branches some time this week.

#### Re: TorqueScript 2

JeffR
Steering Committee
Posts: 863
Joined: Tue Feb 03, 2015 9:49 pm

<3

#### Re: TorqueScript 2

Johxz
Posts: 447
Joined: Sat Feb 07, 2015 11:37 pm
Nice

#### Re: TorqueScript 2

MangoFusion
Posts: 50
Joined: Wed Feb 04, 2015 12:00 am
Ok guys, time for an initial push!

There are still a few things to implement and change (e.g. no dso support, exec doesn't work properly), but at this stage I'm reasonably happy to release something in an initial alpha state.

The code as it stands is now located in a branch at https://github.com/jamesu/Torque2D/tree/twistscript

While currently it wont actually load T2D due to a problem loading the modules, it will execute basic scripts (such as test.cs). Also the code is currently only fixed for OSX, so don't expect it to build for windows yet.

#### Re: TorqueScript 2

MangoFusion
Posts: 50
Joined: Wed Feb 04, 2015 12:00 am
Just an update on this...

After fixing exec and a few opcodes, it can now execute a fair bit into the T2D initialization process (albeit slightly modified to account for the changed array usage). There are however a few issues still preventing it from fully loading, mainly to do with object slots.

I'm currently aiming to get it working so far as to booting everything up before the end of the month - then other stuff such as DSO support can be reimplemented.

#### Re: TorqueScript 2

JeffR
Steering Committee
Posts: 863
Joined: Tue Feb 03, 2015 9:49 pm

Sounding pretty good

#### Who is online

Users browsing this forum: No registered users and 1 guest