User:Bank
From TDN
I'm currently working on project AfterWorld (Игра находитÑÑ Ð½Ð° Ñтадии альфа-теÑÑ‚Ð¸Ñ€Ð¾Ð²Ð°Ð½Ð¸Ñ Ð´Ð²Ð¸Ð¶ÐºÐ° и наработки функционала).
Here it is... some TS-tricks from bank:
If you work hard, you may end-up on having something like the following in almost all of your functions:
function myClass::myTestFunction(%this, %variable1, %variable2, %variable3)
{
error("myClass::myTestFunction(" @ %this @ "," @ %variable1 @ "," @ %variable2 @ "," @ %variable3 @ ")");
... some code here ....
}
Right? I prefer to make it to be more simple. First, let's declare our new function:
function er(%what, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10, %a11, %a12, %a13, %a14, %a15)
{
if ($Pref::debugOutput) // you can remove this check if you want to have this spam always in your console ;)
{
%line = "";
for(%i=1; %i!=16; %i++)
if (%a[%i] !$= "")
%line = %line SPC %a[%i];
error(%what @ "():" @ %line);
}
}
And now let's re-do our test function:
function myClass::myTestFunction(%this, %variable1, %variable2, %variable3)
{
er("myClass::myTestFunction", %this, %variable1, %variable2, %variable3);
... some code here ....
}
isn't it more clear now? :) And if you integrate getScopeName resource into your project, you can even make it more simpler:
function myClass::myTestFunction(%this, %variable1, %variable2, %variable3)
{
er(getScopeName(), %this, %variable1, %variable2, %variable3);
... some code here ....
}
You can make similar functions to dump a line into console making ec for echo(), wa for warn(), the same way as I made er for error() in this example.
Happy Torqueing! :)
P.S. I'm always open for discussion ;)



