Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ConVar support #4

Open
jaredballou opened this issue Aug 4, 2016 · 5 comments
Open

ConVar support #4

jaredballou opened this issue Aug 4, 2016 · 5 comments

Comments

@jaredballou
Copy link

Hi, I added a very crude attempt to put CreateConVar and GetConVar(Bool|Int|String) support into my PySMX fork with little success. It seems like an essential part of making any plugin work, and I'd love to help add this to PySMX. If you look at my fork you can see what I've done, but it's far from functional at this point. If there is anything I can do to help make this work, let me know.

@theY4Kman
Copy link
Owner

theY4Kman commented Aug 11, 2016

I had a go at this last week. I had success, but eventually became disappointed with the convoluted state of the package and called it a night. I'll commit this soon, as I also try to bring the package toward a maintainable state.

btw, you might want to use an editor that displays whitespace, particularly the difference between tabs and spaces, like this:
Show whitespace
I noticed a place in your code where tabs and spaces are mixed. Because the size of a tab width can be different between editors (some use 8 spaces to a tab), it's easy to mistake indentation levels.

@theY4Kman
Copy link
Owner

theY4Kman commented Aug 11, 2016

I committed a proof of concept in 9b6920a. String stuff got a bit hairy, so it's not in there for now.

@jaredballou
Copy link
Author

Yeah I hate the fact that python uses spaces instead of tabs. But I pulled your latest code to my fork, I am going to see if I can't learn from what you did and add the get/set functions for all the other types.

Whats your thinking around commands? I need to support Reg(Console|Server|Admin)Cmd functions. My plan was to just stub them, but were you planning on supporting any kind of command interface for the runtime?

@theY4Kman
Copy link
Owner

Yes, the plan is to simulate or at least stub the most used of the SM natives. You'll be able to extract info about convars and commands through an exposed interface.

btw, Python doesn't care whether you use tabs or spaces, as long as it's consistent. As a pragmatist, though, I prefer spaces, because it simply avoids trouble.

@jaredballou
Copy link
Author

Cool. I posted in the other issue regarding some stubs I threw in, and some ideas on how to read the .inc files and generate the stubs for us. My guess is that doing all the natives by hand will quickly get monotonous and boring, so finding a way to use some automation might make it easier. I'll wait on making any serious changes for a bit, I see you pushed another commit last night and I really need to sit down and read through all the code to start understanding it better. I'm really excited about the potential to unit test my SourceMod plugins, especially given how bad I am at writing efficient Pawn code.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants