Author Topic: List of server commands  (Read 1821 times)

I have a lot of add-ons with server commands and I don't remember them all. Server_AdvHelp (http://forum.blockland.us/index.php?topic=243836.0) can solve this yet the download link is broken and I can't find it anywhere else.

Does someone have a working version of Server_AdvHelp, or could another add-on/solution be made?

edit: better yet I would appreciate it if someone just made an add-on that displays all server commands and the add-ons they belong to in a gui rather than how Server_AdvHelp uses server commands itself to function
« Last Edit: October 20, 2015, 03:11:03 PM by MikkelDude »

edit: better yet I would appreciate it if someone just made an add-on that displays all server commands and the add-ons they belong to in a gui rather than how Server_AdvHelp uses server commands itself to function
Would require a server sided mod, a client sided mod, and looping through a lot of add-ons and then a lot of code(can you read .cs files with TorqueScript? I've never tried). Which is real taxing. And even then it might not be 100% accurate.

Would require a server sided mod, a client sided mod, and looping through a lot of add-ons and then a lot of code(can you read .cs files with TorqueScript? I've never tried). Which is real taxing. And even then it might not be 100% accurate.

oh okay then, I might just have to gather them all into .txt document I can refer to later

thanks

Would require a server sided mod, a client sided mod, and looping through a lot of add-ons and then a lot of code(can you read .cs files with TorqueScript? I've never tried). Which is real taxing. And even then it might not be 100% accurate.
Well, what you can do is when the server inits you can make it loop through every file, but not so it locks up the game, so it runs in the background, and you could use a /Help or something. Of course this is never accurate too.

(can you read .cs files with TorqueScript? I've never tried)
they're just regular text files with a different extension. if you can open any other file there's no reason you wouldn't be able to open one of those

I'm sure you can mess with the console and have it tab through serverCmd programmatically and get the value of the input box. Yeah it's hacky but probably faster than looping through files, though it probably wont work on a Dedicated server.

Can't you just write all the commands down and maybe make a command listing them? I find that pretty useful.

Can't you just write all the commands down and maybe make a command listing them? I find that pretty useful.
Here's what OP can simply do:
When you start your server, in the server's console, do setLogMode(0);fileDelete("console.log");setLogMode(2);dumpConsoleFunctions();setLogMode(0);
After that, copy the console.log into a place you'll remember, that way you can look at all the existing commands. If it starts with serverCmd, that's what you want.
When you are done with this, you can do setLogMode(2); so your console can start recording again so you don't have to restart to fix the console.

so I decided to check out how much time it would take to loop through files looking for a specific thing, with python
I'm guessing that server commands need to be, like... registered, or something, so they probably have a pretty regular form in which they appear that can be searched for

I don't actually know what these functions should look like (if someone wants to tell me I could make this a little bit more interesting)
so I decided to just look for things that look like "mass = 10"
and I got these results:

Code: [Select]
Result list:
{
    'Tiger_Tire.cs': [
        'mass = 10'
    ],
    'Vehicle_Tiger.cs': [
        'mass = 300'
    ],
    'Vehicle_Tank.cs': [
        'mass = 200000',
        'mass = 10',
        'mass = 300'
    ],
    'JEEP_server.cs': [
        'mass = 300'
    ]
}

Time taken: 0.002830969774702307

the "result list" is actually not a list, it's a dictionary, and it's formatted like this
{
    'file name': [
        'first example found',
        'second',
        'etc'
    ]
}


to be completely honest, I just did this for fun. python is probably significantly faster than torquescript would be, not to mention the fact that I'm not checking in a bunch of compressed files (or even through a considerable number of uncompressed files)
but that's still a pretty short amount of time, and even if it was multiplied by a thousand it'd only be about three seconds
so take it as you will

here's the source code, if anyone's interested
http://pastebin.com/6J505QNZ
if you want to try it at home, you gotta put the file in a folder directly with other text files, NOT in a folder with folders that then have text files, and it certainly won't try to open any .zip files
like, this is what the folder I was playing with looked like:

(extra note: if you're using linux instead of windows, the time measurement is gonna be a LOT less accurate. that's because on windows, time.clock() is really accurate and time.now() isn't, but on linux it's the other way around. there's some function, somewhere, that abstracts that little detail away and automatically uses the right one for your platform but bleh. most of you are probably on windows too anyway)


...I put a lot more effort into this than I needed to
but if someone's interested, I could take a stab at making a python script that'll go through all your add-ons BEFORE you start a server, and stick all the commands it found in a text file, and you could make an add-on that'll use what's in that text file

really though, why do you need any kind of weird workaround anyway? if the commands have to be registered, I feel like there oughta be some simple way to get a list of them in torquescript :/
« Last Edit: October 20, 2015, 10:40:35 PM by Foxscotch »

Here's what OP can simply do:
When you start your server, in the server's console, do setLogMode(0);fileDelete("console.log");setLogMode(2);dumpConsoleFunctions();setLogMode(0);
After that, copy the console.log into a place you'll remember, that way you can look at all the existing commands. If it starts with serverCmd, that's what you want.
When you are done with this, you can do setLogMode(2); so your console can start recording again so you don't have to restart to fix the console.

oh okay
so I'm assuming commands with 'void' don't work, i.e.

   virtual void serverCmdFakeJoin() {}
   virtual void servercmdFakeTalk() {}
   virtual void servercmdFakeLeave() {}


instead of looking through each add-on couldn't you just look through the console log if what viso suggested me to do dumps all existing commands into the log..?

I don't actually know anything about how this works it just sounded like doing that would be much easier
« Last Edit: October 21, 2015, 10:35:14 AM by MikkelDude »

instead of looking through each add-on couldn't you just look through the console log if what viso suggested me to do dumps all existing commands into the log..?

I don't actually know anything about how this works it just sounded like doing that would be much easier
You can't read the console with TorqueScript.

You can't read the console with TorqueScript.
oh, then I guess I'll just be going through the list manually

so I'm assuming commands with 'void' don't work, i.e.
In strongly typed languages, you have to declare what type a function returns. Void means that it doesn't return any value
I don't know how torquescript determines that and how accurate or is though, since it doesn't have strong typing

I don't actually know what these functions should look like (if someone wants to tell me I could make this a little bit more interesting)
It's just a function with a name beginning with serverCmd

function serverCmdDoTheThing(%arguments)
{
    //function contents
}
« Last Edit: October 21, 2015, 12:08:29 PM by Headcrab Zombie »

You can't read the console with TorqueScript.
You can attach a ConsoleLogger to write to a file, then parse it.

You can attach a ConsoleLogger to write to a file, then parse it.
Hm, I thought that was broken, or am I thinking of something else?