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

[ANY|Source 2009] Advanced Advertisements


Post New Thread Reply   
 
Thread Tools Display Modes
minimoney1
SourceMod Donor
Join Date: Dec 2010
Old 05-29-2012 , 00:05   Re: [ANY|TF2] Advanced Advertisements
Reply With Quote #11

Quote:
Originally Posted by 11530 View Post
Awesome, thanks for the info minimoney1, and for taking the time to do this plugin.

Quick question: would completely custom RGB(A) values be worth it, or do you reckon the More Colors library suffices? It is certainly useful to know the names for colors, however if you wanted complete custom support, I wrote a function here you can use should you ever want to implement it.
Well, one of the main reasons to why I created this plugin over the other ones in the ones shared in the original advertisement plugin's thread was because I wanted it to be simple and easy to use for everyone, but of course I didn't forget about people who want to customize it to the max, and that's why I created the config for custom colors. If you look in the configs folder you'll see 2 configuration files for this plugin: one for advertisements and one for custom colors. Although I can't say for sure that the custom colors is working fine, the function of it is to add colors to the MoreColors trie, so let's say I add palepink to the config (which I have added as an example), then I can use {palepink} and it would represent the hex value that I have specified for palepink in the config.
I think this way is much simpler and better for the users who still don't get the idea, as it would let users share custom color configs and make things simpler overall.

This, of course, also means that we are limited to what More Colors provides us with, and from what I know it's still in beta and being worked on, but for the most part, it's a very good library when it comes to simplicity. If it has a lot of limitations, I will integrate your code w/ my current plugin and let people use custom tags, but for now I think this method is good.

Last edited by minimoney1; 05-29-2012 at 00:07.
minimoney1 is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 05-29-2012 , 00:17   Re: [ANY|TF2] Advanced Advertisements
Reply With Quote #12

Great news! For now, I'll have to think up some original names for my custom colors!

I'll scour through the code soon, however ensure that Extra names that are already in use in More Colors create some form of message in the logs.

Also, this config file is named "□extra_ad_colors.txt" in the zip (note the odd character at the beginning) but also uses a different name "extra_colors.txt" as default in the script.

Additionally, would this work for tf_beta for those who have it? Since that could be checked for in OnPluginStart() too.

Edit: It might be useful for users to know available cvars and commands too. Call me picky hehe!
__________________

Last edited by 11530; 05-29-2012 at 00:23.
11530 is offline
minimoney1
SourceMod Donor
Join Date: Dec 2010
Old 05-29-2012 , 00:30   Re: [ANY|TF2] Advanced Advertisements
Reply With Quote #13

Quote:
Originally Posted by 11530 View Post
I'll scour through the code soon, however ensure that Extra names that are already in use in More Colors create some form of message in the logs.
My apologies, but I didn't quite catch that.

Quote:
Originally Posted by 11530 View Post
Also, this config file is named "□extra_ad_colors.txt" in the zip (note the odd character at the beginning) but also uses a different name "extra_colors.txt" as default in the script.
Yep, I see it now. It's been fixed in the newest version. I don't know how that extra char got there, but just delete that file and get the newest version (Updater should do it for you).

Quote:
Originally Posted by 11530 View Post
Additionally, would this work for tf_beta for those who have it? Since that could be checked for in OnPluginStart() too.
Fixed that as well, but I can never assure if this would work on TF2 Beta or not, but it should.

Quote:
Originally Posted by 11530 View Post
Edit: It might be useful for users to know available cvars and commands too. Call me picky hehe!
Oh no, this is really great!

Last edited by minimoney1; 05-29-2012 at 00:31.
minimoney1 is offline
ReFlexPoison
☠☠☠
Join Date: Jul 2011
Location: ☠☠☠
Old 05-29-2012 , 00:42   Re: [ANY|TF2] Advanced Advertisements
Reply With Quote #14

Getting some errors...
Code:
L 05/28/2012 - 21:39:51: [SM] Native "KvGetString" reported: Invalid key value handle 0 (error 4)
L 05/28/2012 - 21:39:51: [SM] Displaying call stack trace for plugin "adv_adverts_tf2.smx":
L 05/28/2012 - 21:39:51: [SM]   [0]  Line 287, C:\Users\mINI\Documents\GitHub\SM-TF2-Advanced-Ads\scripting\adv_adverts.sp::AdvertisementTimer()
and

Code:
L 05/28/2012 - 21:40:11: [SM] Native "KillTimer" reported: Invalid timer handle 23401b4 (error 3)
L 05/28/2012 - 21:40:11: [SM] Displaying call stack trace for plugin "adv_adverts_tf2.smx":
L 05/28/2012 - 21:40:11: [SM]   [0]  Line 275, C:\Users\mINI\Documents\GitHub\SM-TF2-Advanced-Ads\scripting\adv_adverts.sp::TimerDelayChange()
Configs:
Spoiler

First one is probably due to my config files, which I've posted.
Second one was probably due to me changing the time interval but I'm shooting out a guess that it isn't supposed to error out ;)

