|
3 registered members (Lapsa, Martin_HH, 1 invisible),
1,168
guests, and 7
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Help with some Codes
#338804
08/21/10 18:14
08/21/10 18:14
|
Joined: Jul 2008
Posts: 22 Bayern
CrYzZeR
OP
Newbie
|
OP
Newbie
Joined: Jul 2008
Posts: 22
Bayern
|
Hello guys I hope you can help me because im not so good at programming ( i`ll do my best  ) I`ve created an Action, that works pretty well. When I go to an entity who had this Action, I go to him until 500 Quants press the Space key and a Panel appear. this works really good but now my problem: I can`t get it how to disappear this Panel after Iam pressing any key. Can you help me? Code is in the Spoiler (Sry for my bad English  )
bmap Angler_tga = <Angler.tga>; sound Angler_snd = <Anglerspricht.wav>;
action Angler
{
// make sure that your player action includes this line of code: "player = null;" at its beginning
while (player == null) {wait (1);}
while (1)
{
if (vec_dist (player.x, my.x) < 500) // the player has come closer than 100 quants to the switch?
{
if (key_space == on) // the space button button was pressed?
{
while (key_space == on) {wait (1);} // wait until the button is released
// put your own code here pan_create("bmap = Angler_tga; pos_x = 0; pos_y = 0; flags = overlay, visible;", 10); // layer = 10 snd_play (Angler_snd, 150, 0);
} }
wait (1);
}
}
I want to Entertain you...
|
|
|
Re: Help with some Codes
[Re: CrYzZeR]
#338806
08/21/10 18:25
08/21/10 18:25
|
Joined: May 2009
Posts: 5,377 Caucasus
3run
Senior Expert
|
Senior Expert
Joined: May 2009
Posts: 5,377
Caucasus
|
I guess you need to use: ptr_remove(void* object); Because the way you create the pan like this, in run-time can be deleted only this way (or only after turning engine off, as manual says). But I advice you not to create panel at run-time, but to create it at the beginning on your script, and make it invisible, so then you'll be able to toggle visibility on and off.
|
|
|
Re: Help with some Codes
[Re: CrYzZeR]
#338809
08/21/10 18:49
08/21/10 18:49
|
Joined: Sep 2009
Posts: 1,035 Budapest
Aku_Aku
Serious User
|
Serious User
Joined: Sep 2009
Posts: 1,035
Budapest
|
If you want to hide the panel try this: reset(Panel,SHOW); This instruction doesn't remove the panel just hides that. You can show it again, when it needs. I propose modify your code:
bmap Angler_tga = <Angler.tga>;
sound Angler_snd = <Anglerspricht.wav>;
PANEL* pan_Angler; // <------- INSERT THIS LINE
.....
// ------ replace your code with this ------
// -----------------------------------------
pan_Angler=pan_create("bmap = Angler_tga; pos_x = 0; pos_y = 0; flags = overlay, visible;", 10); // layer = 10
So you can use the reset(Panel,SHOW); anytime.
Last edited by Aku_Aku; 08/21/10 19:00.
|
|
|
Re: Help with some Codes
[Re: Aku_Aku]
#338937
08/22/10 21:17
08/22/10 21:17
|
Joined: Apr 2006
Posts: 159 Latvija
Arrovs
Member
|
Member
Joined: Apr 2006
Posts: 159
Latvija
|
No No no. This is c-script not lite-c. /////============
Your code fix //defineat start where your bmaps are. panel* panelis;
panelis=pan_create("bmap = Angler_tga; pos_x = 0; pos_y = 0; flags = overlay, visible;", 10); // layer = 10
So next time to remove ir use: pan_remove(panelis);//so it know which panel to delete or panelis.visible=off;//if you want only switch it off.
Arrovs once will publish game
|
|
|
|