Omni
|
vc files are Verge Code. Basically the modules that contain universal stuff, like battle system code, setup code, statistic code, and menu code (referred to as System VC files), and event code, telling people what to do on maps (MAP VC.) Map VC files must have the same name as the MAP file you make them for.
User.cfg contains setup parameters for Verge. Assuming you're using Winv2, you can use parameters such as
xres --x resolution, try 320.
yres --y resolution, try 200 or 240.
nosound --if this is 0 ("nosound 0"), sound is off.
eagle --if set to 1 ("eagle 1"), 2xSAI is turned on.
appname --sets the titlebar name for your game.
windowmode --if 1, game is in window. 0, fullscreen.
arraycheck --checks for ? array memory problems?
paranoid --better error reporting, I think.
end --put this at the bottom, ends the file.
You can create it in notepad, then rename it from a txt file, to "user.cfg." Notepad is fine, but Textpad (www.textpad.com) really helps, especially if you use the syntax file from www.vergesource.com.
a typical user.cfg:
---
appname Forgotten Realm Alatia
windowmode 0
eagle 1
xres 320
yres 240
nosound 0
end
----
VC is more complicated. I explained earlier, there are two types: System and MAP. Map is in the format,
event {
//code here
}
basically, you just repeat that throughout the file. There can be no numbers, except for comments,
like // comment,
so you need to remember how you number your events. The first event you create is always executed when that map is loaded. Alright, moving on, a few basic syntax rules.
A function in C or VC refers to code that does a certain thing. You can create event functions, like above, in your MAP VC, or you can create System.vc functions, which do a certain thing, like fade the screen out. A function is always encased in brackets, like
event
{
}
or, with a system.vc function
void myfunction()
{
}
the void means I am creating a function. myfunction is the name of the function. () contains parameters I would pass to it at runtime. For example, I could make a textbox function, like
void mytextbox(string text)
{
}
where "string text" denotes that I must include a parameter that is a string, or a bunch of alphanumerical symbols.
Strings contain Alphanumeric symbols, words, numbers, etc,
while Integers contain numbers only.
So, if I wanted to call my textbox, (you call a function in code, to execute it), I would type
myfunction("What are you up to?");
you can do two things in C or VC, as far as I know.
1. Declare something (ie, create a function or string or int)
2. Use it.
To declare a string, type
string [name of string],
like
string charactername;
at the end of all VC or C code, must be an ";". however, you do not put an ";" after a function declaration.
void myfunction() ---no semicolon.
an INT, or integer, holds a number in memory, and can be called like
int charHP;
or just
int [integername];
You can also declare arrays. Arrays are basically bunches of variables, whether integers or strings, contained in one name.
Integer array:
int everyonesHP[20];
this gives me 20 variables to store an integer, HP, with.
int [arrayname][number of slots];
you can do the same thing with strings.
string names[10];
you can change an array or variable by referencing it, like
names[0]="Judah"
above, I declared an array of 10 spaces. I got just that. But computers think of an array address in terms of relative distance in memory from the first part of the array, 0. So,
names[0]
would be the first part in that array. Also, whenever you make a string, its contents must be in quotes.
string myname;
myname="Whatever my name is.";
int myage;
myage=20; //not really.
got it?
you can declare variables (that is, integers and strings), outside a function, as general variables that can be used anywhere, and inside a function, to be used only by that functon.
string name;
void changename(string entername)
{
name=entername;
}
changename("Michael");
would then change the "name" string to have the value of "Michael."
but, if I type
string name;
void changename(string entername)
{
string myrealname;
myrealname=entername;
printstring(0, myrealname);
}
see that? I didn't use the "name" string, I declared another one INSIDE THE FUNCTION to do basically the same thing. The printstring command, by the way, is useful.
Printstring(0, "What did I do?");
where 0 is the font index (or system.fnt file, first subset), and "What did I do?" is the string I want it to print.
the only problem is, what if you declare a variable outside a function, and declare one inside a function? As far as I know, the one outside the variable (called a global variable) takes precedence over the one inside (called local variable.)
Local variables may only be used in their functions. They are private for those only, and cannot be used for other functions. By the way, did you notice
name="Judah";
the value on the right is assigned to the left. This is called an assignment statement. If I created an variable
int myage;
and I grew up 20 years, I would type
myage=myage+20;
to increase it by twenty years.
Um, let's see....oh yeah. The functions in the vergec.txt file can be used in your own functions and event codes. They perform useful functions such as displaying text, drawing graphics, and manipulating the screen, entities, and maps. They do the hard stuff so you don't have to write your own code to do it. Printstring is part of the VergeC library. By the way,
you can split System.vc into multiple files, for example,
battlesystem.vc
items.vc
statsystem.vc
magic.vc
system.vc
You always need a system.vc, but you can use others. To link them to system.vc, at the top of the system.vc file, type
#include "statsystem.vc"
and so on. When you type DEFINE, you are declaring, in effect, a variable that cannot be changed. For example,
#DEFINE version=2
at the end of DEFINE and INCLUDE, you do not need parentheses.
variables must be declared at the top of the vc files. in order, a system.vc file would be in the order of
----
[defines and includes]
[variable declarations, string and integer]
[functions]
----
variable declarations come before functions, as far as I know. DEFINES and INCLUDES, called preprocessor directives, must come before anything else. You cannot declare variables or directives in event, or MAP, VC.
Try reading the Verge-faq at Vergesource.com. That will come in handy, as it shows better code tutorials than I can talk about here.
Hope this helped. Read Aen's tutorials at the Vergesource articles sections too. Verge-rpg.com has only 3, vergesource has 7. Very nice, if a bit old. They demonstrate simple functions, textboxes, screen fading, and include small demos and stuff, last I checked.
It is not wrong to not understand, for we are all ignorant, but neither is understanding pointless.
Posted on 2002-03-05 19:17:01
|