Gamestudio Links
Zorro Links
Newest Posts
What are you working on?
by rayp. 10/15/25 20:44
Help!
by VoroneTZ. 10/14/25 05:04
Zorro 2.70
by jcl. 10/13/25 09:01
ZorroGPT
by TipmyPip. 10/12/25 13:58
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 10/11/25 18:45
Reality Check results on my strategy
by dBc. 10/11/25 06:15
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, AndrewAMD), 6,732 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
joenxxx, Jota, krishna, DrissB, James168
19170 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
pan_setdigits #368346
04/24/11 12:13
04/24/11 12:13
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline OP
Serious User
Widi  Offline OP
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
Since the newest A8.20 i have problems with pan_setdigits, it gives a "Empty pointer in main".

Example:
Code:
#include <acknex.h>
#include <default.c>

var testvar;
BMAP* TESTBMAP;

void main()
{
	level_load (NULL);
	
	TESTBMAP = bmap_createblack(200,200,32);
	bmap_fill (TESTBMAP,vector(0,0,255),70);
	PANEL* Testpan = pan_create("bmap = TESTBMAP;   red = 255;   green = 0;   blue = 0", 1);
	set(Testpan,SHOW);
	
	pan_setdigits(Testpan,0,15,7,4,font_create("Arial#100"),1,testvar);  // <-- Testpan gives me the error!
	
	while(1)
	{
		testvar ++;
		wait(1);
	}
}



Last edited by Widi; 04/24/11 12:18.
Re: pan_setdigits [Re: Widi] #368363
04/24/11 16:51
04/24/11 16:51
Joined: Oct 2004
Posts: 900
Lgh
rojart Offline
User
rojart  Offline
User

Joined: Oct 2004
Posts: 900
Lgh
The parameter 4 is not the STRING* or char* format.
This way should work.

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

var testvar;
BMAP* TESTBMAP;

void main()
{
	level_load (NULL);
	
	TESTBMAP = bmap_createblack(200,200,32);
	bmap_fill (TESTBMAP,vector(0,0,255),70);
	PANEL* Testpan = pan_create("bmap = TESTBMAP;   red = 255;   green = 0;   blue = 0", 1);
	set(Testpan,SHOW);
	
	pan_setdigits(Testpan,0,15,7,"%.f",font_create("Arial#100"),1,testvar);  // <-- Testpan gives me the error!
	
	while(1)
	{
		testvar ++;
		wait(1);
	}
}




Regards, Robert

Quote
Everything should be made as simple as possible, but not one bit simpler.
by Albert Einstein

PhysX Preview of Cloth, Fluid and Soft Body

A8.47.1P
Re: pan_setdigits [Re: rojart] #368365
04/24/11 17:07
04/24/11 17:07
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline OP
Serious User
Widi  Offline OP
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
Ok, my fault. Another thing, that was my first error if i use a string without a var:
Code:
#include <acknex.h>
#include <default.c>

BMAP* TESTBMAP;

void main()
{
	level_load (NULL);
	
	TESTBMAP = bmap_createblack(200,200,32);
	bmap_fill (TESTBMAP,vector(0,0,255),70);
	PANEL* Testpan = pan_create("bmap = TESTBMAP;   red = 255;   green = 0;   blue = 0", 1);
	set(Testpan,SHOW);
	STRING* Teststring = str_create("Test");
	
	pan_setdigits(Testpan,0,15,7,Teststring,font_create("Arial#100"),1,0);  // <-- Testpan gives me the error!
	
	while(1)
	{
		wait(1);
	}
}


After some tests i can figute out the following: If i replace the last parameter 0 with a var, it works fine. But with 0 it gives a error. With all lower editions i never had this error.
I know there is a pan_setstring for that.

Last edited by Widi; 04/24/11 17:20.
Re: pan_setdigits [Re: Widi] #368371
04/24/11 18:05
04/24/11 18:05
Joined: Oct 2004
Posts: 900
Lgh
rojart Offline
User
rojart  Offline
User

Joined: Oct 2004
Posts: 900
Lgh
Yes, I had the same problem and I've changed all the 0 to "", because the parameter pv must be a global var* pointer, like this:
Code:
#include <default.c>

BMAP* TESTBMAP;

var O = 0;

void main()
{
	level_load (NULL);
	
	TESTBMAP = bmap_createblack(200,200,32);
	bmap_fill (TESTBMAP,vector(0,0,255),70);
	PANEL* Testpan = pan_create("bmap = TESTBMAP;   red = 255;   green = 0;   blue = 0", 1);
	set(Testpan,SHOW);
	STRING* Teststring = str_create("Test");
	
	pan_setdigits(Testpan,0,15,7,Teststring,font_create("Arial#100"),1,O);  // <-- Testpan gives me the error!
	
	while(1)
	{
		wait(1);
	}
}


And my version without global var pointer.

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

BMAP* TESTBMAP;

void main()
{
	level_load (NULL);
	
	TESTBMAP = bmap_createblack(200,200,32);
	bmap_fill (TESTBMAP,vector(0,0,255),70);
	PANEL* Testpan = pan_create("bmap = TESTBMAP;   red = 255;   green = 0;   blue = 0", 1);
	set(Testpan,SHOW);
	STRING* Teststring = str_create("Test");
	
	pan_setdigits(Testpan,0,15,7,Teststring,font_create("Arial#100"),1,"");  // <-- Testpan gives me the error!
	
	while(1)
	{
		wait(1);
	}
}



Last edited by rojart; 04/24/11 18:21.

Regards, Robert

Quote
Everything should be made as simple as possible, but not one bit simpler.
by Albert Einstein

PhysX Preview of Cloth, Fluid and Soft Body

A8.47.1P
Re: pan_setdigits [Re: rojart] #368533
04/26/11 10:07
04/26/11 10:07
Joined: Jul 2000
Posts: 28,028
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,028
Frankfurt
This code will crash: "" is a char*, but not a var*. Only use the parameter types given in the manual. If you can replace a pointer with NULL, it's always stated in the manual. In this case you can't, as it would not make any sense.

- Moved to the lite-C forum.

Re: pan_setdigits [Re: jcl] #368617
04/26/11 21:50
04/26/11 21:50
Joined: Oct 2004
Posts: 900
Lgh
rojart Offline
User
rojart  Offline
User

Joined: Oct 2004
Posts: 900
Lgh
Originally Posted By: jcl
This code will crash: "" is a char*, but not a var*.


Strange, because ("") works without any crashes like code below, a bug?

Code:
#include <default.c>

void main() {
   PANEL* pQuoteMark = pan_create(0,0);
   pan_setdigits(pQuoteMark,0,0,0,"\"\" Works!",font_create("Arial#20"),0,"");
   set(pQuoteMark,SHOW);
}




Regards, Robert

Quote
Everything should be made as simple as possible, but not one bit simpler.
by Albert Einstein

PhysX Preview of Cloth, Fluid and Soft Body

A8.47.1P

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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