Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
6 registered members (AndrewAMD, Ayumi, degenerate_762, 7th_zorro, VoroneTZ, HoopyDerFrood), 1,268 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19053 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: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
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 | chip programmers | 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