autocomplete to ignore ^, *, SRM_ , etc.

A place to post suggestions for new features, new bugs, and comments about the existing code.
aptest
Posts: 133
Joined: Wed Sep 23, 2009 9:47 am

Post by aptest »

heya folk,

Here's the deal: when I PM someone in game the best way is, I find, to type his name and then tab. for instance, hyTAB can be hyro or ryTAB can be ryjsamin (SP?).

then there's some folk out there who's got hard to type characters like ^ or * or their squad-names (SRM anyone?) in the beginning of their nickname. im not saying it's hard to type it but it's a bit redundant to type SRM_ at the beginning of the name when I need to talk to only one of them and kind of defeats the purpose of the whole auto complete feature. characters like ^ take a lot more time to type than regular letters also.

my suggestion:
these tags are voluntarily moved to the end of the nickname by their users.

what do you think?
HSharp
Posts: 5192
Joined: Fri Aug 11, 2006 11:18 am
Location: Brum, UK

Post by HSharp »

I find it quite handy to find certain pilots to send a message to, I only have to type a few letters or sometimes even just a token to send a quick PM so I am happy with the status quo.
Image
Image
FreeBeer
Posts: 10902
Joined: Tue Dec 27, 2005 8:00 am
Location: New Brunswick, Canada

Post by FreeBeer »

The position of the token can't be arbitrarily changed. I believe it's used (in that position) for a number of internal reasons.
[img]http://www.freeallegiance.org/forums/st ... erator.gif" alt="IPB Image">

chown -R us base
BackTrak
Posts: 2079
Joined: Thu Mar 08, 2007 4:52 am
Location: Chicago, IL
Contact:

Post by BackTrak »

HSharp wrote:QUOTE (HSharp @ Aug 2 2010, 07:14 AM) I find it quite handy to find certain pilots to send a message to, I only have to type a few letters or sometimes even just a token to send a quick PM so I am happy with the status quo.
It should be feasible to change the code so that if no match for a sequence is found, then check all strings omitting special chars.

IE: if I type in "hsh" and hit tab, and no match is found, then search again without the leading char if the char is not a letter, which would then match ^hsharp.

This would preserve all current behavior, so that if I put in ^, then it would find ^hsharp (presuming ^hsharp is at the front of the list, if there is more than one ASL on.)
ImageImage
Spinoza
Posts: 799
Joined: Tue Nov 27, 2007 6:25 pm
Location: Israel

Post by Spinoza »

I agree, the special chars are a pain in the hind parts.
It would be great if the auto-complete ignored them...
Image Image Image
pkk
Posts: 5419
Joined: Tue Jul 01, 2003 7:00 am
Location: Germany, Munich

Post by pkk »

Code: Select all

PlayerInfo* BaseClient::FindPlayerByPrefix(const char* szNamePrefix)
{
    PlayerInfo* p = NULL;
    int lenNamePrefix = strlen(szNamePrefix);

    for (PlayerLink* l = m_listPlayers.first(); (l != NULL); l = l->next())
    {
        PlayerInfo& player = l->data();

        if (_strnicmp(player.CharacterName(), szNamePrefix, lenNamePrefix) == 0)
        {
            p = &player;
            break;
        }
    }

    return p;
}
It's not the special characters, it's the occurrence of starting characters in a game.

There can be 10 people starting with "An", it's as annoying as having a squadgame with SRM, while most of them carry their traditional "SRM_" in front of their real nick.
The Escapist (Justin Emerson) @ Dec 21 2010, 02:33 PM:
The history of open-source Allegiance is paved with the bodies of dead code branches, forum flame wars, and personal vendettas. But a community remains because people still love the game.
BackTrak
Posts: 2079
Joined: Thu Mar 08, 2007 4:52 am
Location: Chicago, IL
Contact:

Post by BackTrak »

I think I see what you mean pkk. What do you think about this (UNTESTED) bit.

Code: Select all

