×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Problems with common share arrays, spries?

Problems with common share arrays, spries?

Problems with common share arrays, spries?

(OP)
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.

RE: Problems with common share arrays, spries?

you mean when you load one of rellib's subs?  well, did you include it?  

RE: Problems with common share arrays, spries?

(OP)
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.

RE: Problems with common share arrays, spries?

(OP)
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.

RE: Problems with common share arrays, spries?

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

http://cubee.topcities.com

RE: Problems with common share arrays, spries?

However... $Dynamic MIGHT override this rule...

so I'm not sure... but it is worth a try...

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

http://cubee.topcities.com

RE: Problems with common share arrays, spries?

(OP)
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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close