Posts: 282
Threads: 48
Joined: Feb 2011
Reputation:
0
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
Posts: 1,770
Threads: 55
Joined: Aug 2019
Reputation:
24
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.
Posts: 282
Threads: 48
Joined: Feb 2011
Reputation:
0
having problems with imports again
please download the project
<!-- m --><a class="postlink" href="http://www.4shared.com/zip/sBALDAkZ/wars.html">http://www.4shared.com/zip/sBALDAkZ/wars.html</a><!-- m -->
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
Posts: 1,770
Threads: 55
Joined: Aug 2019
Reputation:
24
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:
Posts: 282
Threads: 48
Joined: Feb 2011
Reputation:
0
oh yeh it works now thanks!