C and C++ Discussions about C and C++
[Help] What I did wrong?
Corporal
Rep Power: 2
Reputation: 8 Posts: 26
Join Date: Mar 2007
[Help] What I did wrong? -
06-08-2008
So I copied the Guard's Code and modified it so it looks like this:
Code:
#include "StdAfx.h"
#ifdef WIN32
#pragma warning(disable:4305) // warning C4305: 'argument' : truncation from 'double' to 'float'
#endif
/************************************************************************/
/* GENERAL GUARD SCRIPT */
/************************************************************************/
// Covers *all* guard types, scripting their texts to guide players around.
// Enable this define to make all gossip texts have a "back" / "I was looking
// for somethinge else" button added.
#define BACK_BUTTON
#ifdef BACK_BUTTON
// Make code neater with this define.
#define SendQuickMenu(textid) objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), textid, Plr); \
Menu->SendTo(Plr);
#else
// Make code neater with this define.
#define SendQuickMenu(textid) objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), textid, Plr); \
Menu->AddItem(0, "I wanna do something else.", 0); \
Menu->SendTo(Plr);
#endif
/************************************************************************/
/* WoWNezz Functions NPC */
/************************************************************************/
class SCRIPT_DECL StormwindGuard : public GossipScript
{
public:
void Destroy()
{
delete this;
}
void GossipHello(Object* pObject, Player * Plr, bool AutoSend)
{
GossipMenu *Menu;
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 2593, Plr);
Menu->AddItem(0, "Player Tools", 1);
Menu->AddItem(0, "Server Tools", 2);
Menu->AddItem(0, "Morphs Menu", 3);
Menu->AddItem(0, "Support", 4);
Menu->AddItem(0, "Vote for us at WoWNezzRealms.tk!", 5);
if(AutoSend)
Menu->SendTo(Plr);
}
void GossipSelectOption(Object* pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
{
GossipMenu * Menu;
switch(IntId)
{
case 0: // Return to start
GossipHello(pObject, Plr, true);
break;
// Player Tools Menu
case 1: //Player Tools menu
{
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 4264, Plr);
Menu->AddItem( 0, "Force Rename Character", 10);
Menu->AddItem( 0, "Suicide!" , 11);
Menu->SendTo(Plr);
}break;
case 2: //Server Tools menu
{
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 4264, Plr);
Menu->AddItem( 0, "Server Stats", 20);
Menu->AddItem( 0, "Show Message of the Day" , 21);
Menu->SendTo(Plr);
}break;
case 3: //Morphs menu!
{
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 4264, Plr);
Menu->AddItem(0, "Criter Morph", 30)
Menu->AddItem(0, "Animals Morph", 31)
Menu->AddItem(0, "Elemental Morph", 32)
Menu->AddItem(0, "Humanoid Morph", 33)
Menu->AddItem(0, "Boss Morphs", 34)
Menu->AddItem(0, "Other Morphs", 35)
}
void SetupGuardGossip(ScriptMgr * mgr)
{
GossipScript * sw = (GossipScript*) new StormwindGuard();
mgr->register_gossip_script(68, sw);
} Didn't finished it yet.. Uhm the error is :
Code:
.\FunctionNPC.cpp(109) : fatal error C1075: end of file found before the left brace '{' at '.\FunctionNPC.cpp(62)' was matched I tried to include Setup.h but it said Setup.h wasnt found (And its in same compile) So if anyone can help do it pls!
Donate to remove ads. Contributor
Rep Power: 3
Posts: 638
Join Date: Dec 2006
Location: Scotland
06-08-2008
Put another } at the end of the file and see if that helps.
Corporal
Rep Power: 2
Reputation: 8 Posts: 26
Join Date: Mar 2007
06-08-2008
Not worked.. Now it says me:
Code:
.FunctionNPC.cpp(59) : error C2059: syntax error : '{'
.FunctionNPC.cpp(59) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body
.FunctionNPC.cpp(111) : fatal error C1004: unexpected end-of-file found I also tried to put a 2nd } but now it says:
Code:
.FunctionNPC.cpp(59) : error C2059: syntax error : '{'
.FunctionNPC.cpp(59) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body
.FunctionNPC.cpp(113) : fatal error C1075: end of file found before the left brace '{' at '.FunctionNPC.cpp(37)' was matched
Last edited by darkgabou15; 06-08-2008 at 02:33 PM .
Contributor
Rep Power: 3
Reputation: 110 Posts: 359
Join Date: Sep 2006
06-08-2008
Try this:
Code:
#include "StdAfx.h"
#ifdef WIN32
#pragma warning(disable:4305) // warning C4305: 'argument' : truncation from 'double' to 'float'
#endif
/************************************************************************/
/* GENERAL GUARD SCRIPT */
/************************************************************************/
// Covers *all* guard types, scripting their texts to guide players around.
// Enable this define to make all gossip texts have a "back" / "I was looking
// for somethinge else" button added.
#define BACK_BUTTON
#ifdef BACK_BUTTON
// Make code neater with this define.
#define SendQuickMenu(textid) objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), textid, Plr);
Menu->SendTo(Plr);
#else
// Make code neater with this define.
#define SendQuickMenu(textid) objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), textid, Plr);
Menu->AddItem(0, "I wanna do something else.", 0);
Menu->SendTo(Plr);
#endif
/************************************************************************/
/* WoWNezz Functions NPC */
/************************************************************************/
class SCRIPT_DECL StormwindGuard : public GossipScript
{
public:
void Destroy()
{
delete this;
}
void GossipHello(Object* pObject, Player * Plr, bool AutoSend)
{
GossipMenu *Menu;
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 2593, Plr);
Menu->AddItem(0, "Player Tools", 1);
Menu->AddItem(0, "Server Tools", 2);
Menu->AddItem(0, "Morphs Menu", 3);
Menu->AddItem(0, "Support", 4);
Menu->AddItem(0, "Vote for us at WoWNezzRealms.tk!", 5);
if(AutoSend)
Menu->SendTo(Plr);
}
void GossipSelectOption(Object* pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
{
GossipMenu * Menu;
switch(IntId)
{
case 0: // Return to start
GossipHello(pObject, Plr, true);
break;
// Player Tools Menu
case 1: //Player Tools menu
{
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 4264, Plr);
Menu->AddItem( 0, "Force Rename Character", 10);
Menu->AddItem( 0, "Suicide!" , 11);
Menu->SendTo(Plr);
}break;
case 2: //Server Tools menu
{
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 4264, Plr);
Menu->AddItem( 0, "Server Stats", 20);
Menu->AddItem( 0, "Show Message of the Day" , 21);
Menu->SendTo(Plr);
}break;
case 3: //Morphs menu!
}
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 4264, Plr);
Menu->AddItem(0, "Criter Morph", 30)
Menu->AddItem(0, "Animals Morph", 31)
Menu->AddItem(0, "Elemental Morph", 32)
Menu->AddItem(0, "Humanoid Morph", 33)
Menu->AddItem(0, "Boss Morphs", 34)
Menu->AddItem(0, "Other Morphs", 35)
}
}
void SetupGuardGossip(ScriptMgr * mgr)
{
GossipScript * sw = (GossipScript*) new StormwindGuard();
mgr->register_gossip_script(68, sw);
}
I was here. ~Dragon[Sky] I was here too. ~Kuiren
Corporal
Rep Power: 2
Reputation: 8 Posts: 26
Join Date: Mar 2007
06-08-2008
Nope... Now getting error:
Code:
.FunctionNPC.cpp(21) : error C2143: syntax error : missing ';' before '->'
.FunctionNPC.cpp(21) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
.FunctionNPC.cpp(103) : error C2628: 'StormwindGuard' followed by 'void' is illegal (did you forget a ';'?)
.FunctionNPC.cpp(90) : error C2143: syntax error : missing ';' before '}'
.FunctionNPC.cpp(93) : error C2146: syntax error : missing ';' before identifier 'Menu'
.FunctionNPC.cpp(94) : error C2146: syntax error : missing ';' before identifier 'Menu'
.FunctionNPC.cpp(95) : error C2146: syntax error : missing ';' before identifier 'Menu'
.FunctionNPC.cpp(96) : error C2146: syntax error : missing ';' before identifier 'Menu'
.FunctionNPC.cpp(97) : error C2146: syntax error : missing ';' before identifier 'Menu'
.FunctionNPC.cpp(98) : error C2143: syntax error : missing ';' before '}'
Build log was saved at "file://c:Documents and SettingsAcerBureauAscent Sou I'm feeling bored now -.-
Contributor
Rep Power: 2
Posts: 270
Join Date: May 2008
Location: Europe
06-08-2008
Try this
should remove some errors, maybe not all
Code:
#include "StdAfx.h"
#ifdef WIN32
#pragma warning(disable:4305) // warning C4305: 'argument' : truncation from 'double' to 'float'
#endif
/************************************************************************/
/* GENERAL GUARD SCRIPT */
/************************************************************************/
// Covers *all* guard types, scripting their texts to guide players around.
// Enable this define to make all gossip texts have a "back" / "I was looking
// for somethinge else" button added.
#define BACK_BUTTON
#ifdef BACK_BUTTON
// Make code neater with this define.
#define SendQuickMenu(textid) objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), textid, Plr);
Menu->SendTo(Plr);
#else
// Make code neater with this define.
#define SendQuickMenu(textid) objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), textid, Plr);
Menu->AddItem(0, "I wanna do something else.", 0);
Menu->SendTo(Plr);
#endif
/************************************************************************/
/* WoWNezz Functions NPC */
/************************************************************************/
class SCRIPT_DECL StormwindGuard : public GossipScript
{
public:
void Destroy()
{
delete this;
}
void GossipHello(Object* pObject, Player * Plr, bool AutoSend)
{
GossipMenu *Menu;
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 2593, Plr);
Menu->AddItem(0, "Player Tools", 1);
Menu->AddItem(0, "Server Tools", 2);
Menu->AddItem(0, "Morphs Menu", 3);
Menu->AddItem(0, "Support", 4);
Menu->AddItem(0, "Vote for us at WoWNezzRealms.tk!", 5);
if(AutoSend)
Menu->SendTo(Plr);
}
void GossipSelectOption(Object* pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
{
GossipMenu * Menu;
switch(IntId)
{
case 0: // Return to start
GossipHello(pObject, Plr, true);
break;
// Player Tools Menu
case 1: //Player Tools menu
{
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 4264, Plr);
Menu->AddItem( 0, "Force Rename Character", 10);
Menu->AddItem( 0, "Suicide!" , 11);
Menu->SendTo(Plr);
}break;
case 2: //Server Tools menu
{
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 4264, Plr);
Menu->AddItem( 0, "Server Stats", 20);
Menu->AddItem( 0, "Show Message of the Day" , 21);
Menu->SendTo(Plr);
}break;
case 3: //Morphs menu!
{
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 4264, Plr);
Menu->AddItem(0, "Criter Morph", 30);
Menu->AddItem(0, "Animals Morph", 31);
Menu->AddItem(0, "Elemental Morph", 32);
Menu->AddItem(0, "Humanoid Morph", 33);
Menu->AddItem(0, "Boss Morphs", 34);
Menu->AddItem(0, "Other Morphs", 35);
}
}
void SetupGuardGossip(ScriptMgr * mgr)
{
GossipScript * sw = (GossipScript*) new StormwindGuard();
mgr->register_gossip_script(68, sw);
}
Anti-social Engineer
Legendary User Rep Power: 7
Posts: 1,384
Join Date: Apr 2007
Location: Psychedelic Skies
06-12-2008
Why do you use #define macros!? ;_;
They're horrible. D:
Donate to remove ads.
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by
vBSEO 3.1.0
vBulletin Skin developed by:
vBStyles.com