Hey there,
I have been trying to write a piece of papyrus code that summarizes the currently equipped items of the player. I have a lot of programming experience but I have very little experience with the creation kit so I might be misusing things or solving problems in an overly complex manner. The code uses SKSE by the way.
What the code 'does' is register the left shift key event. When I press the left shift key the player's items are queried one by one with
p.getNthForm(n). The items, which are actually Forms, are then checked for being either armor or ammo and if they are it is checked if the player has them equipped (I hoped on a performance improvement by checking the types first). After that the left and right hand are checked for having a weapon/shield/torch/spell equipped or not and finally I check the shout.
Example output in the debug log is the following:
[04/07/2013 - 12:11:14AM] Items |Apparel: Dawnbreaker|Left hand: Spell - Flames|Right hand: Weapon - Dawnbreaker|Shout: [Shout &--#60; (0002F7BA)&--#62;]|
The problems are that
- The debug.trace function seems to be very unresponsive and a big number of shift presses is skipped. This may be because the script takes long to execute (order of seconds) and stays in the "busy" state.
- The answer is incorrect. I was also wearing apparel and had arrows equipped. They did not show up in this particular debug message when they should have.
I created a quest and attached the script to it. Don't mind the version part, the update function is called from another script in the OnPlayerLoadGame event.
Is there anyone who might be able to help me solve (one of) these problems?
Thanks in advance,
Deazurain
Edited by Deazurain, 08 April 2013 - 10:12 PM.
Sign In
Create Account



Back to top

Terms of Service