KEYS.BSF
Moderators: Slitherine Core, BA Moderators
-
- Site Admin
- Posts: 9863
- Joined: Wed Mar 23, 2005 10:35 pm
Re: KEYS.BSF
KEYBOARD_ functions only get passed in the me and key values. I'm not sure why that debug function has the other params, but they will always be zero, as you see.
Cheers
Pip
Cheers
Pip
Re: KEYS.BSF
is there a way the catch the pressed key when there no unit selected?
-
- Site Admin
- Posts: 9863
- Joined: Wed Mar 23, 2005 10:35 pm
Re: KEYS.BSF
I don't think so. It would be too easy to interfere with the main UI key handling.
Cheers
Pip
Cheers
Pip
Re: KEYS.BSF
but in fact, with no unit selected, you can push N or TAB and goes to the first unit id.
-
- Site Admin
- Posts: 9863
- Joined: Wed Mar 23, 2005 10:35 pm
Re: KEYS.BSF
You can attach a key to a UI object, yes. If you have your own UI control active then you can attach keys to them in the same way as BattleAdvancedPanel for example.
Cheers
Pip
Cheers
Pip
Re: KEYS.BSF
I already put a
COMMAND KEY 4 (for example in the button:
[BAPAFVUnitsButton]
type button
x 300
y 3
width 54
height 54
file IPOD_AFV.tga
sfxfocus 7
sfx 5
COMMAND KEY 4
tooltip IDS_BAP_AFV
The UI_OBJ_HANDLE(data, event, id) works with, or without, a unit selected, but the shortcut "4" works only if catch it in the Keys.bsf
example:
if( IsUIObject(id, "BAPAFVUnitsButton") == 1 )
{
printHeader ("AFV");
printUnits(GetCurrentSide(), 1);
}
this works when the button in the advanced panel is clicked, with or without a unit selected.
but the "4" don't. I need to put in KEYS:
if(key == 52)
{
// number 4 keyboard
printHeader ("AFV");
printUnits(GetCurrentSide(), 1);
}
COMMAND KEY 4 (for example in the button:
[BAPAFVUnitsButton]
type button
x 300
y 3
width 54
height 54
file IPOD_AFV.tga
sfxfocus 7
sfx 5
COMMAND KEY 4
tooltip IDS_BAP_AFV
The UI_OBJ_HANDLE(data, event, id) works with, or without, a unit selected, but the shortcut "4" works only if catch it in the Keys.bsf
example:
if( IsUIObject(id, "BAPAFVUnitsButton") == 1 )
{
printHeader ("AFV");
printUnits(GetCurrentSide(), 1);
}
this works when the button in the advanced panel is clicked, with or without a unit selected.
but the "4" don't. I need to put in KEYS:
if(key == 52)
{
// number 4 keyboard
printHeader ("AFV");
printUnits(GetCurrentSide(), 1);
}
-
- Site Admin
- Posts: 9863
- Joined: Wed Mar 23, 2005 10:35 pm
Re: KEYS.BSF
Ah - right. I remember now (I think!) it's actually a way for a UI control to trigger a key press (e.g. the 1 key was being used prior to the (iPad) bar of additional controls. So the button press triggers a key event. Hence the behaviour you are seeing.
Hmmm - not sure if there is any way around it that without a code change.
Cheers
Pip
Hmmm - not sure if there is any way around it that without a code change.
Cheers
Pip
Re: KEYS.BSF
But there is a different behaviour between the 1 key and the N key, in the first case the code triggered is in KEY.BSF but in the second case no (I could not find it for now. This second case is the clue, because it is triggered even without a unit selected.pipfromslitherine wrote:Ah - right. I remember now (I think!) it's actually a way for a UI control to trigger a key press (e.g. the 1 key was being used prior to the (iPad) bar of additional controls. So the button press triggers a key event. Hence the behaviour you are seeing.
Hmmm - not sure if there is any way around it that without a code change.
Cheers
Pip
-
- Site Admin
- Posts: 9863
- Joined: Wed Mar 23, 2005 10:35 pm
Re: KEYS.BSF
The N key is captured in code, it's one of the main game key shortcuts. The button just triggers the same keypress so that we don't have to have two flows into the logic.
Cheers
Pip
Cheers
Pip
Re: KEYS.BSF
Tha's was I thought, just wanted to be sure.