Raised This Month: $18 Target: $400
 4% 

[INC] More Colors (1.9.1)


Post New Thread Reply   
 
Thread Tools Display Modes
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 05-23-2012 , 04:19   Re: [INC] More Colors (1.0.0BETA)
Reply With Quote #21

Ok, but my previous question was just pointed at bl4nk's code
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
FlaminSarge
Veteran Member
Join Date: Jul 2010
Old 05-24-2012 , 05:18   Re: [INC] More Colors (1.0.0BETA)
Reply With Quote #22

I added in CRemoveTags. I didn't include bl4nk's random RGB, yet, though. I'm also slightly worried about the idea of having a trie and an array for each plugin using colors. While a bit strange, using a plugin to manage color stocks may be a bit better, though then plugins would have to share the same custom colors added via CAddColor... I dunno. And yes, it's probably just easier to use \x07CUSTOM instead of {#CUSTOM}, but I was concerned about if it was fine in translation files, so I made the suggestion anyways.

If you're planning on implementing \x08, for simplicity I'd suggest having everything use \x08, using FF for the alpha for the included colors that are using \x07 right now.

... https://forums.alliedmods.net/showpo...0&postcount=25
__________________
Bread EOTL GunMettle Invasion Jungle Inferno will break everything. Don't even ask.

All plugins: Randomizer/GiveWeapon, ModelManager, etc.
Post in plugin threads with questions.
Steam is for playing games.
You will be fed to javalia otherwise.
Psyduck likes replays.

Last edited by FlaminSarge; 05-27-2012 at 06:09.
FlaminSarge is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 05-24-2012 , 07:12   Re: [INC] More Colors (1.0.0BETA)
Reply With Quote #23

Quote:
Originally Posted by FlaminSarge View Post
I added in CRemoveTags. I didn't include bl4nk's random RGB, yet, though. I'm also slightly worried about the idea of having a trie and an array for each plugin using colors. While a bit strange, using a plugin to manage color stocks may be a bit better, though then plugins would have to share the same custom colors added via CAddColor... I dunno. And yes, it's probably just easier to use \x07CUSTOM instead of {#CUSTOM}, but I was concerned about if it was fine in translation files, so I made the suggestion anyways.

If you're planning on implementing \x08, for simplicity I'd suggest having everything use \x08, using FF for the alpha for the included colors that are using \x07 right now.
I'll update the .inc in the OP when I get to a computer.

I was slightly concerned about every plugin having its own trie, but whatever.

I'd rather continue using \x07 for text with full alpha, since color codes take up part of the maximum chat message length. Each color would take up two additional characters.
__________________
Dr. McKay is offline
noodleboy347
SourceMod Donor
Join Date: Mar 2009
Old 05-27-2012 , 04:21   Re: [INC] More Colors (1.0.0BETA)
Reply With Quote #24

This is pretty much unusable [for me] because CPrintToChatAllEx never works
noodleboy347 is offline
FlaminSarge
Veteran Member
Join Date: Jul 2010
Old 05-27-2012 , 06:03   Re: [INC] More Colors (1.0.0BETA)
Reply With Quote #25

Technically, we don't need CPrintToChatAllEx anymore, it's only there for backwards compatibility with colors.inc-using plugins. Its only function was to specify a color based on a particular client via the {teamcolor} tag, but you can do that now in various other ways, so.... yeah. What's the issue you're having with it?

Ooh, found the bug. VFormat under CPrintToChatAllEx should have '3' as the last arg, not '2'. McKay, you've gotta be saying 'damn you copypaste' right about now. Change that and you should be good to go, noodle.

McKay: your concerns over the extra 2 chars makes sense, considering some of the stuff people like to print to clients.

EDIT: Here.
Attached Files
File Type: inc morecolors.inc (15.5 KB, 307 views)
__________________
Bread EOTL GunMettle Invasion Jungle Inferno will break everything. Don't even ask.

All plugins: Randomizer/GiveWeapon, ModelManager, etc.
Post in plugin threads with questions.
Steam is for playing games.
You will be fed to javalia otherwise.
Psyduck likes replays.

Last edited by FlaminSarge; 05-27-2012 at 06:10.
FlaminSarge is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 05-27-2012 , 09:07   Re: [INC] More Colors (1.0.0BETA)
Reply With Quote #26

Oops…

I'll try to update it today. That being said, this is still a beta and shouldn't be used in any released plugins…
__________________
Dr. McKay is offline
noodleboy347
SourceMod Donor
Join Date: Mar 2009
Old 05-27-2012 , 15:37   Re: [INC] More Colors (1.0.0BETA)
Reply With Quote #27

Quote:
Originally Posted by FlaminSarge View Post
Technically, we don't need CPrintToChatAllEx anymore, it's only there for backwards compatibility with colors.inc-using plugins. Its only function was to specify a color based on a particular client via the {teamcolor} tag, but you can do that now in various other ways, so.... yeah. What's the issue you're having with it?

Ooh, found the bug. VFormat under CPrintToChatAllEx should have '3' as the last arg, not '2'. McKay, you've gotta be saying 'damn you copypaste' right about now. Change that and you should be good to go, noodle.

McKay: your concerns over the extra 2 chars makes sense, considering some of the stuff people like to print to clients.

EDIT: Here.
Thanks breh
noodleboy347 is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 05-27-2012 , 16:00   Re: [INC] More Colors (1.0.0BETA)
Reply With Quote #28

FlaminSarge: I'm not a huge fan of the way you're using both an array and a trie… uses up more memory and is a bit unnecessary. I prefer to parse the string to find tags then check if they match a color tag, but that's just me.
__________________
Dr. McKay is offline
FlaminSarge
Veteran Member
Join Date: Jul 2010
Old 05-28-2012 , 04:33   Re: [INC] More Colors (1.0.0BETA)
Reply With Quote #29

You'd still have to iterate through the trie's keys, and for that you need an array. Think about it:
1) Parse string, find { } tags. Save these locations somewhere.
2) At each location, check to see if the tag matches any color tags. You'll need to check every key in the trie, but you can't iterate through tries, so you'll need to go through some other thing that stores the keys. That's what the array's for (you could use the non-ADT array, but that won't have dynamic sizing so you'd have to have a MAX_COLORS define).
3) You replace those with empty space. You'd have to move all other pieces of the string down to where the tag is removed.

