Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 18,767 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Suggestion:Add key and mouse release function #138514
06/28/07 04:38
06/28/07 04:38
Joined: Jul 2005
Posts: 34
Hong Kong
U
ultranet Offline OP
Newbie
ultranet  Offline OP
Newbie
U

Joined: Jul 2005
Posts: 34
Hong Kong
I want to know why the scripting language doesn't add check key/mouse release functions?
Just like these things:
key_w_release, key_a_release, mouse_left_release, mouse_right_release......etc.
With these functions, scripting will be more handy, right?

Re: Suggestion:Add key and mouse release function [Re: ultranet] #138515
06/28/07 07:53
06/28/07 07:53
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
We don't want to implement trivial functions that can easily implemented by yourself. For this just evaluate the corresponding key or mouse values (mouse_left, mouse_right etc).

Re: Suggestion:Add key and mouse release function [Re: jcl] #138516
06/28/07 10:10
06/28/07 10:10
Joined: Jul 2005
Posts: 34
Hong Kong
U
ultranet Offline OP
Newbie
ultranet  Offline OP
Newbie
U

Joined: Jul 2005
Posts: 34
Hong Kong
I don't think it is trivial functions...
Without checking release functions, I should write like this:

var key_w_release=off;
action PlayerAction()
{
while(1)
{
if(key_w && key_w_release==off)
{key_w_release=on;}
if(!key_w && key_w_release)
{
//other code
key_w_release=off;
}
wait(1);
}
}

I think this way is inconvenient.
with the release functions, I should only do this:
action PlayerAction()
{
while(1)
{
if(key_w_release)
{
//other code
}
wait(1);
}
}
Isn't this more concise?
Or just invent a general function to check if a key is released.
Such as check_key_release(key_w), return true or false.
Same as the mouse, check_mouse_release(mouse_left).

Re: Suggestion:Add key and mouse release function [Re: ultranet] #138517
06/28/07 15:08
06/28/07 15:08
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline
Expert
Joey  Offline
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
you can of course implement a general function to check this. store all your keys you want to survive with their scancodes in an array (forget about the unused space this time, you could also use a dynamic list or something). then, per frame, work with key_pressed to store wether a key has been released this frame (you had the correct code in your last sample). write a small function which returns your release state. approximately 20 lines of code.

joey.


Moderated by  aztec, Spirit 

Gamestudio download | 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