This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Advanced Multiple Scrolling Messages


Post New Thread Reply   
 
Thread Tools Display Modes
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-01-2011 , 00:04   Re: Advanced Multiple Scrolling Messages
Reply With Quote #11

Quote:
Originally Posted by Ethan View Post
Updated to new version, using Trie to convert color names to rgb values.
fysiks check this out if you have some time. Thanks in advance.
Compiled file size decreased for 2kb
You must be using AMX Mod X 1.8.2 because TrieSetArray does not work in version 1.8.1. You probably need to say it requires 1.8.2 (not entirely sure if it's approvable like this though)

Also, as a tip, I try to avoid hard coding values that can be obtained with the sizeof function (it is preprocessor function so it does not affect runtime efficiency). E.g.:


PHP Code:
new const Ga_color_names[143][] = {
// ...
new const Ga_color_values[sizeof(Ga_color_names)][3] = {
// ...
Init_color_list()
{
    new 
i_counter
    Gt_color_list 
TrieCreate()
    for(
i_counter 0i_counter sizeof(Ga_color_names); i_counter++)
    {
        
TrieSetArray(Gt_color_listGa_color_names[i_counter], Ga_color_values[i_counter], 3)
    }

This will help prevent potential index out of bounds runtime errors when adding or removing colors by ensuring you have identical array sizes and that you loop through the correct number of elements (which can easily be forgotten when changing larg arrays).


Quote:
Originally Posted by Ethan View Post
p.s. it could sound totally stupid but i don't know how to fight with these 8-symbol tabs
I'm sorry I confused you. I wasn't saying anything was actually incorrect here. I was just saying that if your source code/text editor shows the tab character as an 8 character width then it would be really spread out because you use a lot of tabs (most specifically, you indent the opening brace of an if() statement which is something I never do. The brace is directly under the "i" in "if" when I code).
__________________
fysiks is offline
Ethan
Junior Member
Join Date: Mar 2009
Location: Russia, Saratov
Old 05-01-2011 , 18:25   Re: Advanced Multiple Scrolling Messages
Reply With Quote #12

Thanks fysiks for your kind support!

Quote:
Originally Posted by fysiks View Post
You must be using AMX Mod X 1.8.2
Yep, that's right. At first i wanted to use TrieSetString with 3 color values as first 3 letters and add 0 as fourth symbol and then somehow thansfer this string to array, but then spotted TrieSetArray which was exactly what i needed, but i didn't know that it's new 1.8.2 function, and that's sad. Maybe i'll make a string variant for 1.8.1 and leave triesetarray as parallel version, anyway these changes are not global.

Quote:
Originally Posted by fysiks View Post
I try to avoid hard coding values that can be obtained with the sizeof function
You're absolutely right, i should make it so. I'll try to find some more hardcoded places and fix it.

Quote:
Originally Posted by fysiks View Post
I'm sorry I confused you. I wasn't saying anything was actually incorrect here. I was just saying that if your source code/text editor shows the tab character as an 8 character width then it would be really spread out because you use a lot of tabs (most specifically, you indent the opening brace of an if() statement which is something I never do.
It's ok, i'm not confused, i use amxstudio for editing, beacuse i like it displaying errors and coloring bad code in the same window. It really showes 8 char tab, but there's no way to tune it or i have eye problems
Indenting ifs, whiles and other helps me in some way, everything looks vast, but nicely separated.
So to make it better i wanted to make tabs smaller before publishing, but found no way to do this in the file, so that was my problem.
So wait for changes. Thank you.

update: oops! i didn't thought about color values as 0,0,0 implemented as string "0000", which is something not allowed.

Last edited by Ethan; 05-01-2011 at 19:25.
Ethan is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-01-2011 , 22:24   Re: Advanced Multiple Scrolling Messages
Reply With Quote #13

Tabs are only a single character and is displayed how ever your editor displays them (many editors use 4, some use 8 character widths to display them). You don't need to change anything in the file itself. Anyway, concerning this, I'll stop since it is really irrelevant to your thread.

TrieSetArray is not new to 1.8.2 but merely actually works in 1.8.2 because there was a typo in 1.8.1 that prevented it from working correctly.

I've read where people have used Trie strings as a work-around to trie arrays but not sure how they would work when your values are commonly the same as EOS (end of string) so I'm not sure if it will read all the values correctly.
__________________
fysiks is offline
Ethan
Junior Member
Join Date: Mar 2009
Location: Russia, Saratov
Old 05-02-2011 , 02:51   Re: Advanced Multiple Scrolling Messages
Reply With Quote #14

You could say that you're sure. I've checked string variant, and TrieGetString reads only what's before EOS. I've decided to stick to 1.8.1 ArraygetCell => index, and then get color set as color_array=color_values2d[index]. Also, i've removed as much harcodings as possible, moved some often used text to string "constant" variables. Changed some if(... != 0) to if(...) statements, and while looking at the code found out some bugs with getting parameters. If there were some "spaces" in front and after the parameter, parameter wouldn't be read. It's fixed now.

If you've tried it on server, you can see the text is flickering, like in original plugin, it's ok, and could be used as additional effects, but i want to be able to remove this effect. It caused by overwriting hudmessage channel. Take a look:
PHP Code:
public show_SM_frame()
{
//...
set_hudmessage( ... holdtime Gf_SM_speed ... )
show_hudmessage(...)
set_taskGf_SM_speed "show_SM_frame" )

When it's done that way, which was my original idea to prevent overwriting, and flickering, as a result, there appears some "pause" between displayings, and it's not flickering but re-appearing each time, and looks too bad - "oh my eyes...".
It also used hudmessage_channel = -1, but then
I had to return to channel rewriting, set channel = 2, and
PHP Code:
public show_SM_frame()
{
//...
set_hudmessage( ... holdtime Gf_SM_speed 0.1 ... )// added + 0.1
show_hudmessage(...)
set_taskGf_SM_speed "show_SM_frame" )

holdtime+0.1 give enough time for the message to be overwritten by next frame. It looks smooth, as really message is "moving" but flickering.
So i supposed, there's some time needed to make calcs and set_hudmessage, so i've made a new variant:
PHP Code:
public show_SM_frame()
 {
 
set_hudmessage( ... holdtime Gf_SM_speed ... )
 
set_taskGf_SM_speed "show_SM_frame" )
 
show_hudmessage(...)

 
//...calcs here for set_hudmessage on next call

And as a result i have re-appearing again... insted of this:
PHP Code:
|time to set_hud|time to set_task|time to show_hud|time for calcs|pause|
//new call                       |time to_set_hud|time to set_task|time to show_hud|time for calcs|pause|
and as for message itself it must be:
|
time to set_hud|time to set_task|time to show_hud|time for calcs|pause|
displaying old message until show_hud endsset_hud time set_task time |
                                                  |new 
message appears here 
so it must even be overwritten, but as a result i have small pause between them.
So i think i have to use synchronization somehow, i consider myself about HudSync functions or Multiforward if it's what i'm thinking of, anyway still i can't get how to use them properly.
As for this version, i've added #defined owerwriting value 0.1.
Ok, Thanks in advance fysiks, and i'm sorry for my dumbness, seens like i've got at last what you have meant about tabs, i know that they just one symbol but i suppoed they could be configured in each file, because i misunderstood your joke it's all because of my little experience in live english, you have just meant that it was funny if i use editor displaying long tabs (and that is really so), and i understood it only now.
Ethan is offline
Ethan
Junior Member
Join Date: Mar 2009
Location: Russia, Saratov
Old 05-02-2011 , 03:07   Re: Advanced Multiple Scrolling Messages
Reply With Quote #15

Version updated
-AMXX 1.8.1 compatible
-fixed bug with spaces in parameter
-small optimizations
Ethan is offline
Ethan
Junior Member
Join Date: Mar 2009
Location: Russia, Saratov
Old 05-03-2011 , 22:02   Re: Advanced Multiple Scrolling Messages
Reply With Quote #16

Updated to version 1.0d

Using ShowSyncHudMsg to show each frame,
added amx_sm_flick cvar - removes color pulsations on each frame

-other small changes (see changelog)

now when synchro message system is used, rewriting message channel don't affect itself anymore, but ClearHudSync() removes the message itself, but don't remove color blend and even stretches it, so now we don't have pulsations but we have blended colors all the way, so amx_sm_flick switches between oldsystem and new sync system but new system displays only blended colors e.g 0,0,255m only 0 or 255. old system shows all colors.amx_sm_flick by default is 1 so, by default it uses old system. If someone wants to rewiew this, i'll be happy to hear your advice.
Ethan is offline
Ethan
Junior Member
Join Date: Mar 2009
Location: Russia, Saratov
Old 05-05-2011 , 21:38   Re: Advanced Multiple Scrolling Messages
Reply With Quote #17

It's a pity that only fysiks was the one, who was bit interested in my plugin, i'd like if more people could look into the code. If there are any problems, l'll fix it asap.

Anyway the plugin is fully functional, and i recommend anyone to use it instead of standart scrollmsg.amxx

Features could be added on request.

Thanks everyone for your kind support.
Ethan is offline
KiimpaN
Member
Join Date: Jun 2005
Location: Sweden
Old 05-25-2011 , 17:00   Re: Advanced Multiple Scrolling Messages
Reply With Quote #18

Thanks for posting this awesome plugin, will definitely be used! In my opinion, it's much greater than the original plugin hehe
KiimpaN is offline
Shadymn
Senior Member
Join Date: Sep 2010
Old 05-25-2011 , 23:26   Re: Advanced Multiple Scrolling Messages
Reply With Quote #19

it's very nice plugin. But why is it becoming bigger amsm.ini file?
Shadymn 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 01:38.


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