Random VC error -- help, please!!
Displaying 1-10 of 10 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
Wyrdwad

Hey. I'm using the newest official release of VCC 2 (the one that came with WinMapEd), but for some reason, the following function isn't compiling properly:

void AreaPrint (string datext, int x, int y, int xlen)
{
GotoXY ((x+(xlen/2))-((len(datext)*7)/2), y);
PrintString (gamefont, datext);
}

It's giving me an "Unknown token " error on the GotoXY line, even though x is VERY clearly defined in the function declaration.

Anybody wanna let me know what's going on here??

Thanks!!

-Tom

P.S. For those who are wondering, this is a function which is supposed to print a line of text, centered, in a user-defined window whose top-left corner is at x, y and which is xlen pixels in width.




http://forgottenkings.tripod.com/ http://wyrdwad.diaryland.com/

Posted on 2002-03-07 23:40:51

Wyrdwad

It's an "unknown token (x)" error. Apparently, this webboard doesn't like the less-than and greater-than signs. (:

-Tom




http://forgottenkings.tripod.com/ http://wyrdwad.diaryland.com/

Posted on 2002-03-07 23:42:23

Wyrdwad

Sorry, last one. (: My function uses "len()", which doesn't exist... that should be "strlen()". I realized this and changed it, but the function still won't compile, so that was NOT it.

-Tom




http://forgottenkings.tripod.com/ http://wyrdwad.diaryland.com/

Posted on 2002-03-07 23:58:06

Omni

I'm trying to look at it, but I'm not sure what you'd want to do with it.



It is not wrong to not understand, for we are all ignorant, but neither is understanding pointless.

Posted on 2002-03-08 06:33:07

Wyrdwad

Er, I tried to explain that in my P.S., but OK, I'll go into a little more detail here...

In my battle system, I have multiple little windows at the bottom of the screen for each of the characters in your party. If I want to center a line of text in one of these windows -- say, a character's name -- my function will let me do that. I simply specify the top-left x coordinate of the window, the width of the window, and the y coordinate you want the dialogue printed on, and it'll print the dialogue in the exact center of the window at that y coordinate.

I dunno if I can explain it any better...

But really, WHAT the function does isn't the issue here. I'm concerned as to WHY VCC isn't recognizing x when I use it in my GotoXY line!! There's really NO REASON why this should be the case, and I'm hoping it's some little documented bug that someone can explain to me.

-Tom




http://forgottenkings.tripod.com/ http://wyrdwad.diaryland.com/

Posted on 2002-03-08 08:09:10

Wyrdwad

...that the font I'm using is 7 pixels wide, thus that extraneous 7 in my function. (:

-Tom




http://forgottenkings.tripod.com/ http://wyrdwad.diaryland.com/

Posted on 2002-03-08 08:11:02

Omni

I'll try looking at it again. While I was in school I tried coding a different implementation, but it didn't compile, either...

all those darn parentheses are confusing, man.



It is not wrong to not understand, for we are all ignorant, but neither is understanding pointless.

Posted on 2002-03-08 14:55:46

Mythril

I copied your code, and removed the gamefont part, and it compiled just fine. Maybe the error is somewhere else. Try commenting out large parts of code and see what works.



Spoon.

Posted on 2002-03-08 15:27:03

Wyrdwad

Oddly enough, the mammoth function I had before it in system.vc had one too many {'s and one too few }'s. What I find odd, though, is that my system.vc both compiled and worked perfectly BEFORE I added that new function... and even when I did add the new function, the compiler chose to yell at me for using an undefined variable x rather than for placing a function declaration inside of another function. (: Not a particularly helpful compiler error.

But yeah, thanks for testing the code. Dunno how I coulda missed that -- and dunno how the compiler coulda missed that, either!!

-Tom




http://forgottenkings.tripod.com/ http://wyrdwad.diaryland.com/

Posted on 2002-03-09 03:20:31

Omni

the compiler really screws up error reporting when you forget semicolons and braces. Sometimes it reports errors in VC files separate from the one with the error in it, even.



It is not wrong to not understand, for we are all ignorant, but neither is understanding pointless.

Posted on 2002-03-09 16:09:40


Displaying 1-10 of 10 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.