Page 1 of 1

commandhelper

Posted: Thu Nov 14, 2013 4:23 pm
by learn_more
shows all commands available to you (can search with wildcards)
all commands:
Code: Select all
/commands
all commands with 'map' in em:
Code: Select all
/commands *map*
all commands starting with 'map':
Code: Select all
/commands map*

https://github.com/learn-more/pysnip/bl ... andhelp.py

[code"""
Command helper.
Copyright (c) 2013 learn_more
See the file license.txt or http://opensource.org/licenses/MIT for copying permission.

Lists all commands available to you (permission based).
"""

from commands import add, admin, commands as cmdlist, aliases as aliaslist
import fnmatch

def commands(connection, value = None):
names = []
for command in cmdlist:
command_func = cmdlist[command]
if (hasattr(command_func, 'user_types') and command not in connection.rights):
continue
include = False
if (value is None or fnmatch.fnmatch(command, value)):
include = True
aliases = []
for a in aliaslist:
if aliaslist[a] == command:
if (value is None or fnmatch.fnmatch(a, value)):
include = True
aliases.append(a)
cmd = command if len(aliases) == 0 else ('%s (%s)' % (command, ', '.join(aliases)))
if include:
names.append(cmd)
return 'Commands: %s' % (', '.join(names))

add(commands)

def apply_script(protocol, connection, config):
return protocol, connection
[/code]

Re: commandhelper

Posted: Thu Nov 14, 2013 5:07 pm
by [HPC]sajt
xDD bad.

Re: commandhelper

Posted: Thu Nov 14, 2013 5:08 pm
by [HPC]sajt
You don't know what the /help command?

Re: commandhelper

Posted: Thu Nov 14, 2013 5:10 pm
by Kuma
wow amazing, this is a 10 times better then your demolition man script. (In terms of practical usage)
[HPC]sajt wrote:
You don't know what the /help command?
Sajt, Help command gives you a bunch of pre entered text, this will give the list of all commands available to you. And why did you double post?

Re: commandhelper

Posted: Thu Nov 14, 2013 5:52 pm
by learn_more
[HPC]sajt wrote:
You don't know what the /help command?
clearly you don't know that help command works only half for admins (it only shows commands that are predefined in the server), and for non admins it will just show a dumb text.

this one works for everyone with every level (guard, builder, admin) and show them all commands and aliases available to them.

Re: commandhelper

Posted: Fri Nov 15, 2013 8:25 am
by thepolm3
This is awesome. Overwriting the default help command for this

Re: commandhelper

Posted: Wed Nov 20, 2013 1:21 am
by gamemaster77
I was actually just thinking about something like this when you made this. Very useful

Re: commandhelper

Posted: Thu Jan 16, 2014 7:52 pm
by izzy
Helpful! Now usable on all aloha.pk servers.

Re: commandhelper

Posted: Tue Jan 21, 2014 3:17 pm
by Dare
If I want to use this cool command map on my server, I'll just need to add this script
https://github.com/learn-more/pysnip/bl ... andhelp.py in the config file?

Re: commandhelper

Posted: Tue Jan 21, 2014 6:47 pm
by learn_more
add the script and enable it in the config, yes.