Gamestudio Links
Zorro Links
Newest Posts
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
1 registered members (1 invisible), 857 guests, and 10 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Im having 2 problems to do with panels #372885
06/05/11 15:28
06/05/11 15:28
Joined: Apr 2009
Posts: 81
J
JakeBilbe Offline OP
Junior Member
JakeBilbe  Offline OP
Junior Member
J

Joined: Apr 2009
Posts: 81
Basically I want the "i" key to open an inventory panel, I have already coded the buttons and stuff so its working I just cant get the panel to show and hide on a key press.

Although I would prefer a key press I thought I would make another button to open it but when I do open the panel and I set the close button to panremove when I click the inventory button again it doesnt show up.

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 Offline
Senior Member
xbox  Offline
Senior Member

Joined: Nov 2006
Posts: 497
Ohio
I'm used to C-Script still, so this may be partially wrong.
but something like
Code:
...
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...
Code:
//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] #372893
06/05/11 16:28
06/05/11 16:28
Joined: Apr 2009
Posts: 81
J
JakeBilbe Offline OP
Junior Member
JakeBilbe  Offline OP
Junior Member
J

Joined: Apr 2009
Posts: 81
Well I am using a button now, but the code gives a syntax error on the "if (inventory_main, VISIBLE);" inventory_main is the name of the panel.

Re: Im having 2 problems to do with panels [Re: JakeBilbe] #372895
06/05/11 16:36
06/05/11 16:36
Joined: Nov 2006
Posts: 497
Ohio
xbox Offline
Senior Member
xbox  Offline
Senior Member

Joined: Nov 2006
Posts: 497
Ohio
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


if(inventory_main.VISIBLE == 1)

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 Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Originally Posted By: xbox
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:
Code:
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: WretchedSid] #372900
06/05/11 16:52
06/05/11 16:52
Joined: Nov 2006
Posts: 497
Ohio
xbox Offline
Senior Member
xbox  Offline
Senior Member

Joined: Nov 2006
Posts: 497
Ohio
Okay, cool. I learned something new today. grin Like I said i'm still used to C-Script

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
J
JakeBilbe Offline OP
Junior Member
JakeBilbe  Offline OP
Junior Member
J

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.

Code:
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: JakeBilbe] #372905
06/05/11 17:15
06/05/11 17:15
Joined: Nov 2006
Posts: 497
Ohio
xbox Offline
Senior Member
xbox  Offline
Senior Member

Joined: Nov 2006
Posts: 497
Ohio
what is your full code for the button to close/open the inventory_main panel?

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
J
JakeBilbe Offline OP
Junior Member
JakeBilbe  Offline OP
Junior Member
J

Joined: Apr 2009
Posts: 81
Code:
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.

Re: Im having 2 problems to do with panels [Re: JakeBilbe] #372934
06/05/11 21:13
06/05/11 21:13
Joined: Nov 2006
Posts: 497
Ohio
xbox Offline
Senior Member
xbox  Offline
Senior Member

Joined: Nov 2006
Posts: 497
Ohio
umm...try this. I believe it should work
Code:
function hide_inv()
{
     reset(inventory_main, SHOW);
}



Page 1 of 2 1 2

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