User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Pascal and Delphi section within the Software Development category of DaniWeb, a massive community of 361,556 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,007 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Pascal and Delphi advertiser:
Views: 331 | Replies: 2 | Solved
Reply
Join Date: May 2008
Posts: 2
Reputation: jamesbond110 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
jamesbond110 jamesbond110 is offline Offline
Newbie Poster

Simple problem...

  #1  
May 8th, 2008
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!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2006
Location: Blumenau, Brazil
Posts: 67
Reputation: Micheus is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 4
Micheus's Avatar
Micheus Micheus is offline Offline
Junior Poster in Training

Re: Simple problem...

  #2  
May 8th, 2008
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
"It always has, at least, two ways to make one same thing. Exactly that they are certain and wrong"(Micheus)

Brazil - Blumenau
Reply With Quote  
Join Date: May 2008
Posts: 2
Reputation: jamesbond110 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
jamesbond110 jamesbond110 is offline Offline
Newbie Poster

Re: Simple problem...

  #3  
May 8th, 2008
Thank you Micheus!

Here's what I changed:

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

I added to your rep
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Pascal and Delphi Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Pascal and Delphi Forum

All times are GMT -4. The time now is 2:23 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC