• 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] Minor Update Help

Status
Not open for further replies.

Ladd

Epic Member
Hey there! Don't really know my way around C++, but I've been reading some support topics and trying on my own for about 2 hours now, and I can't seem to "update" these two scripts.

The first one: https://gist.github.com/anonymous/f37c8468be4ea778e64d (Profession NPC)

It's giving me errors related to the creature whisper thing. Originally it was MonsterWhisper, which I found out was outdated, and tried to replace it (As per here) with the up-to-date one, but I'm still getting these errors when I compile. It looks like it's related to the target being "player" but I don't know how to fix that.


--------------

Script #2! https://gist.github.com/anonymous/06890ddbf9c76fd133e9

I honestly have no idea what the error is related to. I thought it was because I had .chat, .cha, .ch, and .c as the commands, but changing those didn't fix it.

Here's the error: https://gist.github.com/anonymous/b19c9904e551ba201b98

Any help (Even hints in the right direction!) would be appreciated. I'm having a hard time figuring it out.
 

Tommy

Founder
Code:
/root/ElunaTrinityWotlk/src/server/scripts/Custom/npc_prof.cpp:11:88: error: ‘player’ was not declared in this scope

This is because the Player variable being declared via parameter is "pPlayer" and not "player".

Code:
                void CreatureWhisperBasedOnBool(const char *text, Creature *_creature, Player *[COLOR="#00FF00"]pPlayer[/COLOR], bool value)
                {
                        if (value)
                             _creature->Whisper("You're in combat!", LANG_UNIVERSAL, [COLOR="#00FF00"]player[/COLOR], false);
                }

Should be (cleaned up a bit):


Code:
                void CreatureWhisperBasedOnBool(const char* text, Creature* creature, Player* [COLOR="#00FF00"]player[/COLOR], bool value)
                {
                        if (value)
                             creature->Whisper("You're in combat!", LANG_UNIVERSAL, [COLOR="#00FF00"]player[/COLOR], false);
                }


However, it doesn't look like this function is being used. Imo you can just delete it.

Second script, looks like it is using the old CommandScript code as it was updated awhile back.

Code:
	ChatCommand * GetCommands() const
	{
		static ChatCommand WorldChatCommandTable[] =
		{
			{ "chat", rbac::RBAC_PERM_COMMAND_CUSTOM_CHAT, true, &HandleWorldChatCommand, "", NULL },
			{ "cha", rbac::RBAC_PERM_COMMAND_CUSTOM_CHAT, true, &HandleWorldChatCommand, "", NULL },
			{ "ch", rbac::RBAC_PERM_COMMAND_CUSTOM_CHAT, true, &HandleWorldChatCommand, "", NULL },
			{ "c", rbac::RBAC_PERM_COMMAND_CUSTOM_CHAT, true, &HandleWorldChatCommand, "", NULL },
			{ NULL, 0, false, NULL, "", NULL }
		};

		return WorldChatCommandTable;
	}

Should be:

Code:
	[COLOR="#00FF00"]std::vector<ChatCommand> GetCommands() const override[/COLOR]
	{
		[COLOR="#00FF00"]static std::vector<ChatCommand> WorldChatCommandTable =[/COLOR]
		{
			{ "chat", rbac::RBAC_PERM_COMMAND_CUSTOM_CHAT, true, &HandleWorldChatCommand, "", NULL },
			{ NULL, 0, false, NULL, "", NULL }
		};

		return WorldChatCommandTable;
	}

P.S. All of the extra "cha", "ch" commands are very pointless so I removed them.
 

Ladd

Epic Member
Code:
/root/ElunaTrinityWotlk/src/server/scripts/Custom/npc_prof.cpp:11:88: error: ‘player’ was not declared in this scope

This is because the Player variable being declared via parameter is "pPlayer" and not "player".

Code:
                void CreatureWhisperBasedOnBool(const char *text, Creature *_creature, Player *[COLOR="#00FF00"]pPlayer[/COLOR], bool value)
                {
                        if (value)
                             _creature->Whisper("You're in combat!", LANG_UNIVERSAL, [COLOR="#00FF00"]player[/COLOR], false);
                }

Should be (cleaned up a bit):


Code:
                void CreatureWhisperBasedOnBool(const char* text, Creature* creature, Player* [COLOR="#00FF00"]player[/COLOR], bool value)
                {
                        if (value)
                             creature->Whisper("You're in combat!", LANG_UNIVERSAL, [COLOR="#00FF00"]player[/COLOR], false);
                }


However, it doesn't look like this function is being used. Imo you can just delete it.

Second script, looks like it is using the old CommandScript code as it was updated awhile back.

Code:
	ChatCommand * GetCommands() const
	{
		static ChatCommand WorldChatCommandTable[] =
		{
			{ "chat", rbac::RBAC_PERM_COMMAND_CUSTOM_CHAT, true, &HandleWorldChatCommand, "", NULL },
			{ "cha", rbac::RBAC_PERM_COMMAND_CUSTOM_CHAT, true, &HandleWorldChatCommand, "", NULL },
			{ "ch", rbac::RBAC_PERM_COMMAND_CUSTOM_CHAT, true, &HandleWorldChatCommand, "", NULL },
			{ "c", rbac::RBAC_PERM_COMMAND_CUSTOM_CHAT, true, &HandleWorldChatCommand, "", NULL },
			{ NULL, 0, false, NULL, "", NULL }
		};

		return WorldChatCommandTable;
	}

