• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] TopArena - Errors when updating script

Status
Not open for further replies.

katos

Noble Member
Have gotten myself rather confused when trying to update an old script to revision 57.
The issue is that it used to use MonsterWhisper, so I converted this to player->Whisper

Errors Received:

Code:
Error	2	error C2660: 'Player::Whisper' : function does not take 2 arguments	D:\katos\test core\core1\src\server\scripts\Custom\arenatop.cpp	31	1	scripts
Error	3	error C2660: 'Player::Whisper' : function does not take 2 arguments	D:\katos\test core\core1\src\server\scripts\Custom\arenatop.cpp	39	1	scripts
Error	4	error C2660: 'Player::Whisper' : function does not take 2 arguments	D:\katos\test core\core1\src\server\scripts\Custom\arenatop.cpp	50	1	scripts
Error	5	error C2660: 'Player::Whisper' : function does not take 2 arguments	D:\katos\test core\core1\src\server\scripts\Custom\arenatop.cpp	58	1	scripts
Error	1	error C2660: 'Log::outMessage' : function does not take 2 arguments	D:\katos\test core\core1\src\server\scripts\Custom\enchant_npc.cpp	145	1	scripts
Error	6	error LNK2019: unresolved external symbol "void __cdecl AddSC_npc_arena_setup(void)" (?AddSC_npc_arena_setup@@YAXXZ) referenced in function "void __cdecl AddCustomScripts(void)" (?AddCustomScripts@@YAXXZ)	D:\katos\test core\buildtest\src\server\worldserver\game.lib(ScriptLoader.obj)	worldserver
Error	7	error LNK1120: 1 unresolved externals	D:\katos\test core\buildtest\bin\Debug\worldserver.exe	worldserver

Script:
http://pastebin.com/5StVYERd
 

Tommy

Founder
error C2660: 'Log::eek:utMessage'

This error isn't apart of Top Arena script.


Player 'Whisper' parameters:

Whisper(std::string const& text, Language language, Player* target, bool isBossWhisper = false);

So your whispers should be:

Code:
player->Whisper(msg, LANG_UNIVERSAL, player);

Languages you can use are below. I just chose LANG_UNIVERSAL because it is the most commonly used language.
Code:
enum Language
{
    LANG_UNIVERSAL      = 0,
    LANG_ORCISH         = 1,
    LANG_DARNASSIAN     = 2,
    LANG_TAURAHE        = 3,
    LANG_DWARVISH       = 6,
    LANG_COMMON         = 7,
    LANG_DEMONIC        = 8,
    LANG_TITAN          = 9,
    LANG_THALASSIAN     = 10,
    LANG_DRACONIC       = 11,
    LANG_KALIMAG        = 12,
    LANG_GNOMISH        = 13,
    LANG_TROLL          = 14,
    LANG_GUTTERSPEAK    = 33,
    LANG_DRAENEI        = 35,
    LANG_ZOMBIE         = 36,
    LANG_GNOMISH_BINARY = 37,
    LANG_GOBLIN_BINARY  = 38,
    LANG_ADDON          = 0xFFFFFFFF                        // used by addons, in 2.4.0 not exist, replaced by messagetype?
};
 

katos

Noble Member
[MENTION=1]Tommy[/MENTION]

This error isn't apart of Top Arena script.

So your whispers should be:

Code:
player->Whisper(msg, LANG_UNIVERSAL, player);

Not a clue why that error is now showing up, as that was fine before - so I'll remove that script and fix that eventually ;)
As for the whispers, if I have this right - bare in mind my god-aweful C++ skills - I am right in saying it should look like this?:

player->Whisper("|cff4169E1Here are the top 10 2v2 arena teams:|r", LANG_UNIVERSAL, player);

If so, then can I also ask whether this:
snprintf(msg, 250, "Team Name: |cffFFFF00%s|r, Team Rating: %u \n", arena_name.c_str(), rating);
player->Whisper(msg, player);

is still ok?
I am a little confused as to why that part is even there like that to be honest?

Many thanks for your help,
regards,
Katos.
 
Last edited:

Tommy

Founder
snprintf(msg, 250, "Team Name: |cffFFFF00%s|r, Team Rating: %u \n", arena_name.c_str(), rating);
player->Whisper(msg, player);

No, it is still wrong because you need to add a language data type in between msg and player as I mentioned above:

player->Whisper(msg, LANG_UNIVERSAL, player);

Go to this link: https://github.com/TrinityCore/TrinityCore/blob/3.3.5/src/server/game/Entities/Unit/Unit.h#L2168

It shows you the parameters.

I am a little confused as to why that part is even there like that to be honest?

The snprintf is okay to use if that's what you're asking and are confused about. Just because you change the method arguments doesn't mean it affects other things like that.

snprintf basically allows you to set extra arguments. I honestly prefer using ostringstream but that's me. The script itself is kinda ugly and could be done better related to the snprintf and other things.
 

katos

Noble Member
[MENTION=1]Tommy[/MENTION]

Cheers for that Tommy! Makes perfect sense, my mistake was being silly and missing out the LANG_ on:

player->Whisper(msg, LANG_UNIVERSAL, player);

Thanks for the help! Really appreciate it.
 
Status
Not open for further replies.
Top