|
V2k Info
This list is a combination of the VCC FAQ's list of undocumented functions and my own sifting through V2K's readme file. If anyone knows of another source for documentation on new V2K functions and system variables, please tell me. See the V2K readme for other changes.
Note that the documentation for some (mostly graphics functions) is incomplete because I don't have much of a graphics background, and haven't had a chance to experiment with them. If anyone knows what they do or uses for them, please E-Mail me at nolip@istar.ca.
int FileSize(string filename)
This function returns the size of the file specified in bytes. This can be used to stop reading from a file before you reach the end.
int asc(string chr
This function returns the ASCII code of the first character in the string.
void FlatPoly(int x1,y1, x2,y2, x3,y3, color);
This command is supposed to draw a solid triangle filled with the color of your choice. It has serious bugs however and I actually had to write a replacement in VC. You can find that in my 'speech' script if you look hard enough.
void TMapPoly(int x1,y1, x2,y2, x3,y3, tx1,ty1, tx2,ty2, tx3,ty3, tw,th, image);
This function takes an image and splits it into two triangular images (along a diagonal line I assume) which are then drawn using the coordinates you specify. I haven't really used this, more information would be appreciated.
void CallEvent(int event)
You can use this function to cause an event in the current map's VC to be executed. Control returns to the point after the call when the event completes.
int NumForScript(Function)
This interesting function lets you save the address of a function to an integer variable. This is necessary for the next function. Don't include parentheses or quotes, and remember that you can't pass any arguments to it.
void CallScript(int script)
You can pass the result of a NumForScript call to this function to execute the function. You can't pass any arguments, and I don't believe there is any return value either.
void RotScale(int x, y, width, height, angle, scale, image)
This is a very useful function. It allows you to display an image at a given position, rotation and scale. As far as I can tell, the coordinates represent where you want the center of the image to be drawn, relative to the screen. For example, you would use ScreenX/2, ScreenY/2 to have the image displayed at approximately the center of the screen.
void TMapLine(int x, int y, int row, int layer)
This renders a single row of pixels for the display and you would call it screeny times at different locations to do whatever kind of effect you wanted. You should be able use it to make wave-like effects, etc., but when I tested it I got nothing but page-faults.
void ChangeChr(int index, string chr)
This function can change the CHR file displayed by entity 'index'. If that's not useful.. then.. what do I know. (NOTE: Found only in V2.5!)
void QuickRead(string fname, string s, int linenum)
This function opens the file 'fname' and returns line 'linenum' of it to the (global?) string 's'. As you are passing the filename as a parameter, you don't need to open and close the file yourself.
void CheckCorrupt(void)
This function checks for corruption in V2's allocated memory. When you would want to call this, I'm not sure.
numents (system variable)
According to the 2.5 readme file, this returns the number of entities on the map.
mask_color (read-only)
Returns the masking value for the current bit depth (if someone could explain this to me, that would be useful!)
[editor's note] V2K uses color RGB(255,0,255) for transparent areas. It returns this.
void ChangeAll(int source, int width, int length, int source_color, int dest_color)
This system function takes the source image (with width and length specified) and changes all colors that match source_color into dest_color. Handy for on-the-fly image manipulation!
void Mask(int source, int mask, int width, int length, int dest);
Performs a "simple AND mask" on the given image data, outputting to destination image data. Since I don't know much graphics stuff, it would be useful if someone else could provide more detail on this, such as exactly what an AND mask is, what the mask argument is, and why this would be handy.
entity.visible (system variable)
This controls whether or not a given entity is visible. Entities are specified as if it were an array (entity.visible[1] would refer to entity #1). 1 means the entity is visible, 0 means it isn't. Very useful!
entity.on (system variable)
Essentially the same as entity.visible, but more so. If this is set to zero for an entity, then as far as the engine is concerned, that entity no longer exists.
int GetR(int packed);
int GetG(int packed);
int GetB(int packed);
These are used to get the Red, Green, and Blue components of a color produced with RGB() that has been assigned to a variable
Ex:
int blue = RGB(5, 5, 155);
GetR(blue) // == 5
GetG(blue) // == 5
GetB(blue) // == 155
int RGB(int R, int G, int B);
This is used to get color values with the given RGB components in 16 or 15 bit color modes. Simply pass RGB(whatver, yatta, yatta) where you would have previously passed a color index.
entity.isob
Controls whether or not a given entity is an obstruction or not.
entity.canob
Controls whether or not a given entity can be affected by obstructions.
(Change to starting: Verge no longer starts on a map, and instead starts with the AutoExec function in system.vc)
(As a side-note, for anyone who's reading this who likes object-oriented programming, you can use NumForScript and CallScript in conjunction with arrays to simulate a class with member functions. Should do until someone gets around to trying to write Verge++ ;)
(As another side-note, to use the maped that comes with V2K, type dos4gw maped.exe. This requires you to have a copy of dos4gw and maped in the current directory.)
|