Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 18,767 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Using a #define value in a vslider definition #208071
05/24/08 15:19
05/24/08 15:19
Joined: Mar 2008
Posts: 12
M
miko93 Offline OP
Newbie
miko93  Offline OP
Newbie
M

Joined: Mar 2008
Posts: 12
Hello all.

I'm trying to use a "#define XX" value in my vslider definition, but somehow this won't work. Please take a look at this code here:

Code:
#include <acknex.h>
#include <default.c>
#include <stdio.h>
#include <windows.h>

#define MYRANGE 50

BMAP* bmSlider = "slider.bmp";
var   SliderPosition = 1;

PANEL* pPanel1 = // This works ok.
{
	flags =  VISIBLE; 
	vslider = 494, 2, 125, bmSlider, 1, 50, SliderPosition;
}

PANEL* pPanel2 = // This gives a syntax error, pointing to MYRANGE.
{
	flags =  VISIBLE; 
	vslider = 494, 2, 125, bmSlider, 1, MYRANGE, SliderPosition;
}


function main(void)
{
	video_mode = 8; // 1024x768
	fps_max = 60;
		
	level_load("");
	wait(3);
	
	while (1)
	{
    	wait (1);
	}
}


The problem is that as soon as I try to use the #define'd value in my definition of vslider (2nd panel), the compiler gives out a "number syntax" error.

Any hints why this is not working? Thanks a lot.

Re: Using a #define value in a vslider definition [Re: miko93] #208072
05/24/08 15:22
05/24/08 15:22
Joined: Oct 2002
Posts: 799
Germany->Bavaria->Nuremberg
C
Christian__A Offline
User
Christian__A  Offline
User
C

Joined: Oct 2002
Posts: 799
Germany->Bavaria->Nuremberg
Maybe the compiler does simply not allow macros in panel definitions?


MfG, Christian__A. Visit my Site: www.chris-a.de


Re: Using a #define value in a vslider definition [Re: Christian__A] #208142
05/25/08 08:15
05/25/08 08:15
Joined: Mar 2008
Posts: 12
M
miko93 Offline OP
Newbie
miko93  Offline OP
Newbie
M

Joined: Mar 2008
Posts: 12
Christian, thanks, yes. After some more tests, this is the most obvious reason, I think.
Although not being a real problem, it is some sort of "inconsistency", as preprocessor constants should be available everywhere in the code (at least, imho).

Maybe, I should point this out at the bughunt forum...


Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1