Should be:

Code:
	[COLOR="#00FF00"]std::vector<ChatCommand> GetCommands() const override[/COLOR]
	{
		[COLOR="#00FF00"]static std::vector<ChatCommand> WorldChatCommandTable =[/COLOR]
		{
			{ "chat", rbac::RBAC_PERM_COMMAND_CUSTOM_CHAT, true, &HandleWorldChatCommand, "", NULL },
			{ NULL, 0, false, NULL, "", NULL }
		};

		return WorldChatCommandTable;
	}

P.S. All of the extra "cha", "ch" commands are very pointless so I removed them.

Wow, thanks a ton!

I'm surprised I didn't find anything on the CommandScript code being updated, as it seems like it would be a pretty big change.

Is there a good reference for up-to-date classes and such for Trinity? I can't seem to find one.
 

Ladd

Epic Member
I've realized that this was just the beginning of those errors...Anything glaring you notice before I start digging around?
 

Tommy

Founder
Is there a good reference for up-to-date classes and such for Trinity? I can't seem to find one.

Not that I know of. It is probably best to go on github and search through the TC source that way or download it and use visual studio to find specific references to methods, etc.

I've realized that this was just the beginning of those errors...Anything glaring you notice before I start digging around?

Just paste the errors here.
 

Ladd

Epic Member
Code:
/root/ElunaTrinityWotlk/src/server/scripts/Custom/twink_chat.cpp: In member function ‘virtual std::vector<ChatCommand> twink_Chat::GetCommands() const’:
/root/ElunaTrinityWotlk/src/server/scripts/Custom/twink_chat.cpp:137:14: error: ‘RBAC_PERM_COMMAND_CUSTOM_CHAT’ is not a member of ‘rbac’
    { "chat", rbac::RBAC_PERM_COMMAND_CUSTOM_CHAT, true, &HandleWorldChatCommand, "", NULL },
              ^
compilation terminated due to -Wfatal-errors.
src/server/scripts/CMakeFiles/scripts.dir/build.make:1503: recipe for target 'src/server/scripts/CMakeFiles/scripts.dir/Custom/twink_chat.cpp.o' failed
make[2]: *** [src/server/scripts/CMakeFiles/scripts.dir/Custom/twink_chat.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/root/ElunaTrinityWotlk/src/server/scripts/Custom/npc_prof.cpp: In member function ‘bool Professions_NPC::LearnAllRecipesInProfession(Player*, SkillType)’:
/root/ElunaTrinityWotlk/src/server/scripts/Custom/npc_prof.cpp:71:39: error: ‘class Log’ has no member named ‘outError’
                                 sLog->outError(LOG_FILTER_PLAYER_SKILLS, "Profession NPC: received non-valid skill ID (LearnAllRecipesInProfession)");
                                       ^
compilation terminated due to -Wfatal-errors.
src/server/scripts/CMakeFiles/scripts.dir/build.make:1480: recipe for target 'src/server/scripts/CMakeFiles/scripts.dir/Custom/npc_prof.cpp.o' failed
make[2]: *** [src/server/scripts/CMakeFiles/scripts.dir/Custom/npc_prof.cpp.o] Error 1
CMakeFiles/Makefile2:1279: recipe for target 'src/server/scripts/CMakeFiles/scripts.dir/all' failed
make[1]: *** [src/server/scripts/CMakeFiles/scripts.dir/all] Error 2
Makefile:117: recipe for target 'all' failed
make: *** [all] Error 2
root@vps242179:~/ElunaTrinityWotlk/build#
 

Tommy

Founder
Honestly, have you ever looked for a newer profession npc? Since you're using Eluna there should be one scripted in Lua somewhere. Might be better to look than to fix errors one by one even if they are easy to fix.


Code:
sLog->outError(LOG_FILTER_PLAYER_SKILLS, "Profession NPC: received non-valid skill ID (LearnAllRecipesInProfession)");

Should be:

Code:
TC_LOG_ERROR("scripts", "Profession NPC: received non-valid skill ID (LearnAllRecipesInProfession)");

Code:
RBAC_PERM_COMMAND_CUSTOM_CHAT

This is a small edit inside of RBAC.h under the RBACPermissions enumerator
 

Ladd

Epic Member
Honestly, have you ever looked for a newer profession npc? Since you're using Eluna there should be one scripted in Lua somewhere. Might be better to look than to fix errors one by one even if they are easy to fix.


Code:
sLog->outError(LOG_FILTER_PLAYER_SKILLS, "Profession NPC: received non-valid skill ID (LearnAllRecipesInProfession)");

Should be:

Code:
TC_LOG_ERROR("scripts", "Profession NPC: received non-valid skill ID (LearnAllRecipesInProfession)");

Code:
RBAC_PERM_COMMAND_CUSTOM_CHAT

This is a small edit inside of RBAC.h under the RBACPermissions enumerator


Couldn't find any? Have one in mind?
 

Ladd

Epic Member
No, I haven't. Plus I'm terrible at Lua.

I don't even need the professions really, just an NPC to give them Lifeblood/Crit/Stam spells the professions give, but only 2 at a time.

I couldn't find any "real" tutorials on Eluna either. There was a megathread by one of the admins, but it's very sparse.
 

Ladd

Epic Member
Just an update: I couldn't manage to get the script working, so I looked for alternatives.

I found this for the Twink Profession NPC, and have not found a World Chat that I like yet.
 
Status
Not open for further replies.
Top