Author Topic: Is there a list of ''known'' variables for TS?  (Read 1426 times)

'Known' meaning certain variables people use all the time, like %client and %this. Where would I find a list of these, if there is one?


function GameConnection::createPlayer(%littlePiggy, %hamster)
{
    if(%littlePiggy.builtAHouse)
        Parent::createPlayer(%littlePiggy, %hamster);
    else %littlePiggy.chatMessage("\c6Build a house first, little piggy!");
}

I think he means global variables?

Im gonna assume your new to programming.

A variable name can be anything at all. I can create a brick and stored it in a variable %player. The name means nothing, its only to make it easier to understand for you and others.


Or if you mean global variables, do export("$*", "config/variables.cs"); and you will get a list of all global variables.

This doesn't work anymore, by the way.

Edit: Oh poop. I just tried that and it crashed me. Don't do that.

Edit 2: It crashes you, but it does work. Use with caution.

Edit 3: Okay, so it crashes you, but doesn't get all of the variables. It just stops part way through..
« Last Edit: March 09, 2014, 06:45:26 AM by boodals 2 »

Or if you mean global variables, do export("$*", "config/variables.cs"); and you will get a list of all global variables.

This doesn't work anymore, by the way.

This doesn't work anymore, by the way.

Kinda off topic, but why did it stop working?

This doesn't work anymore, by the way.
Works for me. Blockland crashes, but it still works.

Works for me. Blockland crashes, but it still works.
Ah, so it does.

This doesn't work anymore, by the way.
why the stuff

Variable names don't matter as long as they're used correctly.

For, example, this function:
Code: [Select]
function eat(%pie)
{
    %pie.delete();
}

can be used like this:
eat(%apple);
eat(%himynameisdaveandiliketobeeatensodoyouthinkyoucaneatmeokaythanksandbye);

This doesn't work anymore, by the way.
Do export("$*"); and read console.log?

Works for me. Blockland crashes, but it still works.

Did you actually look at the file? It stops halfway.

Go into the console in-game and type in "$", then keep pressing / hold down tab.
It's a little slow, but it works.

Another solution:
I've noticed that with the previous way, it always seems to stop on variables starting with the letter "S."
In order to work around this, I simply wrote some code to export all variables except for those beginning with S. This seems to work perfectly, and for variables beginning with S you can use the above solution.

Code: [Select]
function exportGlobalVars(%letter)
{
export("$"@%letter@ "*","config/varlists/list_"@%letter@ ".cs");
}
exportGlobalVars("a");
exportGlobalVars("b");
exportGlobalVars("c");
exportGlobalVars("d");
exportGlobalVars("e");
exportGlobalVars("f");
exportGlobalVars("g");
exportGlobalVars("h");
exportGlobalVars("i");
exportGlobalVars("j");
exportGlobalVars("k");
exportGlobalVars("l");
exportGlobalVars("m");
exportGlobalVars("n");
exportGlobalVars("o");
exportGlobalVars("p");
exportGlobalVars("q");
exportGlobalVars("r");
//exportGlobalVars("s");
exportGlobalVars("t");
exportGlobalVars("u");
exportGlobalVars("v");
exportGlobalVars("w");
exportGlobalVars("x");
exportGlobalVars("y");
exportGlobalVars("z");

If you know of an easier way to omit the letter S, please let me know, because I'm sure this could be improved.

Did you actually look at the file? It stops halfway.
Do export("$*"); and read console.log?