• 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!

TFS 1.X+ How to track how he typed spell with doCreatureSay

Lopaskurwa

Active Member
Joined
Oct 6, 2017
Messages
873
Solutions
2
Reaction score
49
Hi
So i only know the basic script of doCreatureSay so i wondering how to track how he typed that command i mean tracking the caps lock example lets say you type TeST SPELL so doCreatureSay will send that same style and etc... I cant find any information about it.
 
Solution
5zWZxkT.png


I managed to do it :D
I will share my spells functions from spells.cpp that I changed to achieve this results
Code:
TalkActionResult_t Spells::playerSaySpell(Player* player, std::string& words)
{
    std::string str_words = words;

    //strip trailing spaces
    trimString(str_words);

    InstantSpell* instantSpell = getInstantSpell(str_words);
    if (!instantSpell) {
        return TALKACTION_CONTINUE;
    }

    std::string param;
    size_t spellLen = instantSpell->getWords().length();
    size_t paramLen = str_words.length() - spellLen;
    std::string paramText = str_words.substr(spellLen, paramLen);
    if (!paramText.empty() && paramText.front() == ' ') {
        size_t loc1 =...
I always remembered that being cool in old servers! So when I saw this post I decided to add it for my server too, to change it you just need to remove "words = instantSpell->getWords();" inside spells.cpp.
PadFFlx.png


There you see it working!
 
I always remembered that being cool in old servers! So when I saw this post I decided to add it for my server too, to change it you just need to remove "words = instantSpell->getWords();" inside spells.cpp.
PadFFlx.png


There you see it working!
Okay i deleted so now how doCreatureSay (cid, "", 19) should look?
 
Hmm? When you cast exura for example now and type ExUra it will show up as ExUra ingame, you do not need doCreatureSay at all.
 
Hmm? When you cast exura for example now and type ExUra it will show up as ExUra ingame, you do not need doCreatureSay at all.
Hmm weird because it doesnt work for me even when i deleted words = instantSpell->getWords(); and compiled source
Ideas?
 
Hmm weird because it doesnt work for me even when i deleted words = instantSpell->getWords(); and compiled source
Ideas?
Stop deleting code... Most especially if its in the sources, use either an inline ( // everything on this line is ignored by the compiler ) or block comment ( /* everything is ignored between these tags by the compiler */ )
 
In onCastSpell there are two arguments, creature and var or variant the 2nd argument is a table and 1 of it's index's is called string. This index or property could possibly be used to capture the words of a spell when the player casts the spell.

Here is an example on how to access that index.
Lua:
function onCastSpell(creature, var)
    if not creature:isPlayer() then
        return false
    end
    local words = var['string']
    if words then
 
In onCastSpell there are two arguments, creature and var or variant the 2nd argument is a table and 1 of it's index's is called string. This index or property could possibly be used to capture the words of a spell when the player casts the spell.

Here is an example on how to access that index.
Lua:
function onCastSpell(creature, var)
    if not creature:isPlayer() then
        return false
    end
    local words = var['string']
    if words then
Hmm i dont really get it how to use this part
  1. local words = var['string']
  2. if words then
in correct way
 
Because that is how you learn what value something holds.. its trouble-shooting 101 ;)
Yea i know basics of print but how value has to do something with tracking text? Even if i print how this will help me to track the msg? I'm so confused :D

Code:
function onCastSpell(creature, var)
    if not creature:isPlayer() then
        return false
    end
    print(local words = var['string'])
    if words then
 
It's not possible with using what bayview told u to use. Because it will just send the spellname..
I guess u also want it to be possible to write exevo gran mas vis "allahu akbar (and if this is written right now, no spells will execute because how spells are coded in source)
like you could in old servers? Or am I wrong? You only want ExeVo GraN MAs Vis? If so share ur spells.cpp
(The code I gave you before only enables you to type ExEVo GRan MaS ViS but still it wont work like with the example above like exevo gran mas vis "akbar)
I think best way to do that is with source edits, and I tried to do it myself yesterday too, but it was kinda of hard and I didn't finish it.
 
Last edited:
I haven’t tested it, but, walking the call tree for spells, it looks like you can remove this line to do what you want:
otland/forgottenserver

Yep! It's what the first reply was and it does indeed fix it (I did it myself and provided screenshot that it works, but the OP says it doesn't work) but I think he wants also things like Exevo gran mas vis "allahu akbar, to be possible
 
Last edited:
Yep! It's what the first reply was and it does indeed fix it (I did it myself and provided screenshot that it works, but the OP says it doesn't work) but I think he wants also things like Exevo gran mas vis "allahu akbar, to be possible
Sorry, I should have read your comment more closely. Not sure why it’s not working for OP. I’ll wait for OP to reply to confirm what exactly they want before continuing.
 
It's not possible with using what bayview told u to use. Because it will just send the spellname..
I guess u also want it to be possible to write exevo gran mas vis "allahu akbar (and if this is written right now, no spells will execute because how spells are coded in source)
like you could in old servers? Or am I wrong? You only want ExeVo GraN MAs Vis? If so share ur spells.cpp
(The code I gave you before only enables you to type ExEVo GRan MaS ViS but still it wont work like with the example above like exevo gran mas vis "akbar)
I think best way to do that is with source edits, and I tried to do it myself yesterday too, but it was kinda of hard and I didn't finish it.
Exactly
I haven’t tested it, but, walking the call tree for spells, it looks like you can remove this line to do what you want:
otland/forgottenserver
Yea i ignored this line with // but it doesnt work for me. I can type that spell in game it doesnt send anything
 
Back
Top