Raised This Month: $51 Target: $400
 12% 

Important question: How can newbies learn SourcePawn?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TotalChaos SourcePawner
Senior Member
Join Date: Feb 2023
Location: IN PINEAPPLE, UNDER SEA
Old 04-02-2023 , 16:00   Important question: How can newbies learn SourcePawn?
Reply With Quote #1

4/8/2023: Don't bother with this post anymore, unless you really want to.









Please do not skim through this. If you're reading this post, please read everything I have to say, because it's important.

I am not trying to be rude, I am asking legitimate questions.

I need to reach out to people and ask if this is normal, and what I'm doing wrong, because I am beyond confused.

I will try to keep this as professional as I can.
But inside I'm losing my mind, and my brain is being fried nearly every single time I try to code with SourcePawn.


This is not an April Fools joke. I am asking real questions, and I expect real answers.

This post has gone through several revisions over the past year (late 2021 to present day), and I've been debating whether or not I should post this the entire time. I didn't just write this today; This took nearly, if not over a year of thinking and experiencing everything first-hand.


This is something I've been struggling with since day one of coding with SourcePawn.
I can't find good documentation, for anything.

All the documentation I'm seeing doesn't really explain how anything works, or how to use anything.
All I'm understanding is "Hey, just so you know, this exists.".
Nothing about how to use it, what it is, what it does, no examples, setting it up, nothing.

Google is no help at all.
There has been countless times that I've tried to look stuff up, and I get results in other languages, books, news articles, airplanes (as a recent one), Hot Wheels toys (not often), shady sites, and plenty of other unrelated stuff.
Sometimes I get absolutely no results at all (zero results page).

I don't want to have to ask a question for something that should be extremely simple, and then have somebody else basically write the entire plugin for me. I should be able to look up the documentation for something, then go from there.
If I start asking questions, then there will be one or more brand new posts from me almost every day. Eventually people are going to get annoyed, and stop responding.

