Mail Archives: djgpp/1998/02/01/03:49:29
Hello Matt,
Matt Riker <SPAMGUARDriker AT pipcom DOT com> schreef in artikel
<MPG DOT f3a8f8ba7e93c3a9896be AT news>...
> In article <C125659B DOT 002E50AC DOT 00 AT vega DOT ads DOT it>, G DOT DegliEsposti AT ads DOT it
> says:
>
> > >Error: array subscript is not an integer
Well, this says it all, doesn't it?
[ a lot snipped ]
> Where 'spritename' is a constantly changing variable. In the middle of
> my program, I want 'spritename' to be anything, depending on what sprite
> the user chooses.
>
> > the 'spritename' must be an int containing BLANK. If you need to use
> > different
Wrong, spritename must be an int containing a value BLANK represents...
> > values assign different ints to spritename.
>
> I could be just dumb :), but how can you but a string of letters into an
> int?
Hmm, I think you've got somethings mixed up. The names you use to refer to
the several parts of a datafile structure are in fact #defines and
represent an unique number for every entry in that datafile. (look at the
datafile header you use to see what I mean). Thus making an array of
strings containing those names is not going to work since every name in the
data header file is no string, it just represents a number, in fact they
all are array indexes<g>.
Depending on how your program is build, you could either use an int
variable to get the right entry from the datafile, or you could, based on
your spritename array build a function that uses the array index to return
an int value to use in getting the right entry from the datafile.
Hope this helped somewhat.. ;-))
____________________________
> Matt Riker
--
Greetings from frosty Amsterdam,
Jan Bijsterbosch
email: bijster AT worldonline DOT nl
http://home.worldonline.nl/~bijster
- Raw text -