0 registered members (),
1,459
guests, and 9
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Im having 2 problems to do with panels
[Re: JakeBilbe]
#372889
06/05/11 16:16
06/05/11 16:16
|
Joined: Nov 2006
Posts: 497 Ohio
xbox
Senior Member
|
Senior Member
Joined: Nov 2006
Posts: 497
Ohio
|
I'm used to C-Script still, so this may be partially wrong. but something like
...
while(key_i != 1){wait(1);} //this waits until key I is pressed
set(inventory_pan, VISIBLE); // this sets the inventory panel visible
while(key_i != 0){wait(1);} // this waits until key I is released to continue with the code. this prevents holding the I key.
//now the next lines of code go into the inventory panel code
while(1)
{
if(key_i == 1)
{
reset(inventory_pan, VISIBLE);
}
wait(1);
}
...
and if you want a button to do it...
//put this code on the "click" function of the button
if(inventory_pan.VISIBLE == 1)
{
reset(inventory_pan, VISIBLE);
}
else
{
set(inventory_pan, VISIBLE);
}
^^This code is most likely wrong however you get the idea. As I said, i'm still used to C-Script but I do know some lite-C.
Last edited by xbox; 06/05/11 16:20.
|
|
|
Re: Im having 2 problems to do with panels
[Re: xbox]
#372896
06/05/11 16:38
06/05/11 16:38
|
Joined: Apr 2007
Posts: 3,751 Canada
WretchedSid
Expert
|
Expert
Joined: Apr 2007
Posts: 3,751
Canada
|
First off, No semicolon after the if statement. also, replace the comma with a period an compare it to 1 so it will look like this Third: Flags are bit fields and you are doing them wrong. @OP:
if(inventory_main.flags & VISIBLE)
{
// Your code here
}
Shitlord by trade and passion. Graphics programmer at Laminar Research. I write blog posts at feresignum.com
|
|
|
Re: Im having 2 problems to do with panels
[Re: xbox]
#372902
06/05/11 17:00
06/05/11 17:00
|
Joined: Apr 2009
Posts: 81
JakeBilbe
OP
Junior Member
|
OP
Junior Member
Joined: Apr 2009
Posts: 81
|
Sorry I forgot to mention I tried a ";" after the original didnt work, but I tried the code I am not sure if this is right but I after I click the button to close it and I click the button to open the menu it doesn't open again.
PANEL* inventory_main =
{
bmap = "main.pcx";
pos_x = 90;
pos_y = 0;
button (90, 154, "medkit3.png", "medkit1.png", "medkit2.png", give_health, NULL, NULL);
button (90, 284, "medkit3.png", "medkit1.png", "medkit2.png", give_health2, NULL, NULL);
button (670, 75, "quit_clicked.png", "quit_normal.png", "quit_hover.png", hide_inv, NULL, NULL);
flags = OVERLAY;
}
function hide_inv()
{
if(inventory_main.flags & VISIBLE)
{
pan_remove(inventory_main);
}
}
Last edited by JakeBilbe; 06/05/11 17:04.
|
|
|
Re: Im having 2 problems to do with panels
[Re: xbox]
#372907
06/05/11 17:26
06/05/11 17:26
|
Joined: Apr 2009
Posts: 81
JakeBilbe
OP
Junior Member
|
OP
Junior Member
Joined: Apr 2009
Posts: 81
|
PANEL* inventory_main =
{
bmap = "main.png";
pos_x = 90;
pos_y = 0;
button (90, 154, "medkit3.png", "medkit1.png", "medkit2.png", give_health, NULL, NULL);
button (90, 274, "medkit3.png", "medkit1.png", "medkit2.png", give_health2, NULL, NULL);
button (670, 75, "quit_clicked.png", "quit_normal.png", "quit_hover.png", hide_inv, NULL, NULL);
flags = OVERLAY;
}
PANEL* show_menu =
{
bmap = "menu.png";
pos_x = 10;
pos_y = 500;
button (0, 0, "clicked_menu.png", "normal_menu.png", "hover_menu.png", show_menu2, NULL, NULL);
flags = OVERLAY | SHOW;
}
function hide_inv()
{
if(inventory_main.flags & VISIBLE)
{
pan_remove(inventory_main);
}
}
function show_menu2()
{
set (inventory_main, SHOW);
}
inventory_main is the inventory panel show_menu is the button that opens the inventory hide_inv is the code I have to hide the inventory, doesnt work show_menu2 is the code used to make the button open the inventory.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|