@sgmedia2, Putting the array index into an array field really doesn't get you anything unless the value will be changing later.
It might suit you better to let the system generate the sprite ID's and then you simply store them in the array.
The way I do it ( adapted to your code), would be;
// Set up code
dim myvariable [30] as mytype
for x = 1 to 30
myvariable[x].ID = 0
next x
// Within Loop Code
if getpointerpressed () = 1
myvariable[x].ID = createsprite( loadimage("image.png) )
set physics and stuff
endif
The initial loop simply sets the initial value of each ID to zero - always good practice to initialise fields of a user defined type before use.
The sprite is created with the other format of the command - where the system gives you the sprite ID - the resulting value is stored in the array at position x in the ID field.
Later when you come to use it, you can check if it is zero for safety and then use the commands directly on the array element, with something like;
setSpritePosition( myvariable[x].ID , myX , myY )
I am presuming here that x will represent a reference to an object of some kind, and myvariable[x].ID will hold the ID of the sprites for the objects in the array.