Getting problems when compiling a WarpNPC menu

User Tag List

Results 1 to 12 of 12
  1. #1
    killerweb0's Avatar Member
    Reputation
    1
    Join Date
    May 2007
    Posts
    25
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Getting problems when compiling a WarpNPC

    Hello
    I have a problem when compiling a WarpNPC with C++. The compiler says something about a wrong syntax or something when using break; and case. It also has some other problems. Here is my compilers output:

    Code:
    1>------ Rebuild All started: Project: GossipScripts, Configuration: Release Win32 ------
    1>Deleting intermediate and output files for project 'GossipScripts', configuration 'Release|Win32'
    1>Compiling...
    1>Warper.cpp
    1>..srcGossipScriptsWarper.cpp(42) : error C2059: syntax error : 'switch'
    1>..srcGossipScriptsWarper.cpp(43) : error C2143: syntax error : missing ';' before '{'
    1>..srcGossipScriptsWarper.cpp(43) : error C2447: '{' : missing function header (old-style formal list?)
    1>..srcGossipScriptsWarper.cpp(48) : error C2059: syntax error : 'case'
    1>..srcGossipScriptsWarper.cpp(49) : error C2447: '{' : missing function header (old-style formal list?)
    1>..srcGossipScriptsWarper.cpp(58) : error C2059: syntax error : 'break'
    1>..srcGossipScriptsWarper.cpp(61) : error C2059: syntax error : 'case'
    1>..srcGossipScriptsWarper.cpp(62) : error C2447: '{' : missing function header (old-style formal list?)
    1>..srcGossipScriptsWarper.cpp(71) : error C2059: syntax error : 'break'
    1>..srcGossipScriptsWarper.cpp(74) : error C2059: syntax error : 'case'
    1>..srcGossipScriptsWarper.cpp(75) : error C2447: '{' : missing function header (old-style formal list?)
    1>..srcGossipScriptsWarper.cpp(82) : error C2059: syntax error : 'break'
    1>..srcGossipScriptsWarper.cpp(84) : error C2059: syntax error : 'case'
    1>..srcGossipScriptsWarper.cpp(85) : error C2447: '{' : missing function header (old-style formal list?)
    1>..srcGossipScriptsWarper.cpp(90) : error C2059: syntax error : 'break'
    1>..srcGossipScriptsWarper.cpp(92) : error C2059: syntax error : 'case'
    1>..srcGossipScriptsWarper.cpp(93) : error C2447: '{' : missing function header (old-style formal list?)
    1>..srcGossipScriptsWarper.cpp(98) : error C2059: syntax error : 'break'
    1>..srcGossipScriptsWarper.cpp(100) : error C2059: syntax error : 'case'
    1>..srcGossipScriptsWarper.cpp(101) : error C2447: '{' : missing function header (old-style formal list?)
    1>..srcGossipScriptsWarper.cpp(104) : error C2059: syntax error : 'break'
    1>..srcGossipScriptsWarper.cpp(106) : error C2059: syntax error : 'case'
    1>..srcGossipScriptsWarper.cpp(107) : error C2447: '{' : missing function header (old-style formal list?)
    1>..srcGossipScriptsWarper.cpp(110) : error C2059: syntax error : 'break'
    1>..srcGossipScriptsWarper.cpp(112) : error C2059: syntax error : 'case'
    1>..srcGossipScriptsWarper.cpp(113) : error C2447: '{' : missing function header (old-style formal list?)
    1>..srcGossipScriptsWarper.cpp(116) : error C2059: syntax error : 'break'
    1>..srcGossipScriptsWarper.cpp(118) : error C2059: syntax error : 'case'
    1>..srcGossipScriptsWarper.cpp(119) : error C2447: '{' : missing function header (old-style formal list?)
    1>..srcGossipScriptsWarper.cpp(122) : error C2059: syntax error : 'break'
    1>..srcGossipScriptsWarper.cpp(124) : error C2059: syntax error : 'case'
    1>..srcGossipScriptsWarper.cpp(125) : error C2447: '{' : missing function header (old-style formal list?)
    1>..srcGossipScriptsWarper.cpp(128) : error C2059: syntax error : 'break'
    1>..srcGossipScriptsWarper.cpp(130) : error C2059: syntax error : 'case'
    1>..srcGossipScriptsWarper.cpp(131) : error C2447: '{' : missing function header (old-style formal list?)
    1>..srcGossipScriptsWarper.cpp(134) : error C2059: syntax error : 'break'
    1>..srcGossipScriptsWarper.cpp(136) : error C2059: syntax error : 'case'
    1>..srcGossipScriptsWarper.cpp(137) : error C2447: '{' : missing function header (old-style formal list?)
    1>..srcGossipScriptsWarper.cpp(140) : error C2059: syntax error : 'break'
    1>..srcGossipScriptsWarper.cpp(142) : error C2059: syntax error : 'case'
    1>..srcGossipScriptsWarper.cpp(143) : error C2447: '{' : missing function header (old-style formal list?)
    1>..srcGossipScriptsWarper.cpp(146) : error C2059: syntax error : 'break'
    1>..srcGossipScriptsWarper.cpp(148) : error C2059: syntax error : 'case'
    1>..srcGossipScriptsWarper.cpp(149) : error C2447: '{' : missing function header (old-style formal list?)
    1>..srcGossipScriptsWarper.cpp(152) : error C2059: syntax error : 'break'
    1>..srcGossipScriptsWarper.cpp(154) : error C2059: syntax error : 'case'
    1>..srcGossipScriptsWarper.cpp(155) : error C2447: '{' : missing function header (old-style formal list?)
    1>..srcGossipScriptsWarper.cpp(160) : error C2059: syntax error : 'break'
    1>..srcGossipScriptsWarper.cpp(162) : error C2059: syntax error : 'case'
    1>..srcGossipScriptsWarper.cpp(163) : error C2447: '{' : missing function header (old-style formal list?)
    1>..srcGossipScriptsWarper.cpp(172) : error C2059: syntax error : 'break'
    1>..srcGossipScriptsWarper.cpp(183) : error C2143: syntax error : missing ';' before '}'
    1>GuardGossip.cpp
    1>Gossip_Innkeepers.cpp
    1>Gossip_Battlemaster.cpp
    1>Setup.cpp
    1>Build log was saved at "file://c:UsersBennerDesktopAscentSourcesrcscriptsprojects2008_int_release_gossipscriptsBuildLog.htm"
    1>GossipScripts - 52 error(s), 0 warning(s)
    ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
    I know its alot of errors but they're all the same. Here is my Warper.cpp (I'm compiling it in the GossipScripts folder):

    Code:
    #include "StdAfx.h"
    #include "Setup.h"
    
    #ifdef WIN32
    #pragma warning(disable:4305)
    #endif
    
    class SCRIPT_DECL GlobalNPC : public GossipScript
    {
    public:
        void GossipHello(Object * pObject, Player* Plr, bool AutoSend);
        void GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code);
        void GossipEnd(Object * pObject, Player* Plr);
    	void Destroy()
    	{
    		delete this;
    	}
    };
    
    void GlobalNPC::GossipHello(Object * pObject, Player* Plr, bool AutoSend)
        {
            GossipMenu *Menu;
            objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
    
    		if(Plr->getRace()== 10||Plr->getRace()== 2||Plr->getRace()== 6||Plr->getRace()== 8||Plr->getRace()== 5)
    		{Menu->AddItem(0, "[Horde Cities]", 1);}else{Menu->AddItem(0, "[Alliance Cities]", 2);}
    		Menu->AddItem(0, "[Cross Faction Cities]", 3);
    		Menu->AddItem(5, "Shopping Mall", 4);
    		Menu->AddItem(5, "Concert", 5);
    
    		if(AutoSend)
                Menu->SendTo(Plr);
        }
    
    void GlobalNPC::GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
        {
    	Creature * pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?((Creature*)pObject):NULL;
    	if(pCreature==NULL)
    		return;
    	}
            GossipMenu * Menu;
            switch(IntId)
            {
    			case 0: //Nothing
    		GossipHello(pObject, Plr, true);
            break;
    		}
    				case 1: //Horde Cities
                    {
                    objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
    				Menu->AddItem(5, "Orgrimmar", 6);
                    Menu->AddItem(5, "Thunder Bluff", 7);
                    Menu->AddItem(5, "Undercity", 8);
                    Menu->AddItem(5, "Silvermoon City", 9);
    				Menu->AddItem(5, "[Back]", 99);
                    Menu->SendTo(Plr);
    				}
            break;
    
    
    				case 2: //Ally Cities
                    {
                    objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
    				Menu->AddItem(5, "Ironforge", 10);
                    Menu->AddItem(5, "Stormwind City", 11);
                    Menu->AddItem(5, "Darnassus", 12);
                    Menu->AddItem(5, "The Exodar", 13);
    				Menu->AddItem(5, "[Back]", 99);
                    Menu->SendTo(Plr);
    				}
            break;
    
    
    				case 3: //Crossed Cities
                    {
                    objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
    				Menu->AddItem(5, "Shattrath City", 14);
    				Menu->AddItem(5, "Sharalith City", 15);
    				Menu->AddItem(5, "[Back]", 99);
                    Menu->SendTo(Plr);
    				}
    			break;
    
    			case 4: //Shopping Mall
                {
    			   objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
                   Menu->AddItem(5, "Shopping Mall is currently unavailable", 99);
    			   Menu->SendTo(Plr);
                }
    			break;
    
    			case 5: //Concert
                {
    			   objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
                   Menu->AddItem(5, "Concert is currently unavailable", 99);
    			   Menu->SendTo(Plr);
                }
    			break;
    
    			case 6: //Orgrimmar
                {
                    Plr->EventTeleport(1, 1502.71, -4415.42, 22.5512);
                }
    			break;
    
    			case 7: //Thunder Bluff
                {
                    Plr->EventTeleport(1, -1285.42, 176.523, 130.994);
                }
    			break;
    
    			case 8: //Undercity
                {
                    Plr->EventTeleport(0, 1831.26, 238.53, 61.52);
                }
    			break;
    
    			case 9: //Silvermoon
                {
                    Plr->EventTeleport(530, 9414.18, -7278.97, 15.2031);
                }
    			break;
    
    			case 10: //Ironforge
                {
                    Plr->EventTeleport(0, -4981.25, -881.542, 502.66);
                }
    			break;
    
    			case 11: //Stormwind
                {
                    Plr->EventTeleport(0, -8913.23, 554.633, 94.7944);
                }
    			break;
    
    			case 12: //Darnassus
                {
                    Plr->EventTeleport(1, 8795.8, 969.427, 31.1955);
                }
    			break;
    
    			case 13: //Exodar
                {
                    Plr->EventTeleport(530, -4014.08, -11895.8, -0.99324);
                }
    			break;
    
    			case 14: //Shattrath
                {
                    Plr->EventTeleport(530, -1722.58, 5382.7, 2.47504);
                }
    			break;
    
    			case 15: //Sharalith
                {
    			   objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
                   Menu->AddItem(5, "Sharalith is under Development", 99);
    			   Menu->SendTo(Plr);
                }
    			break;
    
    			case 99: //Back
    			{
    				    objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
    				if(Plr->getRace()== 10||Plr->getRace()== 2||Plr->getRace()== 6||Plr->getRace()== 8||Plr->getRace()== 5)
    				{Menu->AddItem(0, "[Horde Cities]", 1);}else{Menu->AddItem(0, "[Alliance Cities]", 2);}
    				Menu->AddItem(0, "[Cross Faction Cities]", 3);
    				Menu->AddItem(5, "Shopping Mall", 4);
    				Menu->AddItem(5, "Concert", 5);
                    Menu->SendTo(Plr);
    			}
    			break;
    
    			void GlobalNPC::GossipEnd(Object * pObject, Player* Plr)
    {
        GossipScript::GossipEnd(pObject, Plr);
    }
    
    void SetupGlobalNPC(ScriptMgr * mgr)
    {
    	GossipScript * gs = (GossipScript*) new GlobalNPC();
        mgr->register_gossip_script(100000, gs)
    }
    Last edited by killerweb0; 06-26-2008 at 10:20 AM.

    Getting problems when compiling a WarpNPC
  2. #2
    killerweb0's Avatar Member
    Reputation
    1
    Join Date
    May 2007
    Posts
    25
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Please i really need help here guys. This thread almost havn't been read.

  3. #3
    TheSpidey's Avatar Elite User
    Reputation
    365
    Join Date
    Jan 2008
    Posts
    2,200
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    void GlobalNPC::GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
        {
    	Creature * pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?((Creature*)pObject):NULL;
    	if(pCreature==NULL)
    		return;
    	}
    See how the brace ends the function?

  4. #4
    killerweb0's Avatar Member
    Reputation
    1
    Join Date
    May 2007
    Posts
    25
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by TheSpidey View Post
    Code:
    void GlobalNPC::GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
        {
    	Creature * pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?((Creature*)pObject):NULL;
    	if(pCreature==NULL)
    		return;
    	}
    See how the brace ends the function?
    What do you mean?

  5. #5
    TheSpidey's Avatar Elite User
    Reputation
    365
    Join Date
    Jan 2008
    Posts
    2,200
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    void GlobalNPC::GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
    {
    Creature * pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?((Creature*)pObject):NULL;
    if(pCreature==NULL)
    return;
    } <---- This brace ends the function. Whatever comes next will NOT be executed by the function

  6. #6
    doublehex's Avatar Member
    Reputation
    34
    Join Date
    Mar 2007
    Posts
    385
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    in easy terms just get rid of that bracket that ends the function.


  7. #7
    killerweb0's Avatar Member
    Reputation
    1
    Join Date
    May 2007
    Posts
    25
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh. Thank you +Rep for you
    Last edited by killerweb0; 06-30-2008 at 01:11 AM.

  8. #8
    killerweb0's Avatar Member
    Reputation
    1
    Join Date
    May 2007
    Posts
    25
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well this didnt work I tried removing the bracket but this came out in the compiler output:

    Code:
    1>------ Rebuild All started: Project: GossipScripts, Configuration: Release Win32 ------
    1>Deleting intermediate and output files for project 'GossipScripts', configuration 'Release|Win32'
    1>Compiling...
    1>Warper.cpp
    1>..srcGossipScriptsWarper.cpp(48) : error C2046: illegal case
    1>..srcGossipScriptsWarper.cpp(58) : error C2043: illegal break
    1>..srcGossipScriptsWarper.cpp(61) : error C2046: illegal case
    1>..srcGossipScriptsWarper.cpp(71) : error C2043: illegal break
    1>..srcGossipScriptsWarper.cpp(74) : error C2046: illegal case
    1>..srcGossipScriptsWarper.cpp(82) : error C2043: illegal break
    1>..srcGossipScriptsWarper.cpp(84) : error C2046: illegal case
    1>..srcGossipScriptsWarper.cpp(90) : error C2043: illegal break
    1>..srcGossipScriptsWarper.cpp(92) : error C2046: illegal case
    1>..srcGossipScriptsWarper.cpp(98) : error C2043: illegal break
    1>..srcGossipScriptsWarper.cpp(100) : error C2046: illegal case
    1>..srcGossipScriptsWarper.cpp(104) : error C2043: illegal break
    1>..srcGossipScriptsWarper.cpp(106) : error C2046: illegal case
    1>..srcGossipScriptsWarper.cpp(110) : error C2043: illegal break
    1>..srcGossipScriptsWarper.cpp(112) : error C2046: illegal case
    1>..srcGossipScriptsWarper.cpp(116) : error C2043: illegal break
    1>..srcGossipScriptsWarper.cpp(118) : error C2046: illegal case
    1>..srcGossipScriptsWarper.cpp(122) : error C2043: illegal break
    1>..srcGossipScriptsWarper.cpp(124) : error C2046: illegal case
    1>..srcGossipScriptsWarper.cpp(128) : error C2043: illegal break
    1>..srcGossipScriptsWarper.cpp(130) : error C2046: illegal case
    1>..srcGossipScriptsWarper.cpp(134) : error C2043: illegal break
    1>..srcGossipScriptsWarper.cpp(136) : error C2046: illegal case
    1>..srcGossipScriptsWarper.cpp(140) : error C2043: illegal break
    1>..srcGossipScriptsWarper.cpp(142) : error C2046: illegal case
    1>..srcGossipScriptsWarper.cpp(146) : error C2043: illegal break
    1>..srcGossipScriptsWarper.cpp(148) : error C2046: illegal case
    1>..srcGossipScriptsWarper.cpp(152) : error C2043: illegal break
    1>..srcGossipScriptsWarper.cpp(154) : error C2046: illegal case
    1>..srcGossipScriptsWarper.cpp(160) : error C2043: illegal break
    1>..srcGossipScriptsWarper.cpp(162) : error C2046: illegal case
    1>..srcGossipScriptsWarper.cpp(172) : error C2043: illegal break
    1>..srcGossipScriptsWarper.cpp(175) : error C2601: 'GlobalNPC::GossipEnd' : local function definitions are illegal
    1>        ..srcGossipScriptsWarper.cpp(36): this line contains a '{' which has not yet been matched
    1>..srcGossipScriptsWarper.cpp(180) : error C2601: 'SetupGlobalNPC' : local function definitions are illegal
    1>        ..srcGossipScriptsWarper.cpp(36): this line contains a '{' which has not yet been matched
    1>..srcGossipScriptsWarper.cpp(184) : fatal error C1075: end of file found before the left brace '{' at '..srcGossipScriptsWarper.cpp(36)' was matched
    1>GuardGossip.cpp
    1>Gossip_Innkeepers.cpp
    1>Gossip_Battlemaster.cpp
    1>Setup.cpp
    1>Build log was saved at "file://c:UsersBennerDesktopAscentSourcesrcscriptsprojects2008_int_release_gossipscriptsBuildLog.htm"
    1>GossipScripts - 35 error(s), 0 warning(s)
    ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
    Do you know what went wrong here?

  9. #9
    SectorSeven's Avatar Banned
    Reputation
    444
    Join Date
    Oct 2007
    Posts
    1,948
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey add me MSN [email protected] and I'll fix it on Teamviewer for you

  10. #10
    killerweb0's Avatar Member
    Reputation
    1
    Join Date
    May 2007
    Posts
    25
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by SectorSeven View Post
    Hey add me MSN [email protected] and I'll fix it on Teamviewer for you
    Okay [Too short message..]

  11. #11
    TheSpidey's Avatar Elite User
    Reputation
    365
    Join Date
    Jan 2008
    Posts
    2,200
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Again, this switch is closed on the first case
    switch(IntId)
    {
    case 0: //Nothing
    GossipHello(pObject, Plr, true);
    break;
    }

    All other cases are out of the switch.

    You should really try counting braces

  12. #12
    doublehex's Avatar Member
    Reputation
    34
    Join Date
    Mar 2007
    Posts
    385
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i would suggest notepad++ as it helps to show where brackets close.


Similar Threads

  1. [HELP] Getting errors when compileing ascent trunk scripts
    By Fronix in forum World of Warcraft Emulator Servers
    Replies: 7
    Last Post: 03-25-2008, 04:10 PM
  2. how long time befor you get mail when ppl send to you`?
    By fiskerfisk in forum World of Warcraft General
    Replies: 9
    Last Post: 11-04-2007, 12:49 PM
  3. [Question] Problem when saving in .gif
    By Remahlól in forum Art & Graphic Design
    Replies: 0
    Last Post: 10-12-2007, 07:18 PM
  4. getting error when trying to change size
    By kanezfan in forum WoW ME Questions and Requests
    Replies: 3
    Last Post: 07-31-2007, 08:57 PM
  5. GUIDE: How to get unstuck when exploring
    By Fault in forum World of Warcraft Exploration
    Replies: 3
    Last Post: 12-24-2006, 03:07 PM
All times are GMT -5. The time now is 10:16 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search