Help!
by VoroneTZ. 10/14/25 05:04
|
|
|
|
|
|
|
|
|
|
PANEL SHOW Flag makes Engine crash ._.?
#398710
04/05/12 13:58
04/05/12 13:58
|
Joined: Mar 2008
Posts: 2,247 Baden Württemberg, Germany
Espér
OP
Expert
|
OP
Expert
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
|
hi there.. i´ve written this codes:
PANEL* pan_objectlist =
{
pos_y = 61;
pos_x = 0;
layer = 90;
bmap = bm_listbutt_0;
size_y = 1920;
flags = SHOW;
}
void create_listbuttons(var typus)
{
var izahl, igoalzahl;
igoalzahl = 1001;
if(typus == 1)
{
for(izahl=0; izahl<igoalzahl; izahl++)
{
pan_setdigits(pan_objectlist, 0, -400, izahl*bmap_height(bm_listbutt_on), "%s", arialing, 1, "leer");
pan_setbutton(pan_objectlist, 0, 0, -400, izahl*bmap_height(bm_listbutt_on), bm_listbutt_on, bm_listbutt_off, bm_listbutt_over, bm_listbutt_off, NULL, NULL, NULL);
wait(1);
}
}
else
{
for(izahl=0; izahl<igoalzahl; izahl++)
{
pan_setdigits(pan_objectlist, izahl, -400, izahl*bmap_height(bm_listbutt_on), "%s", arialing, 1, "leer");
pan_setbutton(pan_objectlist, izahl, 0, -400, izahl*bmap_height(bm_listbutt_on), bm_listbutt_on, bm_listbutt_off, bm_listbutt_over, bm_listbutt_off, NULL, NULL, NULL);
wait(1);
}
}
}
void addto_objectlist(var objektnummer)
{
pan_setdigits(pan_objectlist, objektnummer, 0, objektnummer*bmap_height(bm_listbutt_on), "%s", arialing, 1, (objektnamen.pstring)[objektnummer]);
pan_setbutton(pan_objectlist, objektnummer, 0, 0, objektnummer*bmap_height(bm_listbutt_on), bm_listbutt_on, bm_listbutt_off, bm_listbutt_over, bm_listbutt_off, NULL, NULL, NULL);
wait(1);
}
the panel bitmap has a height of 20, and a width of 200. So it should be repeated with a y size of 1920. The first function creates the buttons or resets them (see variable switch). The second fucntion makes a panel visible and enables mouseclick for the user, by pushing its pos_x to 0. What i do is: on startup (after 2 frames waiting after level_load):
create_listbuttons(1); //initialize the buttons and digits
on object_loading (reaout folder and make a list):
//reset buttons to X = -400, to hide them all.
create_listbuttons(0);
wait_for(create_listbuttons);
The object_loader is called just once, when changing the category. and for when an object is listed:
addto_objectlist(entitycounter);
if you need the object loader too:
void load_files()
{
//reset buttons to X = -400, to hide them all.
create_listbuttons(0);
wait_for(create_listbuttons);
var ilt, objectcount, fhandle, entitycounter;
entitycounter = 0;
for(ilt=0; ilt<4000; ilt++)
{
str_cpy((ordnerinhalt.pstring)[ilt], "");
str_cpy((objekteigenschaften.pstring)[ilt], "");
str_cpy((objektnamen.pstring)[ilt], "");
}
txt_for_dir(ordnerinhalt, "Models\\Map\\*.mdl");
for(ilt=0; ilt<4000; ilt++)
{
if((ordnerinhalt.pstring)[ilt] != NULL)
{
if(str_stri((ordnerinhalt.pstring)[ilt], ".mdl") && str_stri((ordnerinhalt.pstring)[ilt], themenname))
{
objectlist[entitycounter] = ent_create(NULL, vector(-9000,-9000,-9000), NULL);
objectlist[entitycounter].string1 = str_create((ordnerinhalt.pstring)[ilt]);
str_cpy((objektnamen.pstring)[entitycounter], objectlist[entitycounter].string1);
str_trunc((ordnerinhalt.pstring)[ilt], 3);
str_cat((ordnerinhalt.pstring)[ilt], "nymph");
if(file_exists((ordnerinhalt.pstring)[ilt]))
{
objectlist[entitycounter].string2 = str_create((ordnerinhalt.pstring)[ilt]);
fhandle = file_open_read((ordnerinhalt.pstring)[ilt]);
file_close(fhandle);
}
else
{
objectlist[entitycounter].string2 = str_create("NoSetup");
}
//Add object to the button list
addto_objectlist(entitycounter);
wait(1);
entitycounter += 1;
auswahlobjekte = ilt+1;
}
}
}
}
My problem now: When i use:
PANEL* pan_objectlist =
{
pos_y = 61;
pos_x = 0;
layer = 90;
bmap = bm_listbutt_0;
size_y = 1920;
flags = SHOW;
}
Engine crashes with "Acknex is not working" windows message When i hide the "flags = SHOW;" in a comment like "//flags = SHOW;", it works ._. Wheres the problem? Did i make something wrong in the Panel definition?
Last edited by Espér; 04/05/12 13:59.
|
|
|
Re: PANEL SHOW Flag makes Engine crash ._.?
[Re: Espér]
#398937
04/09/12 00:02
04/09/12 00:02
|
Joined: Jun 2004
Posts: 2,234 Wisconsin USA
FoxHound
Expert
|
Expert
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
|
Size_x and Size_y will be set by the system so no need to put that in unless you are using Windows with no bmaps in the panel itself. PNGs are very happy in panels, I use them all the time.
When normal things don't fix your problems try abnormal things. Delete teh panel and make another panel with a different name but same bmap. If it still doesn't work try a different bmap but same size. Now if it doesn't work try altering the first bmap. If that doesn't work then it is something unrelated but only seems to be the panel. A problem I have had before especially when projects get huge.
--------------------- There is no signature here.
QUIT LOOKING FOR ONE!
|
|
|
Re: Erase Panel Content?
[Re: Espér]
#399106
04/11/12 13:00
04/11/12 13:00
|
Joined: Mar 2008
Posts: 2,247 Baden Württemberg, Germany
Espér
OP
Expert
|
OP
Expert
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
|
Okay.. i´ll rewrite the whole thing.. But stuck in another problem..
I can create a Panel with Panel, and with pan_setbutton, i can create the buttons..
Question: Is there a way to erase those buttons when RELOADING the files? I don´t want to erase the models, stats..etc with level_load.. Just the buttons i created with pan_setbutton... (f.e. pan_erasebutton(PANEL*, number);)
I surely could make pan_setbutton and switch all buttons invisible.. but i need the Button-IDs again when loading the new Models... and writing a second code in an if-condition is senseless ._.
Last edited by Espér; 04/11/12 13:00.
|
|
|
Re: Erase Panel Content?
[Re: Espér]
#399121
04/11/12 14:13
04/11/12 14:13
|
Joined: Jun 2004
Posts: 2,234 Wisconsin USA
FoxHound
Expert
|
Expert
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
|
panel = pan_create("blah blah blah,1);
will rewrite the panel. Or placing
panel = NULL;
Will make it nothing and allow you to rewrite the whole panel.
Using pan_setbutton you can rewrite each button anyway you like. I can not think of a way to remove buttons other than to give them an invisible button with no function so it might as well be nothing.
However if you wanted to tile the panel in the first place that could be the problem (I have never tried it so I don't know). A good way to tile an image is to use "window" and set the panel size to way bigger than the image is. I do it all the time in my game, usually by accident, and the game is just fine with it.
Last edited by FoxHound; 04/11/12 14:15.
--------------------- There is no signature here.
QUIT LOOKING FOR ONE!
|
|
|
|