Are TypeDefs possible?
Displaying 1-7 of 7 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
ChaliShank

I seem to remember there being no classes or user-defined structures in verge. This is a bit of a problem. I see two alternatives.

1) I can somehow finagle my way into getting some sort of pseudo-structure running (or maybe add some code within my system.vc verge that can do it)

2) Write a function that can extract information like a class.

Or, maybe I'm wrong and there IS structure declaration. In any case, perhaps some of you could share with me what you would do in this situation. (I want a class for player characters that contains their statistics, equipment and so on.)

Arigatoo gozaimasu.
_______________________________________________________

And now we know for whom the bell tolls. The one, the only, the originator, Ishmael Twist.



Posted on 2002-02-13 10:38:55

TheGerf

There's no structures, unless you go find an obscure version of Vcc; not sure whitch one though.
If you're a real loser, like me, -_-, you'd just declare lots of arrays. And pretend to be able to organize them...



TheGerf, not just any gerf.

Posted on 2002-02-13 15:49:41

Tricron3

Lets give an example here.

for example say the weapon a character has
can be represented by a number between 0 and 255 (8 bits or 1 byte)
and then another for armour.
another for boots, ring etc
then stats are between 255 (of which we will say their are 4 of those)
so 8 1 byte variables.
8 bytes!
heres how you do it
int somefunction()
{
...
int main_hero=malloc(8)
byte[main_hero+0]=1; // Sword
byte[main_hero+1]=29; // shield
byte[main_hero+2]=45; // Boots of dirt
byte[main_hero+3]=0; // No Ring
byte[main_hero+4]=25; // Strength 25
byte[main_hero+5]=20; // Defence 20
byte[main_hero+6]=10; // Magic 10
byte[main_hero+7]=1; // Charisma 1
...
}

Now you can just pass main_hero to functions that
need to work on his parameters.

You could probably pretty this up with some functions that read and write statistics. And use some #defines to make it even cooler
byte[main_hero+4]=25; // Strength 25
could be
#define str 4
byte[main_hero+str]=25; // Strength 25



Posted on 2002-02-13 17:32:19

rpgking

Parallel arrays really aren't bad if you've got a bunch of helper functions to easily take the data from them.



Out of clutter, find simplicity. -Einstein

Posted on 2002-02-13 21:54:28

Omni

of normal arrays anyway. But for some reason we still want them. Hmm...



Posted on 2002-02-14 06:03:49

TheGerf

parallel arrays are like this:
int id[50];
int effect[50];
int whatever[50];

That have their cell numbers all corrospond to the same thing, and can be used at the same time. Hardly an illusion, unless you mean multi-dimension arrarys:
int whatever[7][50];
which I can see as an illusion of normal arrays, which functionally it is. The only advantage is they're much easier to organize.



TheGerf, not just any gerf.

Posted on 2002-02-14 13:45:06

Omni

Sorry, yeah, I mean dimensional arrays. I myself will use parallel arrays. Fun.



Posted on 2002-02-14 15:34:42


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