Colin Hart,
If I understand you correctly, you need to pass a local variable's values to a function which lies within a seperate file. Almost, as to say, you need to pass the variable's values to a function which is held in a 'library' somewhere. If so, I have two code snippets below. The first is the
main file, or in other words, the
driver file, and the second is a function holding type library. Save them as two seperate .dba files, and make sure that the second snippet is saved under the name
functions.dba. Also, make sure that they are both saved in the same folder.
[1.]set display mode 800,600,32
sync on
sync rate 60
REM << this line allows you to use any function within the file named
#include "functions.dba"
REM << preset variable
a = 10
REM <<<<<<<<<<<<< main loop >>>>>>>>>>>>>>
repeat
REM << like any local function, simply call it and pass it a value
b = calc_new_number(a)
REM << print new value to screen
text 0,0,"new value = " + str$(b) + "(b)"
text 0,15,"old value = " + str$(a) + "(a)"
text 0,30,"calculation within included function was 10(a) * 100"
sync
cls
until mouseclick() = 2
[2.]REM << included files can only be used if they include functions
REM << include the file and then call the function by name, sending arguments to it as needed
function calc_new_number(a)
b = a * 10
endfunction b
Notice, the include file command within the first file. It is how you include
functions from other
.dba files.
+NanoBrain+