"pan_create" - big problem

Posted By: dennis

"pan_create" - big problem - 06/13/07 18:42

Hi!

I have got a problem with "pan_create".

The function "setting()" is not executed when I click on the button.

code:
"
#include <acknex.h>
#include <default.c>

BMAP* IM_BUTTON_B1_ON ="BUTTon_B1_ON.PNG";
BMAP* IM_BUTTON_B1_OFF ="BUTTon_B1_OFF.PNG";
BMAP* IM_BUTTON_B1_OVER ="BUTTon_B1_OVER.PNG";

BMAP* IM_MAUSZEIGER ="Mauszeiger.bmp";

PANEL* Temp_Pan;

function setting()
{

sys_exit("");

}

function main()
{
level_load("");
mouse_mode = 3;
mouse_map = IM_MAUSZEIGER;
Temp_Pan = pan_create("Button = 0,0,IM_BUTTON_B1_ON,IM_BUTTON_B1_OFF,IM_BUTTON_B1_OVER,setting,Null,Null; flags = visible;",100);
while(1)
{
mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;
wait(1);
}
}
"

I hope somebody has a solution....
Posted By: dennis

Re: "pan_create" - big problem - 06/14/07 09:48

Well...nobody has an idea......not good....:(

I have added a second panel in the script that is not created by "pan_create".
code:
"
PANEL* Temp2_Pan =
{
pos_x = 100;
layer = 50;
bmap = IM_BUTTON_B1_ON; Button = 0,0,IM_BUTTON_B1_ON,IM_BUTTON_B1_OFF,IM_BUTTON_B1_OVER,setting,null,null; flags = visible;

}
"

Now both panels are working!!!
Posted By: dennis

Re: "pan_create" - big problem - 09/10/07 15:55


I am still wondering why it doesn't work......

Can you try this on your pc?
Posted By: MrCode

Re: "pan_create" - big problem - 09/10/07 23:15

I don't think PNG is supported by 3DGS.
Posted By: Ottawa

Re: "pan_create" - big problem - 09/10/07 23:29

Hi!

Have you tried
sys_exit("");

sys_exit ("bye");

Ottawa
Posted By: hack-panther

Re: "pan_create" - big problem - 09/10/07 23:54

Ich habe bei meinem Script das selbe Problem...

Die Funktionen eines Buttons per "pan_Create" werden erst ausführbar
wenn ein vordefiniertes Panel mit den selben Buttonfunktionen existiert.

Ich habe diesen Fehler(?) auch schon angesprochen,
aber nie wirklich eine Antwort erhalten.

Nun habe ich einfach ein unsichtbares "Dummy-Panel" mit den
Buttonfunktionen gemacht, damit die Funktionen ausführbar sind.

Sorry dass ich nicht auf Englisch schreibe, bin zu Müde dafür...
Posted By: oldschoolj

Re: "pan_create" - big problem - 09/11/07 00:57

Here is a pan_create that I use for button countdown timers on abilities, I hope it helps you.

Code:
function button_ctr04()
{
button_counter_panel04 = pan_create ("scale_x = .8; scale_y = .8; bmap = buttoncounterpanel.tga; pos_x = 455; pos_y = 665; window (1,1,43,50, buttoncntr.tga,timerbutton04,0); flags |= VISIBLE;", 2);
while (charge_bolt_countdown == 1)
{
reset (button_counter_panel04, VISIBLE);
timerbutton04 += 43;
set(button_counter_panel04, VISIBLE);
wait (-.227272);
}
pan_remove (button_counter_panel04);
timerbutton04 = 0;
}


Posted By: oldschoolj

Re: "pan_create" - big problem - 09/11/07 00:59

OH, I see one problem now in your pan_create statement. At the end....
Code:
 flags = VISIBLE; // change to flags |= VISIBLE;



I hope that helped
Posted By: Alessandro

Re: "pan_create" - big problem - 09/11/07 06:03

Sorry one question:

but you can use the instruction:

level_load("");

So it means I can create an empty level and create it at runtime?
I red in the manual you need to load at least something (wmb, etc...).
Posted By: Spirit

Re: "pan_create" - big problem - 09/11/07 06:30

Yes level_load("") opens an empty level. I dont think that you can read in the manual that you need to load something.

Oldschoolj, |= is wrong. |= is for setting flags and keeping already set flags, and = is for setting flags and resetting all other flags, this is what you need in a definition.

Dennis, I don't know why your panel doesnt work but I see a possible problem with your panel, it has no background image and no size. I think a panel needs either a background image or a size. But Im not sure about this so try it.
Posted By: oldschoolj

Re: "pan_create" - big problem - 09/11/07 08:15

sorry bud, but it's not wrong, and even if thats what the manual says, it works flawlessly the way I have my code. And not only that, but it works for 36 different button counters, at the same time, so.... heh.
option a:

PANEL* some_panel =
{
.....
....
flags = VISIBLE;
}

option b:
PANEL* dummy_panel;

dummy_panel = pan_create ("content.....; flags |= VISIBLE;", layer);
Posted By: dennis

Re: "pan_create" - big problem - 09/11/07 11:22

Thanks for all the answers..!

To MrCode:
The file format PNG is supported by the engine.
(see manual: File formats -> "Supported image formats are PCX, BMP, TGA, DDS, PNG, JPG, and WAD")

I also tried with BMAP....did not work, too.

To Ottawa:
I tried that. Did not work, too.

To hack-panther:
Well I probably have to use a dummy panel for each function I want to call, too.

To Spirit:
I have now tried with a background image and a certain size....it does not work......

------------------------------------

Oldschoolj, you say your panels are working..can you post an example panel?
Posted By: jcl

Re: "pan_create" - big problem - 09/11/07 12:04

Dennis: You can use pan_created panels and click on their buttons. A background image or a second panel is not required. So your problem likely has a different reason. Using buttons is described in the lite-C Workshops; I suggest that you use the panel from the workshops in order to find out if it's something with your images or maybe something else in your script. If you can't find out what's wrong, you can contact the support and send them your project.

Oldschooli: Don't be sloppy with your code. Wrong syntax can cause trouble with any future update, even if it does not throw error messages in the current version. I also see no reason why you should intentionally use wrong syntax. So better go and fix your 36 buttons by replacing |= with =.
Posted By: oldschoolj

Re: "pan_create" - big problem - 09/11/07 16:57

i actually had no diea that was the wrong way to do it, because ive never recieved an error from doign it that way..... but thanks for pointing it out. And to the guy that I said it wasnt the wrong way of doing it sorry man, I'm not that knowledgable of a coder. I just saw that he had flags = instead of flags |=, and mine worked so i figured he had his wrong LOL
Posted By: amadeu

Re: "pan_create" - big problem - 10/07/07 17:12

hi,

Someone found the solution for this Problem?

thx
Posted By: dennis

Re: "pan_create" - big problem - 10/07/07 17:17


Well I haven't found a good solution yet.

But you can:
1.) use a dummy panel (see previous posts)
2.) or use "pan_setevent(...);"..I think that works, too.
Posted By: amadeu

