Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Variable not being used properly

Author
Message
lucifer 1101
15
Years of Service
User Offline
Joined: 26th Jan 2009
Location: Melbourne, Australia
Posted: 1st Feb 2009 09:32
A variable i am using wont work if i try to use it in an include file..

i=1

in the main file, and then i just print that variable in the include file but it wont work, i also tried putting the global function infront of it, but that didnt work either...
lucifer 1101
15
Years of Service
User Offline
Joined: 26th Jan 2009
Location: Melbourne, Australia
Posted: 1st Feb 2009 11:32
ok lets revamp this a bit

my problem i will show with the actual code i am using so that i can get some help

this is a bit from my main file



please note that there is many more lines than that but i dont want to post it all, now onto the second file



please note i have left out heaps of the code and if you need anything else just say so.

I dont know whats wrong but whenever i try to do anything in the subs in the include file it wont do anything. I think it might have something to do with the amount of gosubs there are (i hope its not).

Any help is appreciated...
ShaunRW
DBPro Developer
16
Years of Service
User Offline
Joined: 7th Jan 2008
Location: Brisbane, Australia
Posted: 1st Feb 2009 12:21
sorry but i don't see where you're using "i" variable


lucifer 1101
15
Years of Service
User Offline
Joined: 26th Jan 2009
Location: Melbourne, Australia
Posted: 1st Feb 2009 13:17
well i tred getting rid of the if i=1 then doing something and just making a cube and positioning it in front of the computer, but that wouldnt work either...
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 1st Feb 2009 13:17
When you include another file, that file gets added to the end of your source code and does not get inserted at the #include statement.

For example, main.dba:


Other.dba:


this will become:


As you can see, the 'i = 5' bit of the code never gets executed.

lucifer 1101
15
Years of Service
User Offline
Joined: 26th Jan 2009
Location: Melbourne, Australia
Posted: 1st Feb 2009 13:30
ok thanks i think i have worked out the problen now

Login to post a reply

Server time is: 2024-11-24 14:30:40
Your offset time is: 2024-11-24 14:30:40