C++ help

Discussion in 'Software' started by spirit1flyer, Nov 3, 2005.

  1. spirit1flyer

    spirit1flyer Private E-2

    I am getting Main.cpp(90) : error C2143: syntax error : missing ';' before '...'
    whenever I try to compile my code. But whenever I add ; it still does not work
    here is part of my code.

    CreateTimeTrigger( 1, 1, 300, "Meteor" );
    ...

    SCRIPT_API void Function();
    {
    TethysGame::SetMeteor(40,40,5);
    }


    What am I doing wrong?
     
  2. QuickSilver

    QuickSilver Corporal

    Not sure...

    My C++ is a little rusty but when you are writing a function you don't end the function name line in a ';' - you only do that on the prototype at the top of the code...

    so:

    Code:
    int myCoolFunction(int i); //prototype
    
    int myCoolFunction(int i)  //actual function - no ; 
    {
      //damn this function is hot
    }
    Thats the only thing that stands out from the 4 lines of code you've shown us...
     
  3. spirit1flyer

    spirit1flyer Private E-2

    here is all the code then. I don't really know a thing about C++ I am the only one willing to learn how to code the missions in C++ though.
    Everyone else at the forum I am based at, is fairly lazy and unhelpful
    So I took it upon myself to learn C++ so I could have new mssions for the game


    Code:
     define WIN32_LEAN_AND_MEAN		
    #include <windows.h>
    
    
    #include <Outpost2DLL.h>
    
    #include <OP2Helper.h>
    #include <BaseBuilder.h>
    
    #include "BaseData.h"
    
    
    char MapName[]			= "cow.map";		
    char LevelDesc[]		= "testing weather";	
    char TechtreeName[]		= "multitek.TXT";	
    SDescBlock DescBlock	= { Colony, 1, 12, 0 }; 
    
    BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
    {
    	if (fdwReason == DLL_PROCESS_ATTACH) 
    	{
    		DisableThreadLibraryCalls(hinstDLL);
    	}
    
        return TRUE;
    }
    
    int InitProc()
    {
    	int i;
    	RandomizeStartingLocations(autosize(startLocation));
    	Player[0].GoEden();
    
    	for (i = 0; i < TethysGame::NoPlayers(); i++)
    	{
    		InitPlayerResources(i);
    
    		StartLocation &sLoc = startLocation[i];
    		CreateBase(i, sLoc.x, sLoc.y, *sLoc.baseInfo);
    		Player[i].CenterViewOn(sLoc.x, sLoc.y);
    
    
    		
    	}
    
    
    	// Misc initialization
    	TethysGame::CreateWreck(20, 20, (map_id)11999, 0);     TethysGame::ForceMoraleGood(-1);
    	if (TethysGame::UsesMorale())
    		TethysGame::FreeMoraleLevel(-1);
    	TethysGame::SetDaylightEverywhere(TethysGame::UsesDayNight() == 0);
    	TethysGame::SetDaylightMoves(-1);
    	GameMap::SetInitialLightLevel(-62);
    	TethysGame::SetTornado(71,35,26,37,3,5);
    	CreateTimeTrigger( 1, 1, 300, "Meteor" ); 
    	...
        SCRIPT_API void Function();
    {
        TethysGame::SetMeteor(40,40,5);
    }
    	
    
    	Trigger population = CreateResourceTrigger(1, 1, resColonists, 400, 0, cmpGreaterEqual, "NoResponseToTrigger");
    
    CreateVictoryCondition(1, 0, population, "Have 400 Colonists.");
    
    
    	return 1; // return 1 if OK; 0 on failure
    }
    
    
    
    void AIProc() 
    {
    	
    	
    	
    }
    
    void __cdecl GetSaveRegions(struct BufferDesc &bufDesc)
    {
    	bufDesc.bufferStart = 0;	// Pointer to a buffer that needs to be saved
    	bufDesc.length = 0;			// sizeof(buffer)
    }
    
    int StatusProc()
    {
    	
    	return 0; // must return 0
    }
    
    
    SCRIPT_API void NoResponseToTrigger()
    {
    	
    }
    
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds