6 registered members (AndrewAMD, Ayumi, degenerate_762, 7th_zorro, VoroneTZ, HoopyDerFrood),
1,268
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
pan_setdigits
#368346
04/24/11 12:13
04/24/11 12:13
|
Joined: Aug 2007
Posts: 1,922 Schweiz
Widi
OP
Serious User
|
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:
#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
User
|
User
Joined: Oct 2004
Posts: 900
Lgh
|
The parameter 4 is not the STRING* or char* format. This way should work.
#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);
}
}
|
|
|
Re: pan_setdigits
[Re: rojart]
#368365
04/24/11 17:07
04/24/11 17:07
|
Joined: Aug 2007
Posts: 1,922 Schweiz
Widi
OP
Serious User
|
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:
#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
User
|
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:
#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.
#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.
|
|
|
Re: pan_setdigits
[Re: jcl]
#368617
04/26/11 21:50
04/26/11 21:50
|
Joined: Oct 2004
Posts: 900 Lgh
rojart
User
|
User
Joined: Oct 2004
Posts: 900
Lgh
|
This code will crash: "" is a char*, but not a var*. Strange, because ("") works without any crashes like code below, a bug?
#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);
}
|
|
|
|