[PLUGIN] Input System v0.96b (21/03/2011): Keyb+Mouse+Joy

Post and try out addons that are currently in development.

Post » Sun Apr 10, 2011 9:35 am

I have a question about save & load controller setting in Input System3.cap.

My testing steps are:
1. push "save" button to save current configure. I can see these configure in the "InputSystem.cfg" file.
2. delete "InputSystem.cfg" file.
3. push all clear buttons (Clear Controls, Clear Presets, event Reload pesets).
4. push "save" button again. A new "InputSystem.cfg" file has been created.
5. open current "InputSystem.cfg" file. I see two sets of configure. One is previous configure before clear, the other is null.

The load operation seems to load first set of configure, so that I can't save current configure after push save button first time.

My question is how to clear previous saved configure? My testing environmet is winXP.

Thanks
B
97
S
22
G
176
Posts: 4,109
Reputation: 103,021

Post » Sun Apr 10, 2011 1:13 pm

Ir's not a bug from InputSystem but from the Binary object.
If you create a Binary object before save, the InputSystem.cfg file is correct.

I've updated the example: http://www.box.net/shared/n8i16iolnt

Unfortunately, it's not a good idea to allocate a Binary object each time as Binary objects cannot be destroyed...
B
3
S
1
G
2
Posts: 80
Reputation: 985

Post » Sun Apr 10, 2011 1:51 pm

Thank you,
I thought I had already avoided the binary file access issue in my step2 (delete "InputSystem.cfg" file.), but I still fall in the trap. :(

I try use python to access configure save file.
read:
[code:20ut87eu]r_file = open("input_system.cfg", "r")
InputSystem.SetControlConfigData(r_file.read())
r_file.close()[/code:20ut87eu]
save:
[code:20ut87eu]w_file = open("input_system.cfg", "wb")
w_file.write(InputSystem.GetControlConfigData)
w_file.close()[/code:20ut87eu]

It's work.
B
97
S
22
G
176
Posts: 4,109
Reputation: 103,021

Post » Fri May 13, 2011 8:16 am

Hi,

There is a bug about key-map in configure of event.
See this cap file.
http://dl.dropbox.com/u/5779181/keymap_err.zip

[code:1v8ho4xv]+ InputSystem: Key W is down
-> Text: Set text to "w"
+ InputSystem: Key S is down
-> Text: Set text to "s"[/code:1v8ho4xv]

key "W" and key "S" are mapping to key "Q" and key "A". Press "Q" will trigger -> Text: Set text to "w"
B
97
S
22
G
176
Posts: 4,109
Reputation: 103,021

Post » Fri May 13, 2011 8:30 am

Don't know if it helps, but changing from 'Key is down?' to 'On Key Pressed' works (possible workaround?).
If your vision so exceeds your ability, then look to something closer.
Moderator
B
120
S
28
G
68
Posts: 4,841
Reputation: 48,283

Post » Fri May 13, 2011 9:21 am

Key is down parameter is a key code. It uses a name to be "Human readable" and the name is based on the US keyboard layout.
So when you specify "Key W is down", it is the W key in a US layout. For a FR layout it is Z.

To get key name you have 2 functions:
GetKeyName(KeyCode) to get the US layout key name and GetLocalKeyName(KeyCode) to get key name for local layout.

To display the last key pressed in local layout in you example:

+ InputSystem: Key W is down
-> Text: Set text to InputSystem.GetLocalKeyName(InputSystem.LastKeyDown)

InputSystem.LastKeyDown gives the key code of the last key down.

N.B.: I think a On Char Pressed event is missing
B
3
S
1
G
2
Posts: 80
Reputation: 985

Post » Fri May 13, 2011 10:37 am

Sorry, I'm not sure what's wrong.

I try built-in MouseKeyboard object.
[code:2sbg9go7]+ MouseKeyboard: Key W is down
-> Text: Set text to "w"
+ MouseKeyboard: Key S is down
-> Text: Set text to "s"[/code:2sbg9go7]
http://dl.dropbox.com/u/5779181/keymap_err.zip

It's correct to perform pressing "w" & "s" key.
What's different between InputSystem and MouseKeyboard? (They look like using US layout, too.)

Thanks.
B
97
S
22
G
176
Posts: 4,109
Reputation: 103,021

Post » Fri May 13, 2011 11:13 am

No, MouseKeyboard test the character entered by the user, not scan key code.
B
3
S
1
G
2
Posts: 80
Reputation: 985

Post » Fri May 13, 2011 1:12 pm

Thank you. I will be careful.
It may make user(like me :oops: ) confuse if event setting is not match to character.
B
97
S
22
G
176
Posts: 4,109
Reputation: 103,021

Post » Thu May 19, 2011 7:22 am

Should be possible a custom editbox with this plugin?
like you can write stuffs with CAPITAL on or off, use Shift to make symbols, etc.. if so.. can u help me figure it out? ty ;)

edit: made it already ;D
B
30
S
6
G
5
Posts: 433
Reputation: 6,061

PreviousNext

Return to Work-in-progress addons

Who is online

Users browsing this forum: No registered users and 0 guests