Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,119 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Help with some Codes #338804
08/21/10 18:14
08/21/10 18:14
Joined: Jul 2008
Posts: 22
Bayern
CrYzZeR Offline OP
Newbie
CrYzZeR  Offline 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 wink )

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 wink )

Click to reveal..


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,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
I guess you need to use:
Quote:
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.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Help with some Codes [Re: CrYzZeR] #338809
08/21/10 18:49
08/21/10 18:49
Joined: Sep 2009
Posts: 993
Budapest
Aku_Aku Offline
User
Aku_Aku  Offline
User

Joined: Sep 2009
Posts: 993
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:
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 Offline
Member
Arrovs  Offline
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

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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