ID:260375
 
(Originally posted by Ol' Yeller, but he deleted it for some reason.)

The current way of doing it through the interface editor it would take nearly forever defining something for every key and be very tedious.

Perhaps something similar to Loduwjik's Keystate library?
client/KeyDown(key)
if(key&(CTRL|Q))
src<<"You are holding Ctrl+Q."
client/KeyUp(key)
if(key&(CTRL|Q))
src<<"You are no longer holding Ctrl+Q."



Something similar to that would be great. =P




I'm confused as to why BYOND Staff didn't consider to make some of their new interface changes more... procedure-based. Not just KeyUp() and KeyDown, but also events like OnChange(window,control,variable,old_value,new_value).

-- Data
Android Data wrote:
(Originally posted by Ol' Yeller, but he deleted it for some reason.)

The current way of doing it through the interface editor it would take nearly forever defining something for every key and be very tedious.

Perhaps something similar to Loduwjik's Keystate library?
> client/KeyDown(key)
> if(key&(CTRL|Q))
> src<<"You are holding Ctrl+Q."
> client/KeyUp(key)
> if(key&(CTRL|Q))
> src<<"You are no longer holding Ctrl+Q."
>

Something similar to that would be great. =P



I'm confused as to why BYOND Staff didn't consider to make some of their new interface changes more... procedure-based. Not just KeyUp() and KeyDown, but also events like OnChange(window,control,variable,old_value,new_value).

Because usually the game is controlling the interface, not vice-versa. In those other times, it's more efficient to do it client-side rather than sending a network event for every little thing.

As far as the keyboard stuff goes-- once we have it so that macros (and menus.controls) can be added at runtime, you should be able to accomplish what you want.
In response to Tom
Tom wrote:
Because usually the game is controlling the interface, not vice-versa. In those other times, it's more efficient to do it client-side rather than sending a network event for every little thing.

A checkbox on macros which says "Send to server", which would send the network call! By default not checked. ;)

As far as the keyboard stuff goes-- once we have it so that macros (and menus.controls) can be added at runtime, you should be able to accomplish what you want.

Yay! ^_^

-- Data
Android Data wrote:
(Originally posted by Ol' Yeller, but he deleted it for some reason.)

The current way of doing it through the interface editor it would take nearly forever defining something for every key and be very tedious.

Perhaps something similar to Loduwjik's Keystate library?
> client/KeyDown(key)
> if(key&(CTRL|Q))
> src<<"You are holding Ctrl+Q."
> client/KeyUp(key)
> if(key&(CTRL|Q))
> src<<"You are no longer holding Ctrl+Q."
>

Something similar to that would be great. =P

This is actually quite easy, with a macro sheet that calls a keydown verb on pressing and a keyup verb on releasing. I use a similar method in my current 4.0 game to handle pressing a direction key versus holding a direction key.

The basics are:

client
var/list/keys_pressed = list()
var/list/time_pressed = list()

var/list/held_keys = list()


client/proc/ProcessTrigger(keyID)
if(!(keyID in keys_pressed)) keys_pressed += keyID
time_pressed[keyID] = world.time
DepressedKey(keyID)
spawn(2)
if(keyID in keys_pressed)
HoldingKey(keyID)
if(!(keyID in held_keys)) held_keys += keyID

client/proc/ProcessRelease(keyID)
if(time_pressed[keyID] >= world.time-1) TappedKey(keyID)
else ReleasedKey(keyID)
keys_pressed -= keyID
time_pressed -= keyID
held_keys -= keyID

client/proc
//A "depress" happens when you push the key down.
DepressedKey(keyID)
usr << "PRESSED KEY [keyID]"

//A "tap" happens if you release the key within 0.1 seconds of depressing it.
TappedKey(keyID)
usr << "TAPPED KEY [keyID]"

//A "holding" happens if you do not release the key within 0.1 seconds of depressing it.
HoldingKey(keyID)
usr << "HOLDING KEY [keyID]"

//A "release" happens if you release the key after holding it.
ReleasedKey(keyID)
usr << "RELEASED KEY [keyID]"


Then call ProcessTrigger(keyID) with your keydown verb and ProcessRelease(keyID) with your keyup verb, and make your macro sheet call the keydown() and keyup() verbs with appropriate keyIDs as the argument.
In response to Tom
Tom wrote:
As far as the keyboard stuff goes-- once we have it so that macros (and menus.controls) can be added at runtime, you should be able to accomplish what you want.

Sounds great!

Any plans on when it will be expected to be released? 5.0 (just kidding!)? =p



Anyways, thanks for reposting this AD.