Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with common share arrays, spries?

Status
Not open for further replies.

Species2002

Programmer
Jan 12, 2003
4
CA
hello. I am making a prog with modules. I am using a library to make this prog.(Rellib) anyways i am having problems common sharing arrays, and sprites and stuff. My pc always restarts when i load a sub that is not in the main module. does anyone know how to remedy this problem.
 
you mean when you load one of rellib's subs? well, did you include it?
 
Yes I did include Rellib in all the modules when let me give ya a vage example.

----start here------
declare Sub Sub1 ()
declare Sub Sub2 ()
MainModule
DEFINT A-Z
'$STATIC
'$DYNAMIC
'$INCLUDE: 'RelLib.Bi'

common shared BUFFER(31999) AS INTEGER, layer AS INTEGER
layer = VARSEG(BUFFER(0))
common shared sprite(202)
screen 13
RelinitVGA13

(lets say i got my 20x20 sprites)
Relget layer,x1,x2,y1,y2,varseg(sprite(i*202)),varptr(sprite(i*202))

(my code and subs)
bleh
call Sub1
bleh
bleh
call Sub2

sub sub1 ()
some code
end sub

Module2
Sub2

SubModule1
Declare sub sub2
DEFINT A-Z
'$STATIC
'$DYNAMIC
'$INCLUDE: 'RelLib.Bi'

common shared BUFFER(31999) AS INTEGER, layer AS INTEGER
layer = VARSEG(BUFFER(0))
common shared sprite(202)
screen 13
RelinitVGA13

sub sub2()
more code
end sub


The common shared parts would give me a common shared error and sometimes the array, or when it does compile and work the pc restarts when i hit the sub2 bit of the prog.
 
I forgot to mention that in the Sub 2 is
RelSprite layer, 0,0,varseg(sprite(0)),varptr(sprite(0))
relpcopy video, layer 'shows the stuff.
 
Is this legal...?
common shared BUFFER(31999) AS INTEGER, layer AS INTEGER
layer = VARSEG(BUFFER(0))
common shared sprite(202)


I think it should be...
common shared BUFFER(31999) AS INTEGER, layer AS INTEGER
common shared sprite(202)
layer = VARSEG(BUFFER(0))


As far as I remember... All definitions with the exception of REDIM should apear before any commands are executed...

Good Luck...

Have Fun, Be Young... Code BASIC
-Josh
cubee101.gif

 
ya u r right. I just wrote a quick example to show ya what my problem was. I do know the order for common shared and stuff. Sorry about the wrong order of code.

Ill try some suggestions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top