Project

General

Profile

Bug #330

shared and global do not seem to work for Arrays

Added by Tobias Franke about 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
Start date:
04/05/2020
Due date:
% Done:

0%

Estimated time:
Affected version:

Description

I Have a simple Example, where i want to declare an Array to draw Clouds with a Procedure:

// Setup the Clouds
dim dCloudX(3)
dim dCloudY(3)
dim dCloudSpeed(3)

dCloudX(0) = 900
dCloudY(0) = 150
dCloudSpeed(0) = 3

[....]

// Draw the Clouds
DRAWCLOUD[0]
DRAWCLOUD[1]
DRAWCLOUD[2]

[...]

procedure DRAWCLOUD[iCloud]
shared dCloudX
shared dCloudY
shared dCloudSpeed
shared iScrollSpeed
shared dwidth

if dCloudX(iCloud) > -500
    dCloudX(iCloud) = dCloudX(iCloud) - ((iScrollSpeed / dCloudSpeed(iCloud))
else
    dCloudX(iCloud) = dwidth
end if

bob 40+iCloud, dCloudX(iCloud), dCloudY(iCloud), 40+iCloud

end proc

When i Call the DrawClouds Procedure and i try to access the Arrays with "Shared" i get the Compiler Message "Non Dimensionned array" every time i access dCloudX, dCloudY and dCloudSpeed.

I Also tried to declare the Arrays as "global" but i get the same error Message

#1

Updated by David Baldwin about 4 years ago

Hi Tobias, when you share arrays (or make them global), they need to be written like this -> dCloudX(), dCloudY() etc.

#2

Updated by Tobias Franke about 4 years ago

  • Status changed from New to Closed

Ok, thanks. Sorry, My Fault...

Also available in: Atom PDF