SayFilters and SayCommands
I just added generators to iterate over server, client and say commands. https://github.com/Source-Python-Dev-Team/Source.Python/commit/0b73842c20980d230536560c06e7b02676687df0
Example:
Example:
Syntax: Select all
from commands.server import ServerCommandGenerator
from commands.client import ClientCommandGenerator
from commands.say import SayCommandGenerator
print('server commands:')
for command in ServerCommandGenerator():
print('\t', command)
print('client commands:')
for command in ClientCommandGenerator():
print('\t', command)
print('say commands:')
for command in SayCommandGenerator():
print('\t', command)
does the @SayCommand have to be in the main plugin file?
No, it doesn't
The plugin loads fine but the functionality isn't working.
How do you manage to distribute your code across multiple files? That might be the problem. Could you post some code?

My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam
Hail, Companion. [...] Hands to yourself, sneak thief.

iPlayer wrote:No, it doesn'tThe plugin loads fine but the functionality isn't working.
How do you manage to distribute your code across multiple files? That might be the problem. Could you post some code?
Right now I'm just testing stuff but the main gist is I have 2 files in the root directory of the plugin.
1) The main plugin file which sets up the plugin etc and imports the second file called say_test.py
Syntax: Select all
from test_plugin import say_test
2) say_test.py just basically has the saycommand function
Syntax: Select all
from commands.say import SayCommand
@SayCommand(['!help', '!admin'])
def pause_match(command, index, team):
print 'THIS WORKS!'
So yeah its very basic but I just wanted to see if I could make different modules and have the main plugin file be more of just a driver. I am expecting this to print 'THIS WORKS!' to the console when I type !help or !admin in chat. It seems like I have it correct but maybe I am missing something here?
Well, we're running Python 3, so I guess the problem is that you're trying to use print as an operator while it's actually a function.
Try this:
Although you should've been getting SyntaxError on that... But anyways, it works for me with parentheses included.
Also, are you sure you're not confusing my_plugin and test_plugin?
You can do
just to be more flexible.
Try this:
Syntax: Select all
print('THIS WORKS!')
Although you should've been getting SyntaxError on that... But anyways, it works for me with parentheses included.
Also, are you sure you're not confusing my_plugin and test_plugin?
You can do
Syntax: Select all
from . import say_test

My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam
Hail, Companion. [...] Hands to yourself, sneak thief.

Who is online
Users browsing this forum: No registered users and 93 guests