• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Double spaced talkaction registration.

Nenth

I'm just cleaning here;
Joined
Mar 20, 2016
Messages
46
Reaction score
12
Hello, is there any trick to register double spaced talkaction?

Code:
 <talkaction words="double spaced talkaction" event="script" value="scriptname.lua"/>

The filter="word-spaced" does not work.
 
Hello, is there any trick to register double spaced talkaction?

Code:
 <talkaction words="double spaced talkaction" event="script" value="scriptname.lua"/>

The filter="word-spaced" does not work.
You can try using capitals instead of spaces as an alternative.

/youAreAwesome
 
You can try using capitals instead of spaces as an alternative.

/youAreAwesome

Yeah, I thought about it, but this talkaction will be for players, so I want it to look beautyful. :rolleyes:
Trying to add new filter in sources, gonna post it here if works.

#Edit
Well, I forgot about that I'm big 0 in C++, so if is here any good person that could help me understand the code, would be cool:
Code:
bool TalkActions::onPlayerSay(Creature* creature, uint16_t channelId, const std::string& words, bool ignoreAccess)
{
    std::string cmdstring[TALKFILTER_LAST] = words, paramstring[TALKFILTER_LAST] = "";
    size_t loc = words.find('"', 0);
    if(loc != std::string::npos && loc >= 0)
    {
        cmdstring[TALKFILTER_QUOTATION] = std::string(words, 0, loc);
        paramstring[TALKFILTER_QUOTATION] = std::string(words, (loc + 1), (words.size() - (loc - 1)));
        trimString(cmdstring[TALKFILTER_QUOTATION]);
    }

    loc = words.find(" ", 0);
    if(loc != std::string::npos && loc >= 0)
    {
        cmdstring[TALKFILTER_WORD] = std::string(words, 0, loc);
        paramstring[TALKFILTER_WORD] = std::string(words, (loc + 1), (words.size() - (loc - 1)));

        size_t sloc = words.find(" ", ++loc);
        if(sloc != std::string::npos && sloc >= 0)
        {
            cmdstring[TALKFILTER_WORD_SPACED] = std::string(words, 0, sloc);
            paramstring[TALKFILTER_WORD_SPACED] = std::string(words, (sloc + 1), (words.size() - (sloc - 1)));
        }
    }

I think that this part is "word-spaced" filter:
Code:
size_t sloc = words.find(" ", ++loc);
        if(sloc != std::string::npos && sloc >= 0)
        {
            cmdstring[TALKFILTER_WORD_SPACED] = std::string(words, 0, sloc);
            paramstring[TALKFILTER_WORD_SPACED] = std::string(words, (sloc + 1), (words.size() - (sloc - 1)));
        }
So my question is how I could change that it will work for double space?
 
Last edited:
Back
Top