Jump to content
Sign in to follow this  
scribe308

F-watch to capture keystrokes

Recommended Posts

Hi all, and especially General Barron!,

I'm trying to use F-watch to capture 3 key strokes for

watch, compass, and map, and a left-mouse for trigger pull and can't figure out the right syntax for the commands in F-watch.

I want to write them as they occur to a file, with the player's position (getPos) and direction (getDir).

I apologize, I'm not a programmer, but I have gotten the basic F-watch items to run that are in the documentation.

There's no other documentation I can find on Fwatch except what came with it.

I'm basically trying to get all these captures in-game and get them written to a file.

Any help on code examples?

Thanks for any info in advance,

Scribe308

Share this post


Link to post
Share on other sites

Hey scribe308! I guess I'll post in this thread since you emailed me it's existance wink_o.gif.

Okay, I'll need to know a little more detail about what you are trying to do/why you are doing it (why write to file?).

But until then, here is the general formula I use when trying to capture keystrokes with Fwatch. The main trick is you use the @ command to make the script wait until the Fwatch 'getkeys' function returns the values you are looking for:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

#Top

@call {_k = call loadfile ":input getkeys"; ({_x in _k} count ["0","1","2","3","4","5","6","7","8","9"]) != 0}

...do stuff...

~0.5

goto "Top"

This example will wait until any of the number keys are pressed (0-9), then it will do something, then it will wait again for those keys. There is a slight delay to allow time for the player's finger to come off the keyboard.

Note that the "call" command will run whatever code is in the { }, and will return the last value that is found in that code. So in this example, the "count" command is the last command in the 'call' code. Count returns a true or false value, so that is returned to the "call" command, which returns it to the @ command.

I've never used Fwatch's mouse functions, but they should work following a similar method.

Again, give some more specifics and we can figure out exactly what you are going to need.

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  

×