I haven't looked through the entirety of the introduction pages, because of how long they are. And I don't like wasting time on stuff that I don't need to know because either I don't need to know it (one of many reasons are it's not what I need to know for something else), or I already know it.

Also, the compiler(s).
Why does it spit out gibberish when you do something it doesn't like? Why can't it give you more information on what you did wrong, and possible solutions?
Because I can guarantee you, I can't look up errors such as "function prototypes do not match" because it's referring to my code, which nine times out of ten, I have absolutely no idea how to fix. And the most I can do is guess, which has a 50/50 chance of being successful.

The only way that I've ever been able to learn anything with SourcePawn is doing it myself. And even then 80-90% of my plugins are mostly failures because I don't know what I'm doing.


I learn things differently than other people. I can't take a coding class or read or watch something incredibly long because I won't learn anything that way (believe me when I say I've really tried).
I have to tackle one problem head-on at a time, not learn millions of other useless things then take it or more on.
I learn things by doing it myself, and I need a bit of help along the way. And when I don't get that help, I don't get anywhere.


Sorry if this comes off as rude, that's not my intention.
I just need some explaining to me, because I am very confused by all of this.
I've been working with SourcePawn for almost (if not over) a year now, and I still don't understand anything.
Please, explain things to me. I'm begging, help me understand.


Thank you for reading,
TotalChaos.

Last edited by TotalChaos SourcePawner; 04-08-2023 at 13:38.
TotalChaos SourcePawner is offline
Earendil
Senior Member
Join Date: Jan 2020
Location: Spain
Old 04-02-2023 , 17:12   Re: Important question: How can newbies learn SourcePawn?
Reply With Quote #2

Its possible to learn SourcePawn without a programming basis, but it will be really hard.

I'm going to talk in my personal experience. I started making extremely simple scripts for L4D2 to integrate in maps using VScripts (Squirrell programming language). So when I moved to SP i had a basic knowledge of structurated languages. And even with a base, I found really hard how to make code here, I needed help watching other plugins, asking a lot of questions and a lot of trial and error.

Your first time learning your first programming language will be the hardest one. Because all imperative languages share the same basic principle that once you have learned it, you will apply on all languages, once you have learned one, you can start moving to other langauges with more ease.

How to learn SourcePawn from scratch? There are some videos on YouTube, you have tons of plugins written here to watch how they are made and how they work. But the help is sorta limited, have it in mind.

And learning another programming language? Probably is better, because there are a lot of languages that are very used and you can find a huge amount of tutorials. What languages?
  • Python: Just made to be simple to learn, has a great community and you will find a lot of tutorials of how to learn. But the code looks different than SP, and you maybe will find a little lost once you move from one language to the other the first time, but once you understand the basis you will adapt easily. Usually most people starts programming with this language.
  • C: "Low level" language, in fact SourcePawn is very similar to C. Its (much?) harder to learn than Python and has a lot of low-level features that you won't find in SP. If you learn C, you will start making plugins in SP easily, but it may be a hard language for first timers.
  • Java: I had to study this one in my degree after knowing SP and I found it very easy to learn, its a high-level language and object oriented but has a great community and tons of tutorials to learn it. Looks similar than C so you will adapt easily, but is Object Oriented and thats not implemented in SP, so if you rely on objects, interfaces, ect you will need to learn how to work without them.

Remember this: SourcePawn is not an "All Purpose" programming language. It was not made to make programs, it was made to make simple plugins, so there is not a huge comunity with hundreds of thousands of users that will help you, there is not much help in StackOverflow (what I use to solve the 90% of my problems when I don't know how to solve a problem in my Java/JavaScript code).

But the most important is not SourcePawn itself, its programming. There are people who find it fun, there are people who find it confusing and boring, if you don't like to write code, you won't like to do it in SP, the language doesn't. Don't blame the language, blame the programming itself, maybe you don't like programming, maybe you will find it harder than other people.

So I would recomend you to learn any other languages first. Probably it will be faster than learning SP directly and you will learn more and you will find a better and easier way. And always watch this post, it has a lot of basic info and tips.
__________________
>>My plugins<<
>>GitHub<<
Earendil is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 04-02-2023 , 18:39   Re: Important question: How can newbies learn SourcePawn?
Reply With Quote #3

You should start trying to learn some programming stuff,
I started from c# language which is very different from c++ or pawn.

After understanding the basics of logic and programming, the next goal is trying to create a simple plugin like "PrintToChat" stuff to understand how things works

Then try reading and learning from some good coders what they have done and figure out "why" they did like that.

The rest is learning by search, is not an easy path, and you won't understand everything from day 1, but the best way to learn anything is by trial and error.

Anyway is how I learned most of stuff and a way that works for me.

This is a good thread to read about: [TUT] SourcePawn Scripting - Tips, Basics to Advanced
__________________

Last edited by Marttt; 04-02-2023 at 20:26.
Marttt is offline
TotalChaos SourcePawner
Senior Member
Join Date: Feb 2023
Location: IN PINEAPPLE, UNDER SEA
Old 04-02-2023 , 21:15   Re: Important question: How can newbies learn SourcePawn?
Reply With Quote #4

Thank you both for the responses. But I'm not interested in coding with those, because I don't know what I'm going to do with them.
I want to code plugins for SourceMod. And Python, C, C#, C++, Java, JavaScript and every other coding language won't help me with coding SourceMod plugins all that much.
In fact, I'm pretty familiar with GLua, GMod's coding language for creating addons.
Not only that, but I have worked with VScript/Squirrel before (mostly in L4D2). But I'm not nearly as good with VScript as I am with GLua.
You see, GLua just clicked with me for the most part. And SourcePawn... Just doesn't.
I'm not saying GLua was easy, not by a long shot. But it was a heck of a lot easier than SourcePawn.
I know how to code, just not in SourcePawn.
Thanks again for the replies, I will be looking into some of those a bit.


Also,
something I wanted to clarify in my main post, by "other languages" I don't mean coding languages. I mean the majority of it isn't in English, or isn't even part of the Latin script at all. I'm talking about Cyrillic, Coptic, Armenian, non-Alphabetical, and whatever else there is. https://en.wikipedia.org/wiki/Writing_system
Yes, sometimes other coding languages came up. But that's not the point.
The point is, Google is useless and I hate it. I've hated Google for years because nine times out of ten it doesn't understand very simple searches (e.g. I search for something for L4D1 and every single result is either for L4D2 or completely unrelated). This has even spread to YouTube, and not just the searching system.

Sorry if this comes off as rude, I don't mean that.
I have a tendency to sound rude sometimes.
I've been a bit stressed lately due to some real life stuff, and the inability to understand SourcePawn (and the compiler errors) has been harder on me than usual because of that.
TotalChaos SourcePawner is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 04-02-2023 , 22:05   Re: Important question: How can newbies learn SourcePawn?
Reply With Quote #5

I think what the two people above are trying to say is that you will have a much easier time learning other programming languages because they have larger communities with so many examples and extensive documentation. Yes, you can learn SourcePawn first, but you would have to deal with the lack of documentation and resources. Learning similar languages first will make it easier for you to come back to SourcePawn with a better understanding of programming in general.

Personally, SourcePawn was the very first programming language I learned in my entire life and I cannot explain how long it took me to get to where I am now. Once I branched out and took some beginner classes for C++, Java, Python, and SQL, I had a much better understanding of programming. I recommend learning the basics of languages like C, C++, Java, and Python, like someone said above.

In your main post, you mentioned that you don’t learn well through watching long videos and reading long documentation right? Well if you want to learn SP, you’ll have to slowly learn to adapt to both along with learning from other people’s work. You can pause videos so you don’t have to digest so much new information in one sitting, you can also read one paragraph at a time, etc. You just have to ask yourself how much effort are you willing to put into learning SP. It took me years to learn everything I know now, and I won’t lie, it took a lot of patience, trial and error, and lots of criticism from multiple people.
__________________
Psyk0tik is offline
TotalChaos SourcePawner
Senior Member
Join Date: Feb 2023
Location: IN PINEAPPLE, UNDER SEA
Old 04-02-2023 , 23:40   Re: Important question: How can newbies learn SourcePawn?
Reply With Quote #6

Ok, thanks for clearing that up a bit Psyk0tik.
I think I get it now. I'm not the only one in this boat.
SourcePawn is a pain in the butt for everybody.

If that's the case, why not make some improvements on the documentation and the tools available?
I mean, I can't be the only one on the planet that wants some of the things I mentioned in my main post, right?
More and better documentation on what certain functions and other things do in games, improved compiler that goes into better detail with what you did wrong and provides possible solutions, and other stuff. Surely other people have wanted those, right?

I really feel like there's some things on both this site, SourceMod itself and its tools that could use a serious overhaul.
Either that or I'm just dumb, which is entirely possible (and incredibly likely) knowing me.
Things just don't feel beginner-friendly to me, and I already mentioned that I'm pretty familiar with GLua.
I've created entire SWEPs and NPCs with GLua. The NPCs being mostly DRGBase stuff.
I've created tons of functions, delays and timers, played audio, swapped audio sets, swapped textures, created CVars, set animations, swapped animation sets, created entire separate modes, toggleable abilities (did I mention that I could make everything toggleable, and customizable?), and plenty of other things all with GLua. I know my stuff.
But SourcePawn? That feels like an entirely different beast. Even C++ feels like a nightmare.
Sure, not every adventure with GLua was a win, but I feel like I was much more successful with GLua than SourcePawn.

Last edited by TotalChaos SourcePawner; 04-02-2023 at 23:59.
TotalChaos SourcePawner is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 04-03-2023 , 01:14   Re: Important question: How can newbies learn SourcePawn?
Reply With Quote #7

Quote:
Originally Posted by TotalChaos SourcePawner View Post
Ok, thanks for clearing that up a bit Psyk0tik.
I think I get it now. I'm not the only one in this boat.
SourcePawn is a pain in the butt for everybody.

If that's the case, why not make some improvements on the documentation and the tools available?
I mean, I can't be the only one on the planet that wants some of the things I mentioned in my main post, right?
More and better documentation on what certain functions and other things do in games, improved compiler that goes into better detail with what you did wrong and provides possible solutions, and other stuff. Surely other people have wanted those, right?

I really feel like there's some things on both this site, SourceMod itself and its tools that could use a serious overhaul.
Either that or I'm just dumb, which is entirely possible (and incredibly likely) knowing me.
Things just don't feel beginner-friendly to me, and I already mentioned that I'm pretty familiar with GLua.
I've created entire SWEPs and NPCs with GLua. The NPCs being mostly DRGBase stuff.
I've created tons of functions, delays and timers, played audio, swapped audio sets, swapped textures, created CVars, set animations, swapped animation sets, created entire separate modes, toggleable abilities (did I mention that I could make everything toggleable, and customizable?), and plenty of other things all with GLua. I know my stuff.
But SourcePawn? That feels like an entirely different beast. Even C++ feels like a nightmare.
Sure, not every adventure with GLua was a win, but I feel like I was much more successful with GLua than SourcePawn.
I agree that there could be better and more formal/official documentation with examples for every function, implementation, etc. but I also think that for now we can still work with what's out there. Whenever I encounter something new in SP that I've never tried or done before, I google as many related keywords as I can and read up on as many forum posts related to the topic as I can find. Whenever a new function or feature is added to SP, I immediately try it in a test plugin and see how it works.

I highly recommend going through all the introduction pages and watching the long tutorial videos that you find online. As tedious as they may seem, you won't learn anything from SP just from documentation and examples alone. You can learn by doing and that can apply to any concept in life, not just in programming. This post is the best one to start reading as it contains a collage of all the information every beginner should learn.

Here are sites that have documentation for every function available in SM. All the information is directly retrieved from the .inc files inside addons/sourcemod/scripting/include folder. The only things missing are examples for how each function can be implemented for which purposes.

1. SourceMod.dev
2. SourceMod API
3. Old SourceMod API (Outdated due to old syntax)
__________________

Last edited by Psyk0tik; 04-03-2023 at 01:15.
Psyk0tik is offline
TotalChaos SourcePawner
Senior Member
Join Date: Feb 2023
Location: IN PINEAPPLE, UNDER SEA
Old 04-03-2023 , 10:37   Re: Important question: How can newbies learn SourcePawn?
Reply With Quote #8

Quote:
Originally Posted by Psyk0tik View Post
I agree that there could be better and more formal/official documentation with examples for every function, implementation, etc. but I also think that for now we can still work with what's out there. Whenever I encounter something new in SP that I've never tried or done before, I google as many related keywords as I can and read up on as many forum posts related to the topic as I can find. Whenever a new function or feature is added to SP, I immediately try it in a test plugin and see how it works.

I highly recommend going through all the introduction pages and watching the long tutorial videos that you find online. As tedious as they may seem, you won't learn anything from SP just from documentation and examples alone. You can learn by doing and that can apply to any concept in life, not just in programming. This post is the best one to start reading as it contains a collage of all the information every beginner should learn.

Here are sites that have documentation for every function available in SM. All the information is directly retrieved from the .inc files inside addons/sourcemod/scripting/include folder. The only things missing are examples for how each function can be implemented for which purposes.

1. SourceMod.dev
2. SourceMod API
3. Old SourceMod API (Outdated due to old syntax)
Thank you very much, Psyk0tik. I will be looking into some of that stuff.

Also, I just noticed that you have a link to a GitHub page in your signature for L4D1/2 GameDatas.
I've been looking for a way to port some L4D2-only plugins to L4D1 for a while now, and I couldn't because they use GameData. This one, for example: https://forums.alliedmods.net/showthread.php?p=2775297
Now that I've found all that, I think I might try porting some plugins. I wouldn't be surprised if it doesn't work, though.
Edit: Nevermind. I don't know how to convert between GameDatas, because that plugin uses a format different to what your GameDatas use.
Edit 4/5/2023: Actually, it's formatted very similarly to yours. But it uses signatures that I certainly can't find anywhere else (thanks Google, you useless piece of garbage).

Last edited by TotalChaos SourcePawner; 04-05-2023 at 13:25.
TotalChaos SourcePawner is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 04-04-2023 , 11:52   Re: Important question: How can newbies learn SourcePawn?
Reply With Quote #9

I think part of the struggle is that SourceMod doesn't exist in a vacuum; anything you do to the game may produce additional side effects that you weren't aware of, or may be ignored. GLua is different in that Garry's Mod is built around tooling to allow people to create things; SourceMod is bolted on to a black box and there's very relatively little functionality on hand to inspect the game state unless you get into disassembling the game itself.

The compiler thing is indeed a pain point - I'd love to see more user-friendly error messages, especially with the infamous "function prototypes do not match", but there's so few people familiar with the compiler to know what to change to make it all happen. I'm not sure of the state it's in now, but I think it's worth opening a discussion for.

The introductory stuff on the wiki has a lot of good information, but it does take time to get to the meat of things. Silvers's guide, while comprehensive, is very much an collage of information without any direction. I've been working on my own opinionated guide on and off for that reason, and I've contributed the latter half of the Frequently Asked Questions section on this page.

As far as learning goes, the only thing I can really suggest is look at others' sources; and compile early, compile often. The former to get an understanding of usage, the latter to catch issues as they happen instead of getting bitten by something that you already stopped focusing on.

(Also, get used to refining your searches - while ideally you get what you're looking for, you should be getting zero results over completely unrelated things.)

All this information is annoyingly scattered all over the place, for sure.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)
nosoop is offline
TotalChaos SourcePawner
Senior Member
Join Date: Feb 2023
Location: IN PINEAPPLE, UNDER SEA
Old 04-05-2023 , 14:33   Re: Important question: How can newbies learn SourcePawn?
Reply With Quote #10

Quote:
Originally Posted by nosoop View Post
I think part of the struggle is that SourceMod doesn't exist in a vacuum; anything you do to the game may produce additional side effects that you weren't aware of, or may be ignored. GLua is different in that Garry's Mod is built around tooling to allow people to create things; SourceMod is bolted on to a black box and there's very relatively little functionality on hand to inspect the game state unless you get into disassembling the game itself.

The compiler thing is indeed a pain point - I'd love to see more user-friendly error messages, especially with the infamous "function prototypes do not match", but there's so few people familiar with the compiler to know what to change to make it all happen. I'm not sure of the state it's in now, but I think it's worth opening a discussion for.

The introductory stuff on the wiki has a lot of good information, but it does take time to get to the meat of things. Silvers's guide, while comprehensive, is very much an collage of information without any direction. I've been working on my own opinionated guide on and off for that reason, and I've contributed the latter half of the Frequently Asked Questions section on this page.

As far as learning goes, the only thing I can really suggest is look at others' sources; and compile early, compile often. The former to get an understanding of usage, the latter to catch issues as they happen instead of getting bitten by something that you already stopped focusing on.

(Also, get used to refining your searches - while ideally you get what you're looking for, you should be getting zero results over completely unrelated things.)

All this information is annoyingly scattered all over the place, for sure.
Both AlliedModders and SourceMod need serious work done if this is all true.
How can you have something this great going since 2004, and the documentation and tools are still trash in 2023? That's just bizarre and completely pointless (unless the devs are purposefully trying to mess with beginners, which is doubtful).

And no, I've pretty much lost all hope in Google by this point. It's just plain unreliable. And YouTube isn't any better since it's been bought and run by Google since late 2006.
I haven't tried other search engines much, but I don't have any hope in them either (I have tried Bing for one search, it seems to be just as bad as Google).

NOTE: I'm about to go off on a rant about Google being absolute trash.

I don't even know how to refine my searches anymore. I can reword my searches over a hundred times, and it still doesn't understand (or completely ignores) what I search.
And, a previous example, if I search for something for Left 4 Dead (L4D, L4D1, 2008, etc.), it still thinks I'm talking about the sequel. And whenever it stops giving results for Left 4 Dead 2, it gives me things that are just so incredibly unrelated, that it almost looks like it's trying to give me incorrect results.
Take this page as an example:
https://wiki.alliedmods.net/Left_4_dead_2_events
I searched "l4d1 hook events", and that was the only page that came up for it.
Not only that, but every single other result was either for Left 4 Dead 2, or completely unrelated to the Left 4 Dead series whatsoever.
This page:
https://wiki.alliedmods.net/Left_4_dead_events
The correct page was the very last result, and I had to click the link to include omitted results that were supposedly very similar to the ones already shown. And, I had to click "show more results" dozens of times.
Google is fundamentally broken, and it has been for years.

Still don't believe me? Take a look for yourself:
https://www.google.com/search?q=l4d1...6&bih=617#ip=1
Oh and guess what, I tested that in Google Chrome after using Firefox!
Three of the results were, and I kid you not, were either literal porn pages or disguising as porn pages. And I know one was real because it was Pornhub. It thinks that I want porn over game events that I can hook in code. I don't even know how those are related!
The correct page was absolutely buried under Left 4 Dead 2, Craigslist, Wii, spouses, homicide, Splatoon, Apex Legends, Pokemon, Back 4 Blood, Dying Light, horror mystery novels, pages in other languages, Poptropica, The Walking Dead, Team Fortress 2, Dead by Daylight, the Blizzard game company, shootings, and many more pages, lots of which not even being AlliedModders.
If you can even begin explaining how any of that (and the other results) comes anywhere close to my original search, you should be a trillionaire for that alone. And fixing it? Every government in existence should be pouring money into your pockets 24/7; Unlimited money.
You would be considered the smartest person on the planet, and you would be winning thousands, if not millions of rewards.
You could buy yourself a chocolate bar with that kind of money. Maybe with nuts.


Sorry if this comes off as rude. I just hate Google, and I need to get a point across somehow that Google just doesn't work.

Last edited by TotalChaos SourcePawner; 04-05-2023 at 18:56.
TotalChaos SourcePawner is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:12.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode