Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (TipmyPip, AndrewAMD), 911 guests, and 3 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
Just one action when key is pressed #165443
11/03/07 09:26
11/03/07 09:26
Joined: Sep 2007
Posts: 658
germany
Tiles Offline OP
User
Tiles  Offline OP
User

Joined: Sep 2007
Posts: 658
germany
I try to toggle the overlay | visible flags of a panel with pressing the F11 key. if key_f11 causes the panel to toggle all the time when pressing the key. Next way leaded to the manual where i couldn't find my needed info.
on_f11 = toggle(panDisplay2,VISIBLE); just crashes ...

And so i ended in this construct:

Code:
 
var keyblock;

void main ()
{
...
while (1)
{
if ((key_f11) && (keyblock == 0))
{
toggle(panDisplay2,VISIBLE);
toggle(panDisplay2,OVERLAY);
toggle(panDisplay,VISIBLE);
toggle(panDisplay,OVERLAY);
keyblock = 1;
}
if ((key_f11 == 0) && (keyblock == 1))
{
keyblock = 0;
}
}
...
}



Well, it works. But for me it seems an enourmous effort to implement a keyblocker var for every possible key. Is there a better way to do what i want?


trueSpace 7.6, A7 commercial
Free gamegraphics, freewaregames http://www.reinerstilesets.de
Die Community rund um Spiele-Toolkits http://www.clickzone.de
Re: Just one action when key is pressed [Re: Tiles] #165444
11/03/07 09:49
11/03/07 09:49
Joined: Oct 2002
Posts: 361
Germany Cologne
hack-panther Offline
Senior Member
hack-panther  Offline
Senior Member

Joined: Oct 2002
Posts: 361
Germany Cologne
Maybe like this?

Code:
 
void main ()
{
...
while (1)
{
if ((key_f11))
{
toggle(panDisplay2,VISIBLE);
toggle(panDisplay2,OVERLAY);
toggle(panDisplay,VISIBLE);
toggle(panDisplay,OVERLAY);
while((key_f11)) wait(1);
}
wait(1);
}
...
}



Re: Just one action when key is pressed [Re: hack-panther] #165445
11/03/07 09:54
11/03/07 09:54
Joined: Sep 2007
Posts: 658
germany
Tiles Offline OP
User
Tiles  Offline OP
User

Joined: Sep 2007
Posts: 658
germany
Excellent. I knew there is a better way. Thanks


trueSpace 7.6, A7 commercial
Free gamegraphics, freewaregames http://www.reinerstilesets.de
Die Community rund um Spiele-Toolkits http://www.clickzone.de
Re: Just one action when key is pressed [Re: Tiles] #165446
11/03/07 10:18
11/03/07 10:18
Joined: Dec 2005
Posts: 478
India
M
msl_manni Offline
Senior Member
msl_manni  Offline
Senior Member
M

Joined: Dec 2005
Posts: 478
India
on_f11 = toggle(panDisplay2,VISIBLE); just crashes ...


change it to

on_f11 = toggle;

then it wont crash.


My Specialities Limited.
Re: Just one action when key is pressed [Re: msl_manni] #165447
11/03/07 12:07
11/03/07 12:07
Joined: Sep 2007
Posts: 658
germany
Tiles Offline OP
User
Tiles  Offline OP
User

Joined: Sep 2007
Posts: 658
germany
Indeed. No crash. But it doesn't toggle, because now it doesn't know what to toggle. And gives me an syntax error too, not starting at all


trueSpace 7.6, A7 commercial
Free gamegraphics, freewaregames http://www.reinerstilesets.de
Die Community rund um Spiele-Toolkits http://www.clickzone.de
Re: Just one action when key is pressed [Re: Tiles] #165448
11/03/07 12:26
11/03/07 12:26
Joined: Sep 2007
Posts: 658
germany
Tiles Offline OP
User
Tiles  Offline OP
User

Joined: Sep 2007
Posts: 658
germany
Ah, me idiot. on_key is a function call without the use of (), right? No wonder i didn't get it to work. I expected a () for a function call ...

Okay, got the syntax error sorted too. Gave me an error because toggle is reserved by the engine (grr, everything you need is always reserved, and so you cannot use for what you really need it). Using another word like toggl solved it

So i have two working ways now. Thanks for your help

EDIT: Wow, lots of pitfalls here. on_f11 overrides the default.c f11 functions. And so the default values and the wire doesn't show anymore. So i have to use the if (key_f11) for my case here.

Last edited by Tiles; 11/03/07 12:40.

trueSpace 7.6, A7 commercial
Free gamegraphics, freewaregames http://www.reinerstilesets.de
Die Community rund um Spiele-Toolkits http://www.clickzone.de
Re: Just one action when key is pressed [Re: Tiles] #165449
11/04/07 10:30
11/04/07 10:30
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
Use another key for testing and change it to F11 for the finished product

Or take acknex.c, copy it locally and adapt it to your needs.

Re: Just one action when key is pressed [Re: FBL] #165450
11/04/07 12:06
11/04/07 12:06
Joined: Sep 2007
Posts: 658
germany
Tiles Offline OP
User
Tiles  Offline OP
User

Joined: Sep 2007
Posts: 658
germany
Will do. Danke


trueSpace 7.6, A7 commercial
Free gamegraphics, freewaregames http://www.reinerstilesets.de
Die Community rund um Spiele-Toolkits http://www.clickzone.de

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