bleh.... annoying problem with errors.
Displaying 1-4 of 4 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
Rusky

system.vc:


#define MENUNUM 5
#define MENUBACKCOLOR RGB(0, 0, 140)
#define MENUSELECTORCOLOR RGB(255, 255, 255)

//menu
int font;
string menuitems[MENUNUM];
string title;
int itemselected = 0;

//sounds
int click;
int beep;

//player
int player;
int playergravity = 0.5;
int playervspeed = 0;

void autoexec()
{
InitMenu();
}

void InitMenu()
{
//setup menu
font = LoadFont("files\font.pcx");
EnableVariableWidth(font);
title = "Platformer";
menuitems[0] = "New";
menuitems[1] = "Load";
menuitems[2] = "Options";
menuitems[3] = "Help";
menuitems[4] = "Exit";

//setup sounds
click = LoadSound("files\click.wav");
beep = LoadSound("files\beep.wav");

//setup buttons
SetButtonKey(1, SCAN_F);
SetButtonKey(2, SCAN_D);

HookKey(SCAN_UP, "DecrementSelector");
HookKey(SCAN_DOWN, "IncrementSelector");
HookKey(SCAN_ESC, "ExitGame");

HookButton(1, "SelectMenuItem");

//setup screen
SetAppName(title);

//setup main loop
HookTimer("DrawMenu");
while(1)
{
UpdateControls();
ShowPage();
}
}

void DrawMenu()
{
int titlex = ImageWidth(screen) / 2;
int titley = ImageHeight(screen)/8;
int menuy = ImageHeight(screen) / 3;

int rectleft;
int rectright;
int recttop;
int rectbottom;

RectFill(0, 0, ImageWidth(screen) - 1, ImageHeight(screen) - 1, MENUBACKCOLOR, screen);

PrintCenter(titlex, titley, screen, font, title);

int i;
for(i = 0; i < MENUNUM; i++)
{
PrintCenter(titlex, menuy + (i * FontHeight(font) * 2), screen, font, menuitems[i]);
if (itemselected == i)
{
rectleft = titlex - (TextWidth(font, menuitems[i]) / 2);
rectbottom = menuy + (i * FontHeight(font) * 2) + (FontHeight(font) / 2);
rectright = titlex + (TextWidth(font, menuitems[i]) / 2);
recttop = menuy + (i * FontHeight(font) * 2) + (FontHeight(font) / 2);

Rect(rectleft - 2, recttop - 8, rectright + 0, rectbottom + 5, MENUSELECTORCOLOR, screen);
}
}
}

void IncrementSelector()
{
Unpress(6);
itemselected += 1;
if (itemselected >= MENUNUM)
{
itemselected = 0;
}
PlaySound(click, 100);
}

void DecrementSelector()
{
Unpress(5);
itemselected -= 1;
if (itemselected <= -1)
{
itemselected = MENUNUM - 1;
}
PlaySound(click, 100);
}

void SelectMenuItem()
{

Unpress(1);
PlaySound(beep, 100);
switch (itemselected)
{
case 0:
StartGame();

case 1:
MessageBox("Load Game");

case 2:
MessageBox("Options");

case 3:
MessageBox("Help");

case 4:
ExitGame();
}
}

void StartGame()
{
//clear menu stuff
HookTimer("");
HookKey(SCAN_UP, "");
HookKey(SCAN_DOWN, "");

//actually start the game
Map("start.map");
}

void ExitGame()
{
Exit("");
}


start.vc:


void Start()
{
player = EntitySpawn(curmap.startx, curmap.starty, "darin.chr");
SetPlayer(player);
entity.obstruct[player] = 1;
}


The character is fine, the map is set up correctly, but all of a sudden I get an error on the last line of system.vc it says "expected ";" but got "." when it's just a "}"

So that means there's a problem somewhere else... I just don't see it. Help please?

Posted on 2006-10-25 22:14:50

mcgrue

Didn't the error give you a line number to look at for the error?

Posted on 2006-10-26 00:17:10

ustor

Ctrl+F reveals that:
int playergravity = 0.5;

might be responsible.

Posted on 2006-10-26 00:52:28

Rusky

the line number was on the last line. with a "}"

thanks for the 0.5 thing.

Posted on 2006-10-26 16:50:42


Displaying 1-4 of 4 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.