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

Trinitycore - Error when compiling Worldchat

Noones

Enthusiast
Hello,

im trying to add the Worldchat from slp13at420 to my core.
Link: http://emudevs.com/showthread.php/5339-World-Chat-script?highlight=worldchat

The Core is the newest Eluna one, without any changes made ( wanted to start with a chat )

I added the Script to the Cmake File and the AddSC_ to scriptloader.cpp

Code:
#ifdef SCRIPTS
/* This is where custom scripts' loading functions should be declared. */
void AddSC_WorldChat();
#endif

void AddCustomScripts()
{
#ifdef SCRIPTS
	/* This is where custom scripts should be added. */
	AddSC_WorldChat();
#endif
}

After i added everything i tried to use Cmake into a new Folder "Build" and startet to compile.

Errors:

Code:
Error	1	error C1083: Cannot open include file: 'ScriptPCH.h': No such file or directory	C:\Users\root\Desktop\Core\Eluna\src\server\scripts\Custom\Worldchat.cpp	12	1	scripts
Error	2	error LNK1104: cannot open file '..\scripts\RelWithDebInfo\scripts.lib'	C:\Users\root\Desktop\Core\Eluna\Build\src\server\worldserver\LINK	worldserver
 
Last edited:

Recycle

Enthusiast
ScriptPCH.h isn't used anymore, hence it's not working. You need to add what it actually uses. Remove:
Code:
#include "ScriptPCH.h"
and look for which .h files are still missing.

I'm planning to perhaps add it later, but currently too busy on working to get my starting quests to Emerald Dream. If anyone else has an answer before I'm done, I'll gladly help you fix it for latest TC.. if I can D:
 

Noones

Enthusiast
ScriptPCH.h isn't used anymore, hence it's not working. You need to add what it actually uses. Remove:
Code:
#include "ScriptPCH.h"
and look for which .h files are still missing.

I'm planning to perhaps add it later, but currently too busy on working to get my starting quests to Emerald Dream. If anyone else has an answer before I'm done, I'll gladly help you fix it for latest TC.. if I can D:

Hello, thanks for your answer!

i removed the #include ScriptPCH.h row.

After recompiling im now getting the following errors:

Code:
Error	6	error C2440: 'initializing' : cannot convert from 'initializer-list' to 'ChatCommand'	C:\Users\root\Desktop\Core\Eluna\src\server\scripts\Custom\Worldchat.cpp	81	1	scripts
Error	5	error C2555: 'WORLD_CHAT::GetCommands': overriding virtual function return type differs and is not covariant from 'CommandScript::GetCommands'	C:\Users\root\Desktop\Core\Eluna\src\server\scripts\Custom\Worldchat.cpp	119	1	scripts
Error	7	error LNK1104: cannot open file '..\scripts\RelWithDebInfo\scripts.lib'	C:\Users\root\Desktop\Core\Eluna\Build\src\server\worldserver\LINK	worldserver

Could you help me with that, im trying to find other Forum Posts with these Problems, sadly im to stupid to fix these.
 

Recycle

Enthusiast
I'm really not confident enough in C++ to figure those out :D I'll keep looking, but it's best that someone who is actually good in c++ to fix it. You could ask the author, too :)
 

Noones

Enthusiast
I'm really not confident enough in C++ to figure those out :D I'll keep looking, but it's best that someone who is actually good in c++ to fix it. You could ask the author, too :)

Thanks, i will try to conntact him on skype! :)

Edit: If anyone else might want to help me please add me on skype: kyle.nolte
 
Last edited:

Tommy

Founder
Thanks, i will try to conntact him on skype! :)

Or you could wait for other members to come online and help. :p

- Moved thread. Hardware & Coding Support is irrelevant when it comes to WoW scripts. We have a support section for WoW scripts -> World of Warcraft Support -> Scripting.

Most of the code written in that script is outdated, which I'm surprised as it was released recently. And as far as I can tell some variables aren't being used or are redundant.

Just pointing this out below:

Here is the up to date way in how CommandScript tables are written:

Code:
	std::vector<ChatCommand> GetCommands() const override
	{
	    static std::vector<ChatCommand> commandTable =
	    {
	        { wc1_world_chat_command.c_str(), 1, false, &HandleWorldChatCommand, "World Chat prefix." },
	    };

	    return commandTable;
	}


I did what I thought was necessary to the script, and it compiles fine (for me).

Code:
/*
a simple chat system with an adjustable prefix. default`.chat`.
with adjustable color layout and adjustable channel name.
made by slp13at420 of EmuDevs.com
*/
#include "Chat.h"
#include "Player.h"

std::string wc1_world_chat_command = "chat";
std::string wc1_channel_name = "World";

std::string wc1_TeamIcon[2] =
{
    "|TInterface\\icons\\Inv_Misc_Tournaments_banner_Human.png:13|t",
    "|TInterface\\icons\\Inv_Misc_Tournaments_banner_Orc.png:13|t"
};

std::string wc1_GM_ICON = "|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:13:13:0:-1|t";

std::string wc1_GM_RANK[4] =
{
    "Player",
    "GM1",
    "GM2",
    "GM3",
};

std::string wc1_ClassIcon[11] =
{
    "|TInterface\\icons\\INV_Sword_27.png:13|t",
    "|TInterface\\icons\\INV_Hammer_01.png:13|t",
    "|TInterface\\icons\\INV_Weapon_Bow_07.png:13|t",
    "|TInterface\\icons\\INV_ThrowingKnife_04.png:13|t",
    "|TInterface\\icons\\INV_Staff_30.png:13|t",
    "|TInterface\\icons\\Spell_Deathknight_ClassIcon.png:13|t",
    "|TInterface\\icons\\inv_jewelry_talisman_04.png:13|t",
    "|TInterface\\icons\\INV_Staff_30.png:13|t",
    "|TInterface\\icons\\INV_Staff_30.png:13|t",
    "",
    "|TInterface\\icons\\Ability_Druid_Maul.png:13|t",
};

