Invalid Function Arguments??

Posted By: Yashas

Invalid Function Arguments?? - 11/16/12 09:19

Code:
void GoGoGo ()
{
	BMAP * TEMP;
	int i = integer(random(6));
	TEMP = &SpeedRunShapes[i];
	pan_setwindow(SpeedRun_ControlsRunning,1,200,150,200,200,TEMP,200,200);
}



I get Invalid Function Arguments in a MessageBox.
Pointer is initialized with a address of a Bitmap.

The Error is caused by "pan_setwindow" function.
Thanks
Posted By: Uhrwerk

Re: Invalid Function Arguments?? - 11/16/12 11:46

I see three possibilities:
1. TEMP should be the address of a bitmap but in fact isn't
2. SpeedRun_ControlsRunning isn't a valid panel.
3. There is not yet a window at panel index is. In this case you should replace the 1 with a 0 in oder to create a new window.
Posted By: Yashas

Re: Invalid Function Arguments?? - 11/16/12 15:18

Originally Posted By: Uhrwerk
I see three possibilities:
1. TEMP should be the address of a bitmap but in fact isn't
2. SpeedRun_ControlsRunning isn't a valid panel.
3. There is not yet a window at panel index is. In this case you should replace the 1 with a 0 in oder to create a new window.


All the conditions you told exist.

Some more information:
Code:
BMAP * SpeedRunShapes[10];
SpeedRunShapes[0] = "shape1.tga";
SpeedRunShapes[1] = "shape2.tga";
SpeedRunShapes[2] = "shape3.tga";
SpeedRunShapes[3] = "shape4.tga";
SpeedRunShapes[4] = "shape5.tga";
SpeedRunShapes[5] = "shape6.tga";



Code:
PANEL * SpeedRun_ControlsRunning =
{
	layer = 12;
	digits(10,10,"Time Remaining:%2.f","Arial#30b",1,Time);
	digits(300,10,"Score:%2.f","Arial#30b",1,Score);
	digits(170,130,"Remember this shape","Arial#30b",1,0);
	window(200,150,200,200,"shape1.tga",200,200);
	flags = TRANSLUCENT;	
}

Posted By: Uhrwerk

Re: Invalid Function Arguments?? - 11/16/12 15:22

SpeedRunShapes is an array of bitmap pointers. You cannot assign character arrays to its elements.

http://www.conitec.net/beta/abmap_create.htm
Posted By: 3dgs_snake

Re: Invalid Function Arguments?? - 11/16/12 15:23

Code:
1. TEMP should be the address of a bitmap but in fact isn't

wink
Where do you declare the bmaps?
Code:
SpeedRunShapes[0] = "shape1.tga";
SpeedRunShapes[1] = "shape2.tga";
SpeedRunShapes[2] = "shape3.tga";
SpeedRunShapes[3] = "shape4.tga";
SpeedRunShapes[4] = "shape5.tga";
SpeedRunShapes[5] = "shape6.tga";



If you do them outside of a function, then that is the problem. You can't do that wink . You need to create them inside a function (using bmap_create).
Posted By: Yashas

Re: Invalid Function Arguments?? - 11/16/12 15:38

Ofc , I declared it inside the function(main) ,for the sake of reducing the size of my post I just copied the snips that were the part of the problem.
Posted By: Uhrwerk

Re: Invalid Function Arguments?? - 11/16/12 16:02

It doesn't matter where you declare them. You can't assign char arrays to bitmap pointers.
Posted By: Wjbender

Re: Invalid Function Arguments?? - 11/16/12 16:52

According to the error message my interpretation is as follows..
You gave a addres to a pointer in the arguments list by using & (address of)
.. I see you initialised the pointer as an array but passed its address
instead try not using the pointer initializing but instead this
bmap array[10] and also dont pass address of in =&bla[]
Posted By: Kartoffel

Re: Invalid Function Arguments?? - 11/16/12 17:14

if you do it inside a function you have to use - as 3dgs_snake already said - 'bmap_create' like this:
Code:
SpeedRunShapes[0] = bmap_create("shape1.tga");

Posted By: EvilSOB

Re: Invalid Function Arguments?? - 11/17/12 02:38

After doing as Kartoffel (and 3dgs_snake) have suggested,
you MIGHT also need change your TEMP allocation to
Code:
TEMP = SpeedRunShapes[i];

ie: remove the "&" addressof operator. The array already contains pointers(addresses)...

[EDIT] Because if you DO use the '&', you are passing the address
to the pointer, NOT the address of the actual bmap 'struct'.

Posted By: Yashas

Re: Invalid Function Arguments?? - 11/17/12 13:21

It's working!!!
Thank You very much. laugh
© 2024 lite-C Forums