// BT - 8/2/2010 - Test for QBE, then token, then substring.
PlayerInfo* BaseClient::FindPlayerByPrefix(const char* szNamePrefix)
{
    PlayerInfo* foundPlayer = NULL;
    PlayerInfo* tokenMatchingPlayer = NULL;
    PlayerInfo* substringMatchingPlayer = NULL;

    int lenNamePrefix = strlen(szNamePrefix);

    for (PlayerLink* l = m_listPlayers.first(); (l != NULL); l = l->next())
    {
        PlayerInfo& player = l->data();

        // Does the callsign start with with name prefix?
        if (_strnicmp(player.CharacterName(), szNamePrefix, lenNamePrefix) == 0)
        {
            foundPlayer = &player;
            break;
        }

        // If the callsign starts with a token, and is greater than 1 char, does the callsign after
        // the token start with the name prefix?
        if(tokenMatchingPlayer == NULL && strlen(player.CharacterName()) > 1 && isalpha(player.CharacterName()[0]) == 0)
        {
            if (_strnicmp(player.CharacterName() + 1, szNamePrefix, lenNamePrefix) == 0)
            {
                tokenMatchingPlayer = &player;
            }
        }

        // Does the callsign contain the string anywhere?
        if(substringMatchingPlayer == NULL)
        {
            if(strstr(player.CharacterName(), szNamePrefix) != NULL)
                substringMatchingPlayer = &player;
        }
    }

    // Prefer the match on the beginning of the string.
    if(foundPlayer == NULL)
    {
        // Else prefer the match on the beginning of the string less the token.
        if(tokenMatchingPlayer != NULL)
            foundPlayer = tokenMatchingPlayer;

        // Else match on the first player with the string anywhere in the character name.
        else if(substringMatchingPlayer != NULL)
            foundPlayer = substringMatchingPlayer;
    }

    return foundPlayer;
}

My C++ is pretty rusty, I think those string functions all do what I want. It compiles, so it's gotta be 85% correct. ;)
ImageImage
EdDaalleg
Posts: 500
Joined: Mon Apr 21, 2008 10:38 pm

Post by EdDaalleg »

Generally if there is more than one match for the string you've passed then multiple tabs will go through the list in alphabetical order. ( I think right now multiple tabs changes the group you're chatting to)

I didn't look closely at that code, so this may have been suggested already.

Didn't madpeople make a post about altering tab autocompletion several months ago?
Image

Image
Xynth
Posts: 224
Joined: Mon Oct 05, 2009 3:03 pm
Location: St. Louis

Post by Xynth »

BackTrak wrote:QUOTE (BackTrak @ Aug 2 2010, 11:18 AM) I think I see what you mean pkk. What do you think about this (UNTESTED) bit.


My C++ is pretty rusty, I think those string functions all do what I want. It compiles, so it's gotta be 85% correct. ;)
Looks pretty good. We need a ticket for this. If you don't have time to test just create a patch and I will look at it after #48.
Xynth@PK
Image
BackTrak
Posts: 2079
Joined: Thu Mar 08, 2007 4:52 am
Location: Chicago, IL
Contact:

Post by BackTrak »

Edmond wrote:QUOTE (Edmond @ Aug 2 2010, 11:30 AM) Generally if there is more than one match for the string you've passed then multiple tabs will go through the list in alphabetical order. ( I think right now multiple tabs changes the group you're chatting to)

I didn't look closely at that code, so this may have been suggested already.

Didn't madpeople make a post about altering tab autocompletion several months ago?
Hi Edmond,

The current function that pkk posted does not support that kind of functionality (tabbing multiple times to get different callsigns).

You may be on to something, I just did a search thru the code for FindPlayerByPrefix, and nothing seems to be calling that function method. Is it not used anymore?

Edit: I r pro-coder...
Last edited by BackTrak on Mon Aug 02, 2010 6:13 pm, edited 1 time in total.
ImageImage
Post Reply