filter names impossible task ?

Everything todo with programming goes HERE.
Post Reply
User avatar
Galaxip
Core Dumper
Posts: 120
Joined: Wed Aug 24, 2016 10:49 pm
Contact:

filter names impossible task ?

Post by Galaxip »

ive been writing some scripts for my servers using target zones and display some information as a center message including the player name that entered the zone but heres where im getting stuck

if a player called fred enters the target the ladderlog writes the players name fred and my center message displays fred and thats great

but if a player is logged in as fred@forums and enters the target then the full login name is displayed by the center message fred@forums

so I added some code to strip the @ and anything else after it and the center message now just displays fred

the problem i now face is with someone thats not logged in but calls themself @fred or @@@fred, now their name is blank

Ive thought about this a lot but I cannot think of a solution, Is it impossible to filter the name ?

any thoughts on this would be very helpful

thanks
Image Image Image Image
User avatar
Galaxip
Core Dumper
Posts: 120
Joined: Wed Aug 24, 2016 10:49 pm
Contact:

Re: filter names impossible task ?

Post by Galaxip »

there is one way i could do this but its a lot of work

ive noticed that in ladderlog when i player logs in it'll say fred renamed to fred@forums so I could keep a name table

when a player enters the game add their name to the table
when a player is renamed by the login then add this new logged in name along side their original name

use the original name for displaying center messages

also need to keep track of players renaming during a game and remove their entry when they leave the game

i think this should work but its a pain, is there an easier way ?
Image Image Image Image
User avatar
aP|Nelg
Match Winner
Posts: 621
Joined: Wed Oct 22, 2014 10:22 pm
Contact:

Re: filter names impossible task ?

Post by aP|Nelg »

First off, the @ I believe will be escaped to \@.

However, you should be able to grab actual names from elsewhere... for example, PLAYER_ENTERED/PLAYER_RENAMED, and/or on other versions, ONLINE_PLAYER or PLAYER_COLORED_NAME.
User avatar
Galaxip
Core Dumper
Posts: 120
Joined: Wed Aug 24, 2016 10:49 pm
Contact:

Re: filter names impossible task ?

Post by Galaxip »

i did a test and found out that the @ is not escaped :(

as a quick hack i test the filtered name and if its blank i use the unfiltered name, still the name @@@fred is showing as @@ lol
so i need to rewrite th filter a little bit more but i think for now i'll not worry if the name is displayed incorrectly as long as i use the unfiltered name for game events then i'll have no issues with the game logic

later i'll add a name table and all the junk to make it work

thanks
Image Image Image Image
User avatar
delinquent
Match Winner
Posts: 760
Joined: Sat Jul 07, 2012 3:07 am

Re: filter names impossible task ?

Post by delinquent »

Since there are a limited number of current authentication methods, I would simply use an exact match filter - strip out @forums, @lt, @armanelgtron.tk and you're golden.
User avatar
Galaxip
Core Dumper
Posts: 120
Joined: Wed Aug 24, 2016 10:49 pm
Contact:

Re: filter names impossible task ?

Post by Galaxip »

delinquent wrote: Sat Aug 29, 2020 12:11 am Since there are a limited number of current authentication methods, I would simply use an exact match filter - strip out @forums, @lt, @armanelgtron.tk and you're golden.
yeah thats good idea, i'll create an array of authentication names and can add to it if any more pop up

thanks
Image Image Image Image
User avatar
Galaxip
Core Dumper
Posts: 120
Joined: Wed Aug 24, 2016 10:49 pm
Contact:

Re: filter names impossible task ?

Post by Galaxip »

nelg pointed out that I should enable ladderlog_write_player_colored_name and use that instead

it sends the playername@somewhere along with the normal playername including colors without the @somewhere

so now i store both in an array, use the 1st one with @ for things like add_score_player etc and the 2nd one for displaying messages

looks great, thanks nelg
Image Image Image Image
Post Reply