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.

Author
Message
Dr OcCuLt
21
Years of Service
User Offline
Joined: 27th Nov 2002
Location: a Dark Deep Dark pit, it dark in here
Posted: 12th Dec 2002 02:51
#constant is one of the most uesful command there is,so Why is it not in the reference manual or the on-line help ,are there more command that are`t in the manual.
ZomBfied
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location:
Posted: 12th Dec 2002 07:29
How do you use it?

Ratty Rat
21
Years of Service
User Offline
Joined: 24th Sep 2002
Location:
Posted: 12th Dec 2002 10:22
If you mean Constants, IE a named value, in VB it would be:-

Public Const cMyNumberOne = 1

Then whereever you put cMyNumberOne in the code it gets replaced with 1 when compiled. Its very useful, particularly when you have a number or string that may occasionally change during development but is used throughout a piece of code, it saves you having to search through all the code for every occurrence of it.

Anyway, DBPro does not have them as far as I have found, DarkEdit (for DB1) used to do them using a pre-compiler (and damn useful it was too), I don`t think thats made it into the new editor/compiler yet but I hope they do add it.
AsylumHunter
21
Years of Service
User Offline
Joined: 3rd Oct 2002
Location: United States
Posted: 12th Dec 2002 10:44
DBP uses the following:

#constant MyHeight 72
#constant MyAge 34
#constant MyWeight 210


N.B. Do not place any ='s after your #constant declerations or they will not compile. And also, place all of these constants at the start of your program.

Now whenever you say:

e.g. AV = (MyWeight * MyHeight) / MyAge

the compiler will automatically replace these with fixed values and not use up variable memory. Remember, these can only be used for values you don't expect to change as your program runs.

Oh!, BTW, I only found this out by accident since I too could not find any reference to this in online help or in the manual, but I knew they had to exist.

AsylumHunter

still falling out of my binary tree most evenings (hicup!)
Kangaroo2
21
Years of Service
User Offline
Joined: 26th Sep 2002
Location: United Kingdom
Posted: 12th Dec 2002 15:21
Cool! I may very well use that. Thanks guys

* If the apocalypse comes, email me *
Ratty Rat
21
Years of Service
User Offline
Joined: 24th Sep 2002
Location:
Posted: 12th Dec 2002 15:30
Thank you AsylumHunter, somehow I missed that, maybe if I`d read the manual!
ZomBfied
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location:
Posted: 12th Dec 2002 18:41
It's not in the manual is it? Global isn't either.
That's a cool comand. I'll totally use it.

Dr OcCuLt
21
Years of Service
User Offline
Joined: 27th Nov 2002
Location: a Dark Deep Dark pit, it dark in here
Posted: 13th Dec 2002 01:18
theres a Global i`v be slaveing away at GOSUB for all this time.can sum one post a list of all the comands not in the manual.there may will be a Class comand out there we do not no
ZomBfied
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location:
Posted: 13th Dec 2002 09:00
I just messed around and tried it. Lo and behold you can totally say
Global x as integer
and shazam! No more making frigging zero indexed arrays!

Ratty Rat
21
Years of Service
User Offline
Joined: 24th Sep 2002
Location:
Posted: 13th Dec 2002 13:39
I have not seen a full list of commands missed in the manual, you can check the Keywords files in editor\keywords, which should at least give you a clue.

Incidentally there is a LOCAL too, does anyone know if this works (IE creates a variable local to a function)?
Hilmi2k
21
Years of Service
User Offline
Joined: 29th Nov 2002
Location:
Posted: 13th Dec 2002 23:59
I'm not so sure, but I think creating a variable inside a function automaticaly makes it local

Kale
21
Years of Service
User Offline
Joined: 8th Sep 2002
Location: United Kingdom
Posted: 14th Dec 2002 00:15
Quote: "but I think creating a variable inside a function automaticaly makes it local"

it should do, but i haven't tried this yet!

What the flame does not consume, consumes the flame.
------------------------------------------------------------------------
AMD XP2100+, Geforce4Ti 4400, 512Mb DDR, Abit KX7, WinXP Home
ZomBfied
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location:
Posted: 14th Dec 2002 01:41
I know in db1 variables declared inside functions are Static. (Local and don't reset when the function is called).

Login to post a reply

Server time is: 2024-05-02 08:19:04
Your offset time is: 2024-05-02 08:19:04