Last edited by ReFlexPoison; 05-29-2012 at 00:44.
ReFlexPoison is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 05-29-2012 , 00:52   Re: [ANY|TF2] Advanced Advertisements
Reply With Quote #15

I wonder if it's possible to make the TF2 extension an optional dependency and detect if TF2 is being used that way.

This might address the tf_beta issue as well.

The code would look something like this:

PHP Code:
#undef REQUIRE_EXTENSIONS
#tryinclude <tf2>

new bool:g_bIsTF2 false;

public 
OnAllPluginsLoaded()
{
    
g_bIsTF2 LibraryExists("tf2");
}

public 
OnLibraryAdded(const String:name[])
{
    if (
StrEqual(name"updater"))
    {
        
Updater_AddPlugin(UPDATE_URL);
    }
    else if (
StrEqual(name"tf2"))
    {
        
g_bIsTF2 true;
    }
}

public 
OnLibraryRemoved(const String:name[])
{
    if (
StrEqual(name"tf2"))
    {
        
g_bIsTF2 false;
    }

and then you'd use if (g_bIsTF2) blocks everywhere you currently have #if defined TF2COLORS.

Note: I didn't test this, not even in PawnStudio, so there may be syntax errors in it.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 05-29-2012 at 00:53.
Powerlord is offline
minimoney1
SourceMod Donor
Join Date: Dec 2010
Old 05-29-2012 , 00:54   Re: [ANY|TF2] Advanced Advertisements
Reply With Quote #16

Thank you all for all the bug reports. I released version 1.0.1, it should fix all the above errors and hopefully function a lot better.
minimoney1 is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 05-29-2012 , 00:57   Re: [ANY|TF2] Advanced Advertisements
Reply With Quote #17

Quote:
Originally Posted by Powerlord View Post
I wonder if it's possible to make the TF2 extension an optional dependency and detect if TF2 is being used that way.

This might address the tf_beta issue as well.

*clip*

and then you'd use if (g_bIsTF2) blocks everywhere you currently have #if defined TF2COLORS.

Note: I didn't test this, not even in PawnStudio, so there may be syntax errors in it.
This is what I was saying in post #4 however, what's the difference between using libraries/extensions and just using:

PHP Code:
g_bIsTF2 IsTF2();

stock bool:IsTF2()
{
    
decl String:sGameDir[64];
    
GetGameFolderName(sGameDirsizeof(sGameDir));
    if (!
strcmp(sGameDir"tf"false) || !strcmp(sGameDir"tf_beta"false))
    {
        return 
true;
    }
    return 
false;

__________________
11530 is offline
minimoney1
SourceMod Donor
Join Date: Dec 2010
Old 05-29-2012 , 01:01   Re: [ANY|TF2] Advanced Advertisements
Reply With Quote #18

Quote:
Originally Posted by Powerlord View Post
I wonder if it's possible to make the TF2 extension an optional dependency and detect if TF2 is being used that way.

This might address the tf_beta issue as well.

The code would look something like this:

PHP Code:
#undef REQUIRE_EXTENSIONS
#tryinclude <tf2>

new bool:g_bIsTF2 false;

public 
OnAllPluginsLoaded()
{
    
g_bIsTF2 LibraryExists("tf2");
}

public 
OnLibraryAdded(const String:name[])
{
    if (
StrEqual(name"updater"))
    {
        
Updater_AddPlugin(UPDATE_URL);
    }
    else if (
StrEqual(name"tf2"))
    {
        
g_bIsTF2 true;
    }
}

public 
OnLibraryRemoved(const String:name[])
{
    if (
StrEqual(name"tf2"))
    {
        
g_bIsTF2 false;
    }

and then you'd use if (g_bIsTF2) blocks everywhere you currently have #if defined TF2COLORS.

Note: I didn't test this, not even in PawnStudio, so there may be syntax errors in it.
The method you are introducing is a great method (Also introduced somewhat by 11530), but the problem is, we don't want the compiler to include both colors.inc and morecolors.inc, as their stocks have the same name. That is exactly why I use #if defined statements and not if () {} statements, because the two libraries (colors and morecolors) work the same way, meaning the stocks do the same functions and have the same parameters, so this makes it real easy for us but makes it not possible to approach it an automated way.
tl;dr #if defined is a compiler statement that just ignores the code that doesn't apply and doesn't compile it at all.
minimoney1 is offline
minimoney1
SourceMod Donor
Join Date: Dec 2010
Old 05-29-2012 , 01:11   Re: [ANY|TF2] Advanced Advertisements
Reply With Quote #19

Version 1.0.2 is out
This version has fixed two major text-replacement errors and one bug about the array being out of bounds.
minimoney1 is offline
AeroAcrobat
AlliedModders Donor
Join Date: Apr 2011
Location: lives in a circus
Old 05-29-2012 , 08:01   Re: [ANY|TF2] Advanced Advertisements
Reply With Quote #20

this is really great!

one suggestion:
could you add also this feature:
Code:
"2"
{
"type"       "CH"
"text"       "[email protected]"
"showcount"  "2"
}
you can see the code here (not sure if it is the latest release)
http://forums.alliedmods.net/showpos...&postcount=953
__________________
AeroAcrobat 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 07:49.


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