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 / variables in a function

Author
Message
madbilly
21
Years of Service
User Offline
Joined: 20th Mar 2003
Location: United Kingdom
Posted: 30th Mar 2003 18:20
Hi all,

Ive written a function in DBPro that uses both local variables, the function parameters, and some global variables. The problem I have is that some of the global variables are not being recognised whereas some of them are.



Basically I've got command to create a memblock, and the variables planet and PlanetSize only work if I substitute in constant numbers for the variables, otherwise I get errors 5101 (memblock number illegal) and 5107 (memblock size illegal). In another part of the same function I am using other global variables which contain the offset location for various sections within this memblock. I do not get errors for these, although my function does not appear to work at all anyway - do these still cause a problem and are just not being reported?

In case you're wondering, the reason I'm doing this is to get around not being able to pass user-defined types as function parameters so I'm passing a memory location instead.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 30th Mar 2003 20:09
Use 'global nextmemblockpointer' at the top of your code.

All variables in functions are local unless you have specified otherwise.

Login to post a reply

Server time is: 2024-09-20 03:51:17
Your offset time is: 2024-09-20 03:51:17