Re: "pan_create" - big problem - 10/07/07 17:30

ok.

thx. but the 1. solution did not waork.
I tried pan_setevent(PANEL*,var type,var num,void* event) but I set the parameter "event" with one STRING from one XML file (I created one dll for this) the game close because the parameter EVENT don´t recognize STRING.
Do you why it happens?
Posted By: dennis

Re: "pan_create" - big problem - 10/07/07 17:33


you have to convert the string...i will try to post a solution for this in 25 minutes....
Posted By: amadeu

Re: "pan_create" - big problem - 10/07/07 17:36

ok.

Thx.
How I could convert STRING to EVENT?

I will wait your post.

thx
Posted By: dennis

Re: "pan_create" - big problem - 10/07/07 18:01


I asked the same question some time ago...

Try this thread:
http://www.coniserver.net/ubbthreads/sho...true#Post784647
(engine_getscript should do)
Posted By: amadeu

Re: "pan_create" - big problem - 10/07/07 18:08

Hi

thanks.

it works.
Posted By: dennis

Re: "pan_create" - big problem - 10/07/07 18:11


no problem
Posted By: dennis

Re: "pan_create" - big problem - 10/07/07 18:20

Is the dll freeware? (If it is where can I download it?)

As VOBs are not working on my computer since A7, I am looking for a new dll for reading information out of XML files.....
© 2024 lite-C Forums