I believe in either case, you'd need something like that. Using ReplaceString and iterating through the array is much easier than manually editing the string like that.

If you're worried about space, you could make this a plugin, and then all plugins using it would share the same set of colors, and each time you added a color all plugins would get that color. That may or may not be a good thing.
__________________
Bread EOTL GunMettle Invasion Jungle Inferno will break everything. Don't even ask.

All plugins: Randomizer/GiveWeapon, ModelManager, etc.
Post in plugin threads with questions.
Steam is for playing games.
You will be fed to javalia otherwise.
Psyduck likes replays.

Last edited by FlaminSarge; 05-28-2012 at 04:34.
FlaminSarge is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 05-28-2012 , 04:52   Re: [INC] More Colors (1.0.0BETA)
Reply With Quote #30

Quote:
Originally Posted by FlaminSarge View Post
2) At each location, check to see if the tag matches any color tags. You'll need to check every key in the trie, but you can't iterate through tries, so you'll need to go through some other thing that stores the keys. That's what the array's for (you could use the non-ADT array, but that won't have dynamic sizing so you'd have to have a MAX_COLORS define).
Just use GetTrieString and check it doesn't return false. It's whole point is that it's a Trie so lookups are fast, iterating the whole list would be stupidly slow.
__________________
asherkin is offline
Reply


Thread Tools
Display Modes

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 21:16.


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