DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   Pascal and Delphi (http://www.daniweb.com/forums/forum124.html)
-   -   Simple problem... (http://www.daniweb.com/forums/thread123121.html)

jamesbond110 May 8th, 2008 2:07 am
Simple problem...
 
Man, I'm so new. I'm trying to script something for a game. so here's what I got:

program twars;

const
  Color = $FFFFFFFF;

  FISTS  =  0;
  DEAGLES =  1;
  MP5    =  2;
  AK74    =  3;
  STEYR  =  4;
  SPAS    =  5;
  RUGER  =  6;
  M79    =  7;
  BARRETT =  8;
  MINIMI  =  9;
  MINIGUN = 10;
  SOCOM  = 11;
  KNIFE  = 12;
  SAW    = 13;
  LAW    = 14;
  FLAME  = 15;
  ARROW  = 16;

 


type

      tClasses = record
                name,info,tip: string;
                weap: array[0..16] of boolean;
              end;

var
          c: tClasses;


procedure placekeeper;
begin
end;

begin
c[1].name  := 'Pyro';
c[1].info  := 'Flame';
c[1].tip    := 'burn';
c[1].weap  := [false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false];
end;

This doesn't work apparently. =\
thanks for reading!

Micheus May 8th, 2008 5:39 pm
Re: Simple problem...
 
jamesbond110, see this points:
- that "end" in the program main block must be ended with point (.), not a semicolon (;)
- your "c" variable is defined like a tClasses (a record type), so You can't index them like it was a array type.
- if You want store n tClasses records You must declare "c" as array[...] of tClasses, otherwise You must remove the indexer "[1]":
c[1].name => c.name

Bye

jamesbond110 May 8th, 2008 7:01 pm
Re: Simple problem...
 
Thank you Micheus!

Here's what I changed:

var
          c: array[1..2] of tClasses;

I added to your rep ;)


All times are GMT -4. The time now is 10:14 am.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC