Jump to content
Sign in to follow this  
chris330

Reading external inputs

Recommended Posts

I'll keep this short and sweet.

Is it possible to read in analogue inputs from a joystick and digital ones like from a keyboard for example and have a script or function run in Flashpoint as a result of the input's value/status.

Like could I configure my own response to a movement on the joystick?

Out of my depth here chaps, so thought I'd best ask thanks smile_o.gif

Share this post


Link to post
Share on other sites

Enter Kegetys Fwatch, one of the most powerful and under-used scripting aids for OFP:

http://ofp.gamepark.cz/index.php?showthis=8361

Fwatch can't detect joystick input AFAIK, but it can *kinda* detect mouse movement. Detecting keyboard input is easy enough though. Below is a template of a simple keyboard input script I've made for my handsignals mod (link in my sig). It should make sense after you read the Fwatch documentation.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">;Keyboard input detection script template. This script should be started from init.sqs. Requires Kegetys Fwatch.

_k = []

#Top

@call {_k = call loadfile ":input getkeys"; ({_x in _k} count ["1","2","3","A","B","C"]) != 0}

;check which number key was pressed

? "1" in _k : (do something); goto "Wait"

? "2" in _k : (do something); goto "Wait"

? "3" in _k : (do something); goto "Wait"

? "A" in _k : (do something); goto "Wait"

? "B" in _k : (do something); goto "Wait"

? "C" in _k : (do something); goto "Wait"

...etc

#Wait

~0.5 * accTime

goto "Top"

List of all keys detectable by fwatch (and the name returned):

A-Z, 0-9, F1-F12, NUMPAD0-NUMPAD9,

TAB, CAPSLOCK, SPACE, ALT, CTRL, SHIFT, BACKSPACE, ENTER,

DELETE, INSERT, END, HOME, PAGEDOWN, PAGEUP,

UP, DOWN, LEFT, RIGHT (arrow keys),

SUBTRACT, ADD, DIVIDE, DECIMAL, SELECT (math operations on numberpad).

Share this post


Link to post
Share on other sites

Awesome smile_o.gif Thanks for the reply.

So it looks like it is possible for me to make a plane fly the way I want it to using the keyboard to increment the throttle. I wouldn't need the utility to detect joystick movement as the game does this anyway for roll and pitch.

This means that with some scripting I can have planes fly realistically in a realistically powered fashion rather than only just scraping over mountains on full throttle after a diving run and constantly having to pump the thottle key during a landing to maintain a set speed. Should be a doddle with the help of the setvelocity command and a quick assessment of the plane's weight.

Incredible utility. Anyone know if it's possible to turn off the auto-reaction to terrain height the likes of which you get in helicopters?

Won't be doing anything just yet as I'm far too interested in getting AI chaps to naturally move around the inside of buildings but it's defo something I'm going to move onto.

Share this post


Link to post
Share on other sites

Just one question General Barron, where can I get your hand signals project from? It sounds most interesting indeed and is something I'd love to have a look at smile_o.gif

Share this post


Link to post
Share on other sites
Just one question General Barron, where can I get your hand signals project from? It sounds most interesting indeed and is something I'd love to have a look at smile_o.gif

I'm a blatant self-promoter, so the link is in my signature. smile_o.gif But I'll post it here as well:

http://www.flashpoint1985.com/cgi-bin....t=48000

If you depbo it and poke around inside, feel free to PM/email me with any Q's about this or that.

Share this post


Link to post
Share on other sites

Lol don't be worried about self-promoting. Remember mate we do this for free and a great piece of work has every right to be touted a little!

Thanks for the link wink_o.gif

**Edit**

Rock on baby that looks the business! Now ArmA has taken all the attention elsewhere I wanted to see just what can be done with Flashpoint and I'm especially enthusiastic now the limelight has shifted elsewhere, it's just the kind of person I am. It won't be for a bit yet, but if it's okay I'd really like to implement this into a MOD project I'm working to try and fix all the things about the game I didn't like, such as poor AI navigation in enclosed spaces and dumb AI behaviour at times.

As a rogue observation, I reckon even swimming underwater could be implemented with the use of a specially made map and the Fwatch thing along with some new anims and a very accurate and reliable setvelocity loop. I reckon to be honest you could pretty much turn Flashpoint into whatever you wanted with virtually no limitations.

Selfish though it may sound I'd rather just work on this alone and cherry pick high calibre work by other people that I think would either save alot of time, or just be too good for me to improve on. Working with other people in a MOD group just doesn't suit me and I lose interest fast, I just like to work at my own pace over long periods of time. Your hand signal MOD is a must have inclusion for my MOD as it's so damn good.

Thanks for pointing it in my direction. Just one thing though I can't download the voices to go with it as the links are bust. Also did you fix it so the AI can simulate using this method of squad command?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×