FAQ  •  Register  •  Login

import confusion

<<

slenkar

Posts: 282

Joined: Sun Feb 13, 2011 3:33 am

Location: Kentucky US, used to be Birmingham UK

Post Thu Jun 28, 2012 3:23 am

import confusion

I like having my pathfinding code in a seperate file,
BUT the pathfinding code has to use an array from main.bas

I get error message saying
identifier 'UnitExists' is a function, not a var

but really its an array


I could put Dim UnitExists in the pathfinding.bas file

but what if another included file needs to reference UnitExists?

UnitExists needs to be 'global' somehow
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Thu Jun 28, 2012 6:56 am

Re: import confusion

The problem there is that UnitExist must be declared (included) before it's referenced for the 1st time.
Try to put the include at the beginning, and tell me.
<<

slenkar

Posts: 282

Joined: Sun Feb 13, 2011 3:33 am

Location: Kentucky US, used to be Birmingham UK

Post Thu Apr 11, 2013 6:22 pm

Re: import confusion

having problems with imports again
please download the project
http://www.4shared.com/zip/sBALDAkZ/wars.html

and compile wars.bas

it says the function findpath is not found but its in pathfinding.bas

also it says the error is in wars.bas on line 23

but its really in movingfunctions.bas
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Sun Apr 14, 2013 12:53 am

Re: import confusion

Apparently the file pathfind.bas is entirely commented, because it starts with a block comment /' at the beginning.
I tried closing that block comming just before the FindPath funcion declaration and your program was correctly compiled :!:

Included are done by the preprocessor. So you can always try
zxbpp wars.bas and see the resulting souce file, as a first test to discard posible mistakes before going further.

Try removing /' in the pathfinding.bas file and tell me. :roll:
<<

slenkar

Posts: 282

Joined: Sun Feb 13, 2011 3:33 am

Location: Kentucky US, used to be Birmingham UK

Post Sun Apr 14, 2013 8:54 pm

Re: import confusion

oh yeh it works now thanks!

Return to Help & Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.

phpBB SEO