I have been looking through some of the addons in here and into Source Python.
I think it's pretty crazy have many things you have to import to create even the most simple scripts
You really have to read up on the documentation. In this case, why wouldn't I use sourcemod instead?
Any reason for that?
Imports
It isn't exactly 'easy' to learn SourceMod, either. You still have to learn about the same functionalities and how to use them, no matter which plugin you choose to create for. EventScripts (Python) was the same way. The design of Source.Python started out to provide a more Pythonic way of creating scripts than its predecessor, and that design is still alive and well today. Instead of teaching people bad programming habits, we strive to teach people to use OOP (Object Oriented Programming) ideas and to use proper documentation. Not that we don't appreciate what EventScripts taught us, but we wanted to eliminate the all-in-one mentality that ruled that plugin.
In all honesty, I would say blaming the number of imports and the fact you have to read the documentation are horrible reasons to not use a plugin. Everything in our design has a specific place where it belongs. Want to find out about 'player' specific functionality? Look into the 'players' package. Need to find out how to send a message and which messages you can send? Look into the 'messages' package. We also have a very friendly community, from what I have found, so feel free to ask questions if you are stuck or lost.
In all honesty, I would say blaming the number of imports and the fact you have to read the documentation are horrible reasons to not use a plugin. Everything in our design has a specific place where it belongs. Want to find out about 'player' specific functionality? Look into the 'players' package. Need to find out how to send a message and which messages you can send? Look into the 'messages' package. We also have a very friendly community, from what I have found, so feel free to ask questions if you are stuck or lost.
It clears things up... technically, Python doesn't "know" that there are any events. In fact, if you click something on the screen, an event is created and an event handler is called. The PC doesn't even know that there is an event going on, it will never, it just goes on to compute "until it dies" lol.
having that said, I'd say that explicitly importing the module makes it clear what the script is for. EventScripts, as I understood it, looks for all functions in the python file and if it finds a function name which matches an event name, like player_death, goes on to call this function with the proper arguments (userid and so on).
SP, again, as I understand it, 'registers' functions as events using the Event decorator. The function names have to be the same as the event name (I guess), but SP doesn't have to look for those in the python file, it just 'gets' them.
Imagine someone looking at some code and trying to figure out what it is (doesn't have any experience of SP or EventScripts, just pure Python).
Here, this guy can be 100% sure that player_death is an Event, because you explicitly declare it that way:Here, he/she doesn't (at least not 100%)Sure you can comment things, but why all those comments if the API does half the commenting for you while providing more flexible ways of doing things?
Yep, Python! :D
having that said, I'd say that explicitly importing the module makes it clear what the script is for. EventScripts, as I understood it, looks for all functions in the python file and if it finds a function name which matches an event name, like player_death, goes on to call this function with the proper arguments (userid and so on).
SP, again, as I understand it, 'registers' functions as events using the Event decorator. The function names have to be the same as the event name (I guess), but SP doesn't have to look for those in the python file, it just 'gets' them.
Imagine someone looking at some code and trying to figure out what it is (doesn't have any experience of SP or EventScripts, just pure Python).
Here, this guy can be 100% sure that player_death is an Event, because you explicitly declare it that way:
Syntax: Select all
from events import Event
@Event
def player_death(game_event):
pass
Syntax: Select all
import es
def player_death(event_var):
pass
velocity wrote:In this case, why wouldn't I use sourcemod instead?
Any reason for that?
Yep, Python! :D
Return to “General Discussion”
Who is online
Users browsing this forum: No registered users and 34 guests