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 / Varible passing in functions<DBC>

Author
Message
Vernon
20
Years of Service
User Offline
Joined: 26th May 2004
Location: Fresno, CA
Posted: 13th Jun 2004 10:35
I swear, just when I think I have this language figured out...

I must be missing something obvious here. I'm bassicly trying to load charcter information files. The varibles from the loader would not pass trough to the main .Dba files. After some work, I was able to determine that the error comes from how the varibles are passing. They are simply leaving the function as null values.a

I have included a simpler form of the code, as you can see, varibles work inside the function but not outside it, Is there something I am doing wrong?
Soy Cocktail
20
Years of Service
User Offline
Joined: 23rd Dec 2003
Location:
Posted: 13th Jun 2004 13:32
in dbpro you can declare the variables to be global and be used for all functions and outside of functions for dbc you need to make them variable arrays using the dim command

example
dbpro
global var#=1.0

Ddbc
dim var#(1)
var#(1)=1.0
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 13th Jun 2004 15:00
One further thing - Values are passed into functions by value (ie they are copied), so although you can change the contents of the variables inside the function, the changes are 'lost' when you return from that function.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk
jasuk70
21
Years of Service
User Offline
Joined: 3rd Dec 2002
Location: Hemel Hempstead
Posted: 14th Jun 2004 14:46
Here is an example of how I load and save character data. I've cut and pasted this from my code and it needs more code to actually do anything but it may help you.



Jas

----
"What is this talk of 'release'? Klingons do not'release' software. It escapes leaving a bloody trail of developers and quality assurance people in its wake!"

Login to post a reply

Server time is: 2024-09-22 13:23:28
Your offset time is: 2024-09-22 13:23:28