Help| storing a string into an int by using a codebox

Hello!

So, I’m trying to use the gossip option for the codebox to store a string, and by storing the string - I will be able to reuse it for a certain purpose.

For the sake of comprehension I will demonstrate it:

A.Player gossip with NPC

B.Player clicks on a button named: Npc Say

C. A code box appear

D. Player insert a string: “My npc will now say bla bla bla”.

E. npc says the string that player has just recently typed.

May I ask to see an actual examples of how this can be done, using the codebox.

Thanks!

It can’t be done.

Umm, the string is passed as an argument to the gossipselect function… Do w/e you want with it xD

#include "ScriptPCH.h"

class example_gossip_codebox2 : public CreatureScript
{
    public:

        example_gossip_codebox2()
            : CreatureScript("example_gossip_codebox2")
        {
        }

        bool OnGossipHello(Player* player, Creature* creature) OVERRIDE
        {
            player->ADD_GOSSIP_ITEM_EXTENDED(0, "Npc Say", 0, 0, "", 0, true);
            player->ADD_GOSSIP_ITEM(7, "Bye", 0, 0);
            player->PlayerTalkClass->SendGossipMenu(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
            return true;
        }

        bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) OVERRIDE
        {
            player->PlayerTalkClass->ClearMenus();
            player->CLOSE_GOSSIP_MENU();
            return true;
        }

        bool OnGossipSelectCode(Player* player, Creature* creature, uint32 sender, uint32 action, char const* code) OVERRIDE
        {
            player->PlayerTalkClass->ClearMenus();
            creature->MonsterSay(code, 0, player->GetGUID());
            return true;
        }
};

void AddSC_example_gossip_codebox2()
{
    new example_gossip_codebox2();
}

Didnt test

Yep, thanks rochet - luckily I figured it out my self!