std::string wc1_allyblue = "|cff3399FF";
std::string wc1_hordered = "|cffCC0000";
std::string wc1_white = "|cffFFFFFF";
std::string wc1_green = "|cff00cc00";
std::string wc1_red = "|cffFF0000";
std::string wc1_blue = "|cff6666FF";
std::string wc1_black = "|cff000000";
std::string wc1_grey = "|cff808080";

std::string wc1_TeamColor[2] = { wc1_allyblue, wc1_hordered };

class Player_WorldChat : public PlayerScript
{
public:
    Player_WorldChat() : PlayerScript("Player_WorldChat") { }

    void OnLogin(Player* player, bool /*firstLogin*/) override
    {
        ChatHandler(player->GetSession()).PSendSysMessage("type `.%s` for World Chat commands.", wc1_world_chat_command.c_str());
    }
};

class WORLD_CHAT : public CommandScript

{
public:
    WORLD_CHAT() : CommandScript("WORLD_CHAT") { }

    std::vector<ChatCommand> GetCommands() const override
    {
        static std::vector<ChatCommand> commandTable =
        {
            { wc1_world_chat_command.c_str(), 1, false, &HandleWorldChatCommand, "World Chat prefix." },
        };

	return commandTable;
    }

    static bool HandleWorldChatCommand(ChatHandler* handler, const char* msg)
    {
        // here you can apply different colors
        std::string wc1_channelcolor = wc1_grey;
        std::string wc1_gm_rankcolor = wc1_blue;
        std::string wc1_msgcolor = wc1_green;

        WorldSession* session = handler->GetSession();
        Player* player = session->GetPlayer();
        std::string WCMSG = "";

        WCMSG = "[" + wc1_channelcolor + wc1_channel_name + "|r]";
        WCMSG = WCMSG + "[" + wc1_TeamIcon[player->GetTeamId()] + "]";

        if (player->IsGameMaster())
        {
            WCMSG = WCMSG + "[" + wc1_GM_ICON + "]";
            WCMSG = WCMSG + "[" + wc1_gm_rankcolor + wc1_GM_RANK[session->GetSecurity()] + "|r]";
        }

        WCMSG = WCMSG + "[" + wc1_ClassIcon[player->getClass() - 1] + "]";
        WCMSG = WCMSG + "[" + wc1_TeamColor[player->GetTeamId()] + player->GetName() + "|r]";
        WCMSG = WCMSG + ":" + wc1_msgcolor + msg;

        sWorld->SendGlobalText(WCMSG.c_str(), NULL);

        return true;
    }
};

void AddSC_WorldChat()
{
    new Player_WorldChat;
}
 

Noones

Enthusiast
Thanky Tommy for helping me!

The edited script you posted compiled just fine!

Now i just need to find out how i can add the command to the server since .chat doesnt work ingame, even if it is in world.commands, auth.rbac_permissions and auth.rbac_linked_permissions!

i will post the updated script under slp13at420 releaase thread!

Update: apparently im to stupid to use the following code ingame:

Code:
	std::vector<ChatCommand> GetCommands() const override
	{
		static std::vector<ChatCommand> commandTable =
		{
			{ wc1_world_chat_command.c_str(), 1, false, &HandleWorldChatCommand, "World Chat prefix." },
		};

		return commandTable;
	}

How can i use the Worldchat ingame now?

I added the command under "world.commands" and got the connections in rbac right ( at least i think so ) still it shows me "There is no such command"

Startup Error: Table `command` have not existed command 'chat', skip. - i added

What i did in world.commands "INSERT INTO `command` VALUES ('chat', 900, 'Syntax: .chat');"




Greetings Noones
 
Last edited:

slp13at420

Mad Scientist
Did you link it to ScriptLoader.CPP?
Code:
[COLOR="#808080"]
#ifdef SCRIPTS
/* This is where custom scripts' loading functions should be declared. */
	void AddSC_WorldChat();
#endif

void AddCustomScripts()
{
#ifdef SCRIPTS
    /* This is where custom scripts should be added. */
	AddSC_WorldChat();
#endif
}
[/COLOR]

this is at the bottom of ScriptLoadrer.CPP

if not here is a link:
http://emudevs.com/showthread.php/13-Adding-a-C-script-to-your-core

and yea it is on the latest prior core version. once I find an up-to-date world DB for this huge change they did I will be able to update to the newest core .
lol that's the pro of ArcEmu , just clone from WhyDB and poof a ready-working DB.
none of this patch-this and patch-that like with TrinityCore I allways wind up with about 90 seconds of errors with trinity core rofl.
 
Last edited:

Noones

Enthusiast
Hello,

yeah i added the script to scriptloader.cpp and it looks like it is working fine.

Everytime you log in you get the message "type .chat for World Chat commands"

I added the command to "world.commands" and the auth Rbac tables.
 

slp13at420

Mad Scientist
this is a direct use command:
Code:
".chat hello world"

and yea my ooops, updated the login prompt. srry bout that :p

you have to type ".chat" every time you want to world chat.
 
Last edited:

Noones

Enthusiast
"There is no such command"

Using the updated Version from Tommy which he posted in this Thread.

No Errors or anything, script compiled, when you login you get the information to type .chat, but it wont work with .chat

could you add me in skype? kyle.nolte
 

Noones

Enthusiast
3 Days old, with all db updates, empty

the only thing i got in there is your worldchat script ( i thought this would be a good way to start :p )
 
Top