Posted: 19th Aug 2011 10:44
Hi guys, I decided to re-write one of my games in AppGameKit (from DBPro) and I make use of a lot of booleans. When I tried to declare a boolean like this:
+ Code Snippet
a as boolean
a = 1
rem A Wizard Did It!
do
 Print(a)
 Sync()
loop


It compiles but I get an error when I run the program, something like exe doesn't exist. If you then compile something that works ie hello world program, change the code to the code shown above, compile, run, it will run the hello world program. So basically compiles but no exe created or no compile error.

So is there a way to declare a boolean? My apologies if I have missed a very obvious answer.

Here is the DBPro equivalent:
+ Code Snippet
sync on : sync rate 60
a as boolean
do
    cls
    print a
    sync
loop
Posted: 19th Aug 2011 16:38
Just use Ints?
Posted: 19th Aug 2011 16:54
What about that:

+ Code Snippet
#Constant True 1
#Constant False 0

a = True

Do
	Print(a)
	Sync()
Loop


Posted: 19th Aug 2011 18:07
I have never used them in DB. I can't see why you would need to specify it. I just set whatever flag I am using to 1 for on and 0 for off, or true and false if you prefer. I also don't really see the point of constants, if you never change a variable it will remain constant anyway, so why bother?
Everyone has their own style of programming I suppose. I'm sure you will find your preferred method with AGK.
Posted: 19th Aug 2011 20:14
AGK supports,

- Strings
- Floats
- Integers
Posted: 20th Aug 2011 0:44
Thanks for the confirmation guys and for some reason I'm getting compiler errors now which is what I was after...in a way.

@ Hubdule: that is a very clever work around!