[OUTDATED] Extra_Keys_Example Code : Utilizing your keyboard

Documentation, usage tips and configuration guides for Titan Two scripts and bytecodes published by the community users.

[OUTDATED] Extra_Keys_Example Code : Utilizing your keyboard

Postby Scachi » Mon Sep 25, 2017 11:41 am

!OUTDATED .. bad perfomance! .. New code/example available here

This scripts demonstrates the monitoring of a keyboard and binding actions to the keys via Interactive Configuration.

!Download is removed from the online resource!

Functions added by this example:
key_event_active, key_event_release, key_time_active, key_time_release, key_check_active, key_check_release

Usage:
Assign actions to the keys via each combobox.
Run the script, watch the output panel for information about actions found/taken.


Adding xkeys to your project:
Copy xkeys.gph and xkeys_conf.gph into your scripts directory.
Edit xkeys_conf.gph if you want to change the number of keys and/or the key-names to monitor.
Add the two lines below to near the top of your script:
#include <keyboard.gph>
#include "xkeys.gph"

Call the functions
key_event_active, key_event_release, key_time_active, key_time_release, key_check_active, key_check_release
in your script main{} as you need. They are working similiar to the functions used to check for button states.


This example is based on the code of J2Kbr from here: viewtopic.php?f=26&t=6561#p48550
The code is modified to run in its own main loop in xkeys.gph, so you don't need to add anything else to your main loop except calling the key_ functions you want to use.

New code/example available here

Old code is attached to this post.
Attachments
xkeys_Example_OLD.zip
(19.65 KiB) Downloaded 103 times
Last edited by Scachi on Tue Oct 02, 2018 12:06 pm, edited 3 times in total.
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: Extra_Keys_Example Code : Utilizing your keyboard

Postby J2Kbr » Mon Sep 25, 2017 6:47 pm

:smile0517:
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: Extra_Keys_Example Code : Utilizing your keyboard

Postby yohimbe » Tue Sep 26, 2017 5:24 pm

I wonder how to do this the other way.

Like havong a game with no Controller support on PC an assigning the Key to the PaD?

Or is that impossible?
User avatar
yohimbe
Sergeant Major
Sergeant Major
 
Posts: 84
Joined: Sun Mar 01, 2015 7:27 pm

Re: Extra_Keys_Example Code : Utilizing your keyboard

Postby Scachi » Wed Sep 27, 2017 8:59 pm

yohimbe wrote:I wonder how to do this the other way.

Like havong a game with no Controller support on PC an assigning the Key to the PaD?

Or is that impossible?

I don't think the Titan Two supports "PC Keyboard" as an output option, so you may have to use some pc software for that.
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: Extra_Keys_Example Code : Utilizing your keyboard

Postby Prototype » Thu Sep 28, 2017 5:06 am

The KBM output protocol is in the plans, i remember J2Kbr said he will work on that. For now you have to use a software like Xpadder or joy2key.
Console tuner since my 1st controller.
Scripting, a game in the game.
Believe or dare, It's Titanic! :smile0517:
User avatar
Prototype
Major General
Major General
 
Posts: 3251
Joined: Sun Dec 16, 2012 1:43 pm


Return to User's Script Documentation

Who is online

Users browsing this forum: No registered users and 147 guests