Jump to content

Trying to simulate a button press / mouse click within a menu


trashgarbage666

Recommended Posts

For the past couple of days, I've been working on a mod that lets you dig graves for dead humanoids and animals. Currently, the corpse disappears and is replaced by a headstone in real time. The process only takes about two seconds. What I'd like is for two in-game hours pass in between the corpse disappearing and the headstone popping into existence. Ideally, It would use the Wait / Sleep Menu so you can watch the hours tick down.

 

So I suppose my goal is to force the Wait Menu to open, then to simulate a left arrow key, and a confirm key. That should set up the correct wait time and begin the wait. At least, that's my guess. I know you can force the Wait Menu to appear with ShowSleepWaitMenu 0, but simulating the key presses is a little outside of my experience.

 

I read somewhere that TapKey can simulate specific keyboard key presses, but I think something that specific might not work for players using a controller or alternate key config. TapControl lets you simulate more generic inputs, like Forward, Backward, Activate, Crouch, etc., but I don't think it has a generic "Confirm" input.

 

I'm also not entirely sure which scripting block I would need to use. Maybe a MenuMode 1012? The portion of my script that swaps the corpse for a headstone is inside a ScriptEffectUpdate.

 

I feel like this question has a lot of ...parts to it. I'm really sorry if this is a difficult one to answer. If you need any clarification at all, just let me know!

 

EDIT: I forgot to mention that JIP NVSE has a command called ClickMenuButton, which simulates clicking specific UI elements.

https://geckwiki.com/index.php/ClickMenuButton

 

The example they provide allegedly uses information gained from highlighting a specific UI element and running GetActiveUIComponentName. I tried using it, but it didn't return anything. :\

Edited by punchbattle
Link to comment
Share on other sites

Unless you are absolutely set on displaying the countdown display of the wait menu, it would seem the use of an IMOD and setting the game hours to have advanced would be easier. See the FO3 thread "Scripting Question: Time advancing". Also the thread "Forcing time to pass" about advancing the day of the week if you're crossing midnight.

 

-Dubious-

Link to comment
Share on other sites

Well since menus have specific keys regardless of a reconfigured keyboard control.

You would use MenuTapKey or MTK for what the menu displays like this , in a quest script I guess ?

Or I guess could be in your effect script ?

 

~~~~~~~~~~~~

 

SCN MyGraveWaitScript

 

Int iGraveDig

 

Begin MenuMode 1012

 

If iGraveDig == 1 ; set this in your effect script , or a different block of it.

 

MTK 205 ; needs any key press to start it working

MTK 205 ; right arrow press

MTK 17 ; W key press

Set iGraveDig to 0

 

endif

End

 

~~~~~~~~~~~~~

 

Of course this probably won't work for someone with controller , but it might ?

I can test it later , or figure out what work around need be done for it.

 

However ... like dubious says , maybe you just want to advance the time with a script , but I'm guessing you would like a cut scene to simulate time passing for the player. Hence you thought to use the wait menu ?

 

So how about play a bink file ? Or just show a custom load screen ?

Link to comment
Share on other sites

You guys are right. It's way, way easier to just play a screen fade and advance the clock manually.

 

SetPCSleepHours likes to give me massive lag every four or five burials, but "Set GameHour to (GameHour + 2)" hasn't caused any problems, so long as I don't cross over into midnight. I'll need to really study NVDLC03ThinkTankDoorSCRIPT to make sure I'm advancing the date under the correct circumstances, though. Wouldn't surprise me if I needed help with that later down the line.

 

But yeah! Things are going smoothly so far, thanks to the suggestions!

 

EDIT: I streamlined the script, and now the lag from SetPCSleepHours is gone! No need to worry about correctly setting the time and date anymore! Do either of you know if a Wait version of the command exists? Since the elapsed time counts as sleep, digging each grave is like letting your character take a power nap. If not, I suppose I could just increase the player's tiredness manually.

Edited by punchbattle
Link to comment
Share on other sites

To the best of my knowledge, tiredness ("fatigue") only applies in "hardcore" mode. You would need to add the "IsHardCore" function and then if applicable adjust the fatigue "actor value" code (22). I would capture the current value before "SetPCSleepHours", and then restore it plus what you think the digging should add. From experience, even in sand (typically only a surface layer) that is hard work for a typical grave "6 feet under".

 

You might also want to determine the "hydration" of the individual before exercise. Those low on hydration are more prone to suffer effects from hard exercise than those adequately hydrated. See the "Boot Camp & Military Fitness Institute" article on "Hydration"; Table 1 in particular.

 

-Dubious-

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...