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.

DarkBASIC Professional Discussion / DarkBasic Pro [ Questions ]

Author
Message
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 30th Jan 2003 13:13
i remember reading once that you could use constants in a similar fashion to the C "inline" command

e.g. #constant phi = 3.142
and then everytime you did phi , it would change that all to 3.142

now i'm wondering does this work with other things, for example could i do

#constant makesphere = make object sphere ?
its just i remember reading that something like that was possible - cept it didn't use the =

i mean i'd love to be able to use the constants for alot of things

also been wondering, i know that i can use strings as names where the text is contained like " "
however what about strings that need to work without the " " ... so say like a command,
dbFog = Fog On

because i'm pretty sure the commands down work on thier own, the only thing i can think of doing right now to get around this is by using a buffer file
#include ptrBuffer.dba

in that write a function for all the other functions and such i want to run ... but that would be slow.

really want more of a way to simply define things without them needing to be strings within the " "

can't think of anything else right now, but when i do i'll post again - kinda important i know this though, i'd run a test compile but its a performance to write to CD the files put it in the other machine and compile blah blah
and these things only write like 1,000 times
(i can't standing using the other machine if anyone want to know why i'm not)
Anata aru kowagaru no watashi! http://members.lycos.co.uk/timesaga/darkbasic/gir.gif[/img]
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 30th Jan 2003 15:03
Try this for constants:



It's literally a straight word substitution.
The first word following the '#constant' is what is looked for. Everything else on that line is what is replaced.
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 30th Jan 2003 15:45
Hmmm... thats very useful
now i wonder if these will double up in the functions, one way to find out eh

Anata aru kowagaru no watashi!

Login to post a reply

Server time is: 2025-05-17 18:34:44
Your offset time is: 2025-05-17 18:34:44