Keys and calling functions via the console

Post » Thu Jun 21, 2012 8:14 pm

I've started tinkering with Papyrus scripting and would be grateful if you kind folks would point to where I can get information on a couple of things:

Adding new keys - is this only possible with SKSE or does CK offer something in this regard?
Handling existing keys - I'd like to change what happens when you press certain keys (like left-click or the Toggle 3rd Person keys).
Functions via the console - is it possible to call a script function from the console?
User avatar
Amy Masters
 
Posts: 3277
Joined: Thu Jun 22, 2006 10:26 am

Post » Thu Jun 21, 2012 2:25 pm

  • Adding new keys: Only possible with SKSE. Currently using IsKeyPressed is the only way, but an OnKeyDown event is on the way evidently.
  • Handling existing keys: With SKSE and/or the in game options, you should be able to rebind however you like.
  • Functions via the console: If you mean Papyrus functions, nope. The console and Papyrus don't talk to each other, so the console is limited to http://www.creationkit.com/Category:Console_Commands.
User avatar
Gill Mackin
 
Posts: 3384
Joined: Sat Dec 16, 2006 9:58 pm

Post » Thu Jun 21, 2012 1:55 pm

  • Handling existing keys: With SKSE and/or the in game options, you should be able to rebind however you like.
That's not what I meant. I meant altering what the button itself does. For a wild example: altering the Toggle 3rd Person button so that it teleports your horse to where you're standing.
User avatar
hannaH
 
Posts: 3513
Joined: Tue Aug 15, 2006 4:50 am

Post » Thu Jun 21, 2012 9:31 pm

You can call functions, but you create a new script each time. You select the object you want to attach the script to and type aps scriptname functionname .

As said it will create a script it won't work with existing ones, but if you just want to test something you are working on it could be handy.
User avatar
Glu Glu
 
Posts: 3352
Joined: Sun Apr 01, 2007 5:39 am

Post » Thu Jun 21, 2012 6:07 pm

You can call functions, but you create a new script each time. You select the object you want to attach the script to and type aps scriptname functionname .

As said it will create a script it won't work with existing ones, but if you just want to test something you are working on it could be handy.
Hmm, I see, and unfortunately no parameters. Well, thanks anyway.
User avatar
herrade
 
Posts: 3469
Joined: Thu Apr 05, 2007 1:09 pm

Post » Thu Jun 21, 2012 1:43 pm

I see that SKSE is the only way to go. Anyone have a link to where IsKeyPressed and all the key codes are documented?
User avatar
Robert Bindley
 
Posts: 3474
Joined: Fri Aug 03, 2007 5:31 pm

Post » Thu Jun 21, 2012 8:34 am

I suppose they will be in the wiki. You can also look on the SKSE added papirus source files.
User avatar
Melly Angelic
 
Posts: 3461
Joined: Wed Aug 15, 2007 7:58 am

Post » Thu Jun 21, 2012 3:25 pm

http://cs.elderscrolls.com/index.php/IsKeyPressed2
http://www.cgl.ucsf.edu/home/tef/wintools/keyview.exe

And the function description from within the SKSE inout.psc:

; returns whether a key is pressedbool Function IsKeyPressed(Int dxKeycode) global native; taps the specified keyFunction TapKey(Int dxKeycode) global native; holds down the specified key until releasedFunction HoldKey(Int dxKeycode) global native; releases the specified keyFunction ReleaseKey(Int dxKeycode) global native; returns whether a key is held;bool Function IsKeyHeld(Int dxKeycode) global native; disables the specified key until enabled again;Function DisableKey(Int dxKeycode) global native; enables a disabled key;Function EnableKey(Int dxKeycode) global native; returns whether a key is disabled;bool Function IsKeyEnabled(Int dxKeycode) global native

Notice that IsKeyPressed acts very picky on toggleable functions like unholster/holster the torch or the toggle console function. You better wait for OnKeyDown as Justin mentioned. Also, console functions:

http://www.creationkit.com/Debug_Script

There's support for toggle menu, instant quit game, toggle collision, toggle god mode and toggle AI.
User avatar
Amy Melissa
 
Posts: 3390
Joined: Fri Jun 23, 2006 2:35 pm

Post » Thu Jun 21, 2012 7:23 am

http://cs.elderscrolls.com/index.php/IsKeyPressed2
http://www.cgl.ucsf.edu/home/tef/wintools/keyview.exe

And the function description from within the SKSE inout.psc:



There's support for toggle menu, instant quit game, toggle collision, toggle god mode and toggle AI.

Thanks Mofakin, that's exactly what I need :)
User avatar
Angus Poole
 
Posts: 3594
Joined: Fri Aug 03, 2007 9:04 pm


Return to V - Skyrim