Author Topic: Official Coding Resources Thread (02/29/2016)  (Read 51120 times)


Just saying here: You might wanna update the Notepad++ link to be the latest version.

Here's a TorqueScript grammar for the Atom editor which includes both syntax highlighting and snippets.



Case insensitive string replace. (better than Clockturn's)
Code: [Select]
function striReplace(%str, %find, %replace)
{
%str = strReplace(%str, strUpr(%find), %replace);
%str = strReplace(%str, strLwr(%find), %replace);

return %str;
}

striReplace("Hello world", "hello", "goodbye cruel")

striReplace("Hello world", "hello", "goodbye cruel")
Wow. Caught my ninja.

Ooh this is going to be really useful.

Sorry I never check this area of the forums. I looked round as the forum is stone dead right now

A friend found me this GarageGames thread on OOP yesterday. It demonstrates a simple way to create something similar to a class (and instances of) in TorqueScript. This really helped me with the project I was working on; storing everything in "arrays" gets frustrating sometimes!

A friend found me this GarageGames thread on OOP yesterday. It demonstrates a simple way to create something similar to a class (and instances of) in TorqueScript. This really helped me with the project I was working on; storing everything in "arrays" gets frustrating sometimes!

Note on that:

    function Class::delete(%this) 
    { 
        // call the parent class's delete method as well 
        parent::delete(%this); 
     
        // insert rest of deletion code here... 
    }


Just use this instead:

    function Class::onRemove(%this) 
    { 
        // insert rest of deletion code here... 
    }



I recommend Notepad++
Real men use notepad like I, pusillanimous individual.


Anyways this is extremely useful, I see myself using this in the future.