IsKeyPressed equipunequip

Post » Thu Jun 21, 2012 10:40 am

No changes were made save the addition of the other hotkeys and the update time bumped up to 0.2 (even 0.5 feels pretty responsive). I'd probably settle on the RegisterForSingleUpdate variant or just update @ *0.2-0.5 intervals so as to not update faster than the engine can toggle a bool.

*Or even 1.0 and tell users to press and momentarily hold the hotkey(s)

I can't wait 'til the input events are available and none of this matters.
User avatar
Becky Cox
 
Posts: 3389
Joined: Thu Jun 22, 2006 8:38 am

Post » Thu Jun 21, 2012 9:35 am

I've set it to 0.1 just for the sake of a better response. You can tell it's safe when trying to hold the button and it doesn't press the key a second time, anything under 0.09 however seems to fast. This might be related to people having different machines?

So what about a standalone release. I'm planning to combine this with the follower hotkeys and release it, or do you wanna do it yourself?
User avatar
BRIANNA
 
Posts: 3438
Joined: Thu Jan 11, 2007 7:51 pm

Post » Thu Jun 21, 2012 4:27 pm

Probably does have a lot to do with one's rig. I'd go with the single update variant if pushing for 0.1, just to be on the safe side.

Standalone: It would need a way to rebind the hotkey and should probably RegisterForUpdate/UnregisterForUpdate when the player has torches/does not have torches. One sec and I'll link what I'd release as a standalone with which you can do as you please.
User avatar
Alex Vincent
 
Posts: 3514
Joined: Thu Jun 28, 2007 9:31 pm

Post » Thu Jun 21, 2012 1:48 pm

Standalone: It would need a way to rebind the hotkey and should probably RegisterForUpdate/UnregisterForUpdate when the player has torches/does not have torches. One sec and I'll link what I'd release as a standalone with which you can do as you please.

Yeah, this is why I defined two torch hotkeys 9 and NUM9. I think most WSAD players will make use of the missing 9 as hotkey. Leftys or old farts like me that are used to arrow keys will use the NUM9 key.

But I agree, being able to manually rebind would be much more comfortable. I think I already put the RegisterForUpdate/UnregisterForUpdate in... :biggrin:

Edit: To late. People will have to wait for updates if something goes wrong...:D

http://skyrim.nexusmods.com/downloads/file.php?id=17507

Should I put anyone in as admin for the Nexus file?
User avatar
casey macmillan
 
Posts: 3474
Joined: Fri Feb 09, 2007 7:37 pm

Post » Thu Jun 21, 2012 1:24 pm

Here's a http://www.mediafire.com/?ji76dcdbf15mzz3 with rebinding built in, SKSE detection/warning if absent.
  • Default Torch Hotkey is '\'.
  • To rebind, hold R-Shift for up to five seconds after loading a save, then follow the prompt(s). The hotkey will start working, if currently applicable, within five seconds after loading this plugin for the first time.
  • Via Player Alias OnItemAdded/Removed events, it will stop/start polling when applicable (torches in inventory or not).
Hotkey Mod:
  • Make sure you label it a beta until it's built with a non-beta SKSE per the SKSE Team's mandate.
  • For HM_HotkeyScript:
    Spoiler
    Event OnUpdate()	If Input.IsKeyPressed(iQuitGameHotkey)		Debug.QuitGame()	ElseIf bMenuHotkeyPressed != Input.IsKeyPressed(iMenuHotkey)		bMenuHotkeyPressed = !bMenuHotkeyPressed		If bMenuHotkeyPressed			Debug.ToggleMenus()		EndIf	ElseIf PlayerREF.GetItemCount(Torch01)		If bTorchHotkeyPressed != Input.IsKeyPressed(iTorchHotkey)			bTorchHotkeyPressed = !bTorchHotkeyPressed			If bTorchHotkeyPressed				bEquipTorch = !bEquipTorch				If bEquipTorch					PlayerREF.EquipItem(Torch01, False, True)				Else					PlayerREF.UnequipItem(Torch01, False, True)				EndIf			EndIf		ElseIf bTorchHotkeyPressed2 != Input.IsKeyPressed(iTorchHotkey2)			bTorchHotkeyPressed2 = !bTorchHotkeyPressed2			If bTorchHotkeyPressed2				bEquipTorch2 = !bEquipTorch2				If bEquipTorch2					PlayerREF.EquipItem(Torch01, False, True)				Else					PlayerREF.UnequipItem(Torch01, False, True)				EndIf			EndIf		EndIf	EndIfEndEvent
    ...would be 'cheaper' using the PlayerREF property and checking for torches only once per iteration. '> 0' instances were unnecessary.
  • Just a thought, but go ahead and use the rebinding stuff if you want, then you could remove the extraneous torch hotkey as there should really only be one needed if it's rebindable and yanking the second would also reduce its expense.
  • Torch equipping/unequipping made silent.
  • Still, you might want to go the RegisterForSingleUpdate route or slow it down a bit.
User avatar
Mariaa EM.
 
Posts: 3347
Joined: Fri Aug 10, 2007 3:28 am

Post » Thu Jun 21, 2012 5:13 pm

Thanks for adding me to credits! Don't think I deserve it as I mostly just annoyed Justin. :bunny:

This is a good idea though. I was talking with a friend a bit ago who plays melee but would try a caster out if there were more keybinds available. Is it possible to bind a key to a user-selected spell?
User avatar
Angela Woods
 
Posts: 3336
Joined: Fri Feb 09, 2007 2:15 pm

Post » Thu Jun 21, 2012 5:23 am

Here's a http://www.mediafire.com/?ji76dcdbf15mzz3 with rebinding built in, SKSE detection/warning if absent.
  • Default Torch Hotkey is '\'.
  • To rebind, hold R-Shift for up to five seconds after loading a save, then follow the prompt(s). The hotkey will start working, if currently applicable, within five seconds after loading this plugin for the first time.
  • Via Player Alias OnItemAdded/Removed events, it will stop/start polling when applicable (torches in inventory or not).
Hotkey Mod:
  • Make sure you label it a beta until it's built with a non-beta SKSE per the SKSE Team's mandate.
  • For HM_HotkeyScript:
    Spoiler
    Event OnUpdate()	If Input.IsKeyPressed(iQuitGameHotkey)		Debug.QuitGame()	ElseIf bMenuHotkeyPressed != Input.IsKeyPressed(iMenuHotkey)		bMenuHotkeyPressed = !bMenuHotkeyPressed		If bMenuHotkeyPressed			Debug.ToggleMenus()		EndIf	ElseIf PlayerREF.GetItemCount(Torch01)		If bTorchHotkeyPressed != Input.IsKeyPressed(iTorchHotkey)			bTorchHotkeyPressed = !bTorchHotkeyPressed			If bTorchHotkeyPressed				bEquipTorch = !bEquipTorch				If bEquipTorch					PlayerREF.EquipItem(Torch01, False, True)				Else					PlayerREF.UnequipItem(Torch01, False, True)				EndIf			EndIf		ElseIf bTorchHotkeyPressed2 != Input.IsKeyPressed(iTorchHotkey2)			bTorchHotkeyPressed2 = !bTorchHotkeyPressed2			If bTorchHotkeyPressed2				bEquipTorch2 = !bEquipTorch2				If bEquipTorch2					PlayerREF.EquipItem(Torch01, False, True)				Else					PlayerREF.UnequipItem(Torch01, False, True)				EndIf			EndIf		EndIf	EndIfEndEvent
    ...would be 'cheaper' using the PlayerREF property and checking for torches only once per iteration. '> 0' instances were unnecessary.
  • Just a thought, but go ahead and use the rebinding stuff if you want, then you could remove the extraneous torch hotkey as there should really only be one needed if it's rebindable and yanking the second would also reduce its expense.
  • Torch equipping/unequipping made silent.
  • Still, you might want to go the RegisterForSingleUpdate route or slow it down a bit.

Will do so.

Thanks for adding me to credits! Don't think I deserve it as I mostly just annoyed Justin. :bunny:

This is a good idea though. I was talking with a friend a bit ago who plays melee but would try a caster out if there were more keybinds available. Is it possible to bind a key to a user-selected spell?

You call it annoyance, I name it motivation...:D

I've made an http://www.gamesas.com/topic/1375958-relhotkey-mod/ to pull the development out of this discussion.
User avatar
Robert Jackson
 
Posts: 3385
Joined: Tue Nov 20, 2007 12:39 am

Post » Thu Jun 21, 2012 7:05 pm

Everything runs smooth. However, redefining keys doesn't seem to work. I've tried on savegame and on newgame, all I get is the sticky function from my keyboard. Might wanna replace the redefining key?

Edit: I've tested with your plugin first.
User avatar
Madison Poo
 
Posts: 3414
Joined: Wed Oct 24, 2007 9:09 pm

Post » Thu Jun 21, 2012 6:28 am

Ah, good call about the sticky keys feature and R-Shift. I've got that turned off, but... Wish I'd thought of that before making a mini RELZ for a stand alone http://www.gamesas.com/topic/1375971-relz-torch-hotkey/.

http://www.mediafire.com/?jajc7wpd9d10lqq: went with '=' instead.
User avatar
Pumpkin
 
Posts: 3440
Joined: Sun Jun 25, 2006 10:23 am

Post » Thu Jun 21, 2012 3:46 am

Ah, good call about the sticky keys feature and R-Shift. I've got that turned off, but... Wish I'd thought of that before making a mini RELZ for a stand alone http://www.gamesas.com/topic/1375971-relz-torch-hotkey/.

http://www.mediafire.com/?jajc7wpd9d10lqq: went with '=' instead.

Yup, it's working now. There seems to be an inequality between http://cs.elderscrolls.com/index.php/IsKeyPressed2 and German keyboard layout. I was trying h key, and it didn't worked at all. I think I'm putting it on one of the F1-F12 keys. They all seem to get a working response.
User avatar
Heather Dawson
 
Posts: 3348
Joined: Sun Oct 15, 2006 4:14 pm

Post » Thu Jun 21, 2012 4:43 am

Justin, did you tested and debugged your rebind function? This seems to be working only once shortly after the game is loaded. At least that was what it did for me. I've fixed it with using Game.GetPlayer() and put in an additional UnregisterForUpdate:

Event OnUpdate()	;If bGetGameLoaded(); <---------------------- This lets you rebind the key only once shortly after the game has loaded	If Game.GetPlayer(); <----------------------- Checks for player		;Debug.MessageBox("HotkeyMod enabled."); <---------------- My debug notification to get to the source of problem		Float fSKSE = SKSE.GetVersion() + SKSE.GetVersionMinor() * 0.01 + SKSE.GetVersionBeta() * 0.0001		If fSKSE >= 1.0502			PlayerAliasScript.Quickening()			If Input.IsKeyPressed(35)				UnregisterForUpdate(); <------------------ unregisters after key is pressed, so that you won't get multiple threads				;Debug.MessageBox("Key h is pressed."); <---------------------- another debug				PlayerAliasScript.iTorchHotkey = 0				Debug.Notification("Press and hold an unused key...")				Utility.Wait(1)				Int iDXScanCode = 0				While !Input.IsKeyPressed(iDXScancode)					iDXScancode += 1					If iDXScancode == 265						iDXScancode = 1						Debug.Notification("Press and hold an unused key...")					EndIf				EndWhile				PlayerAliasScript.iTorchHotkey = iDXScancode				Debug.Notification("New key selected: " + PlayerAliasScript.iTorchHotkey)			EndIf			RegisterForUpdate(5); <----------------- register again to make the OnUpdate event block working again		Else			PlayerAlias.UnregisterForUpdate()			PlayerAliasScript.bQuickening = False			Debug.MessageBox("Torch Hotkey requires Skyrim Script Extender v1.5.2 or higher.")		EndIf	EndIfEndEvent
User avatar
Daniel Lozano
 
Posts: 3452
Joined: Fri Aug 24, 2007 7:42 am

Post » Thu Jun 21, 2012 12:00 pm

Justin, did you tested and debugged your rebind function? This seems to be working only once shortly after the game is loaded. At least that was what it did for me. I've fixed it with using Game.GetPlayer() and put in an additional UnregisterForUpdate:
That's intentional. It ensures the mod only claims one key and reduces the amount of code running. It's easy enough to save, load, rebind and this way it's not eating resources and perpetually running the maintenance code. For a mod with an options menu, like Bag of Holding, I set up rebinding as one of the options.

The GetGameLoaded check has a purpose, suffice it to say.

If you're gonna use the rebinding code for multiple keys, make it a function and...
Event SomeEvent()	iSomeHotkey = 0	Utility.Wait(1)	iSomeHotkey = iGetKeyPressed()	Debug.Notification("New key selected: " + iSomeHotkey)EndEventInt Function iGetKeyPressed(Int aiDXScanCode = 1)	Debug.Notification("Press and hold an unused key...")	While !Input.IsKeyPressed(aiDXScancode)		aiDXScancode += 1		If aiDXScancode == 265			aiDXScancode = 1			Debug.Notification("Press and hold an unused key...")		EndIf	EndWhile	Return aiDXScanCodeEndFunction
User avatar
SaVino GοΜ
 
Posts: 3360
Joined: Mon Sep 17, 2007 8:00 pm

Post » Thu Jun 21, 2012 7:13 am

That's intentional. It ensures the mod only claims one key and reduces the amount of code running. It's easy enough to save, load, rebind and this way it's not eating resources and perpetually running the maintenance code. For a mod with am options menu, like Bag of Holding, I set up rebinding as one of the options.

Oh ok. That's true. But then you should discribe more in detail how this is working only once after you load the game. It took me about an hour to understand that this is only working once after loading. I thought it was working always.

But is it safe the way I do it?
User avatar
Bloomer
 
Posts: 3435
Joined: Sun May 27, 2007 9:23 pm

Post » Thu Jun 21, 2012 3:22 pm

It's all maintenance code (stuff that shouldn't be running perpetually). If you want stuff to run perpetually after a save is loaded, just add an 'Else' to hinge the other code on.
	If bGetGameLoaded()		; Maintenance code that runs once per save load	Else		; Reiterating, normal code	EndIf

GetGameLoaded: The function emulates *SE's http://cs.elderscrolls.com/index.php/GetGameLoaded, taking advantage of one of the "obsolete" actor values which are not stored in saves.

Bool Function bGetGameLoaded()	If SomeActorFromYourMod.GetActorValue("BrainCondition") ; Initializes at 100		SomeActorFromYourMod.SetActorValue("BrainCondition", 0) ; This does not stick to a save		Return True	Else		Return False	EndIfEndFunction
User avatar
Emmi Coolahan
 
Posts: 3335
Joined: Wed Jan 24, 2007 9:14 pm

Post » Thu Jun 21, 2012 2:46 pm

I think the safest way for me to configure multiple keys then is doing it menu based. I would need to define a rebind key for every hotkey I'm defining...that could lead to some serious head ache, I guess?
User avatar
Amber Hubbard
 
Posts: 3537
Joined: Tue Dec 05, 2006 6:59 pm

Post » Thu Jun 21, 2012 6:14 am

Have http://www.creationkit.com/Options_Menu.
User avatar
louise tagg
 
Posts: 3394
Joined: Sun Aug 06, 2006 8:32 am

Post » Thu Jun 21, 2012 4:52 am

Have http://www.creationkit.com/Options_Menu.

Menu based works perfectly.

Only problem I have is when trying to rebind the instant quit game key. Guess what happens once it's rebound. It does instant quit. So I think I'll need to leave that one out, or maybe put an RegisterForUpdate(3) in front of it, so users have 3 seconds time before the quit game gets fired... :biggrin:

Edit: Working great so far. But one little irritation. I've freezed the game a copple of times when I was doing reconfigure and script from other mods in the background were loading. Usually this resulted in a game freeze that I could not even exit with task manager. It seems like this is always going to happen when the game is busy doing intensive scripting in the background. So is there a way to "pause" the script as long as other are loading in the background, or mabe not even make it work as long as there is a certain amount of scripts running in the background? Some gimmicks:

http://imageshack.us/photo/my-images/27/2012052300041.jpg/

The scripts so far. I've also managed to merge the follower hotkey and normal hotkey script, so this should also do a lot for streamlining.

Spoiler
Scriptname HM_PlayerAliasScript  extends ReferenceAliasBool bEquipTorchBool bTorchHotkeyPressedBool bToggleMenuHotkeyPressedBool bQuitGameHotkeyPressedBool bCommandHotkeyPressedBool bTradeHotkeyPressedActor Property PlayerREF AutoBool Property bQuickening AutoInt Property iTorchCount AutoInt Property iTorchHotkey Auto ConditionalInt Property iToggleMenuHotkey Auto ConditionalInt Property iQuitGameHotkey Auto ConditionalInt Property iTradeHotkey Auto ConditionalInt Property iCommandHotkey Auto ConditionalLight Property Torch01 AutoGlobalVariable Property HM_FollowerHotkeyTrade AutoGlobalVariable Property HM_FollowerHotkeyCommand AutoActor Property SvenREF AutoActor Property FaendalREF AutoActor Property AnnekkeREF AutoActor Property BenorREF AutoActor Property BorgakhREF AutoActor Property BrelynaMaryonRef AutoActor Property AraneaREF AutoActor Property DerkeethusREF AutoActor Property illiaRef AutoActor Property EolaREF AutoActor Property ErandurRef AutoActor Property GhorbashREF AutoActor Property GolldirRef AutoActor Property HirelingBelrandRef AutoActor Property HirelingEriktheSlayerref AutoActor Property HirelingJenassaREF AutoActor Property HirelingMarcurioRef AutoActor Property HirelingStenvarRef AutoActor Property HirelingVorstagRef AutoActor Property HousecarlMarkarthRef AutoActor Property HousecarlRiftenRef AutoActor Property HousecarlSolitudeRef AutoActor Property HousecarlWhiterunRef AutoActor Property HousecarlWindhelmRef AutoActor Property JzargoRef AutoActor Property KharjoREF AutoActor Property LobRef AutoActor Property OgolRef AutoActor Property RiaREF AutoActor Property RoggiREF AutoActor Property TorvarREF AutoActor Property UgorRef AutoActor Property AdelaisaREF AutoActor Property AhtarREF AutoActor Property CosnachREF AutoActor Property MjollRef AutoActor Property UthgerdRef AutoFaction Property CurrentFollowerFaction AutoEvent OnUpdate()	If bTorchHotkeyPressed != Input.IsKeyPressed(iTorchHotkey)		bTorchHotkeyPressed = !bTorchHotkeyPressed		If bTorchHotkeyPressed			bEquipTorch = !bEquipTorch			If bEquipTorch				PlayerREF.EquipItem(Torch01, False, True)			Else				PlayerREF.UnequipItem(Torch01, False, True)			EndIf		EndIf		RegisterForUpdate(0.1)	ElseIf bQuickening		RegisterForUpdate(0.1)	EndIf	If bToggleMenuHotkeyPressed !=Input.IsKeyPressed(iToggleMenuHotkey)		bToggleMenuHotkeyPressed = !bToggleMenuHotkeyPressed		If bToggleMenuHotkeyPressed			Debug.ToggleMenus()		EndIf	EndIf	If bQuitGameHotkeyPressed !=Input.IsKeyPressed(iQuitGameHotkey)		bQuitGameHotkeyPressed = !bQuitGameHotkeyPressed		If bQuitGameHotkeyPressed			Debug.QuitGame()		EndIf	EndIf	If bTradeHotkeyPressed != Input.IsKeyPressed(iTradeHotkey)		bTradeHotkeyPressed = !bTradeHotkeyPressed		If bTradeHotkeyPressed			Trading()		EndIf	EndIf	If bCommandHotkeyPressed != Input.IsKeyPressed(iCommandHotkey)		bCommandHotkeyPressed = !bCommandHotkeyPressed		If bCommandHotkeyPressed			Command()		EndIf	EndIfEndEventEvent OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akFormReference, ObjectReference akSourceContainer)	Quickening()EndEventEvent OnItemRemoved(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)	Quickening()EndEventFunction Quickening()	iTorchCount = GetActorReference().GetItemCount(Torch01)	If bQuickening != iTorchCount As Bool		bQuickening = !bQuickening		If bQuickening			RegisterForUpdate(0.1)		Else			UnregisterForUpdate()		EndIf	EndIf	EndFunctionFunction Trading()	RegisterForUpdate(1)	If (SvenREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(SvenREF) <= 150		SvenREF.OpenInventory()	ElseIf (FaendalREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(FaendalREF) <= 150		FaendalREF.OpenInventory()			ElseIf (AnnekkeREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(AnnekkeREF) <= 150		AnnekkeREF.OpenInventory()	ElseIf (BenorREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(BenorREF) <= 150		BenorREF.OpenInventory()	ElseIf (BorgakhREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(BorgakhREF) <= 150		BorgakhREF.OpenInventory()	ElseIf (BrelynaMaryonRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(BrelynaMaryonRef) <= 150		BrelynaMaryonRef.OpenInventory()	ElseIf (AraneaREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(AraneaREF) <= 150		AraneaREF.OpenInventory()	ElseIf (DerkeethusREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(DerkeethusREF) <= 150		DerkeethusREF.OpenInventory()	ElseIf (illiaRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(illiaRef) <= 150		illiaRef.OpenInventory()	ElseIf (EolaREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(EolaREF) <= 150		EolaREF.OpenInventory()	ElseIf (ErandurRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(ErandurRef) <= 150		ErandurRef.OpenInventory()	ElseIf (GhorbashREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(GhorbashREF) <= 150		GhorbashREF.OpenInventory()	ElseIf (GolldirRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(GolldirRef) <= 150		GolldirRef.OpenInventory()	ElseIf (HirelingBelrandRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(HirelingBelrandRef) <= 150		HirelingBelrandRef.OpenInventory()	ElseIf (HirelingEriktheSlayerref.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(HirelingEriktheSlayerref) <= 150		HirelingEriktheSlayerref.OpenInventory()	ElseIf (HirelingJenassaREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(HirelingJenassaREF) <= 150		HirelingJenassaREF.OpenInventory()	ElseIf (HirelingMarcurioRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(HirelingMarcurioRef) <= 150		HirelingMarcurioRef.OpenInventory()	ElseIf (HirelingStenvarRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(HirelingStenvarRef) <= 150		HirelingStenvarRef.OpenInventory()	ElseIf (HirelingVorstagRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(HirelingVorstagRef) <= 150		HirelingVorstagRef.OpenInventory()	ElseIf (HousecarlMarkarthRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(HousecarlMarkarthRef) <= 150		HousecarlMarkarthRef.OpenInventory()	ElseIf (HousecarlRiftenRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(HousecarlRiftenRef) <= 150		HousecarlRiftenRef.OpenInventory()	ElseIf (HousecarlSolitudeRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(HousecarlSolitudeRef) <= 150		HousecarlSolitudeRef.OpenInventory()	ElseIf (HousecarlWhiterunRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(HousecarlWhiterunRef) <= 150		HousecarlWhiterunRef.OpenInventory()	ElseIf (HousecarlWindhelmRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(HousecarlWindhelmRef) <= 150		HousecarlWindhelmRef.OpenInventory()	ElseIf (JzargoRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(JzargoRef) <= 150		JzargoRef.OpenInventory()	ElseIf (KharjoREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(KharjoREF) <= 150		KharjoREF.OpenInventory()	ElseIf (LobRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(LobRef) <= 150		LobRef.OpenInventory()	ElseIf (OgolRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(OgolRef) <= 150		OgolRef.OpenInventory()	ElseIf (RiaREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(RiaREF) <= 150		RiaREF.OpenInventory()	ElseIf (RoggiREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(RoggiREF) <= 150		RoggiREF.OpenInventory()	ElseIf (TorvarREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(TorvarREF) <= 150		TorvarREF.OpenInventory()	ElseIf (UgorRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(UgorRef) <= 150		UgorRef.OpenInventory()	ElseIf (AdelaisaREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(AdelaisaREF) <= 150		AdelaisaREF.OpenInventory()	ElseIf (AhtarREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(AhtarREF) <= 150		AhtarREF.OpenInventory()	ElseIf (CosnachREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(CosnachREF) <= 150		CosnachREF.OpenInventory()	ElseIf (MjollRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(MjollRef) <= 150		MjollRef.OpenInventory()	ElseIf (UthgerdRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(UthgerdRef) <= 150		UthgerdRef.OpenInventory()	EndIfEndFunctionFunction Command()	RegisterForUpdate(1)	If (SvenREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(SvenREF) <= 500		SvenREF.SetDoingFavor()	ElseIf (FaendalREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(FaendalREF) <= 500		FaendalREF.SetDoingFavor()			ElseIf (AnnekkeREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(AnnekkeREF) <= 500		AnnekkeREF.SetDoingFavor()	ElseIf (BenorREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(BenorREF) <= 500		BenorREF.SetDoingFavor()	ElseIf (BorgakhREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(BorgakhREF) <= 500		BorgakhREF.SetDoingFavor()	ElseIf (BrelynaMaryonRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(BrelynaMaryonRef) <= 500		BrelynaMaryonRef.SetDoingFavor()	ElseIf (AraneaREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(AraneaREF) <= 500		AraneaREF.SetDoingFavor()	ElseIf (DerkeethusREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(DerkeethusREF) <= 500		DerkeethusREF.SetDoingFavor()	ElseIf (illiaRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(illiaRef) <= 500		illiaRef.SetDoingFavor()	ElseIf (EolaREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(EolaREF) <= 500		EolaREF.SetDoingFavor()	ElseIf (ErandurRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(ErandurRef) <= 500		ErandurRef.SetDoingFavor()	ElseIf (GhorbashREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(GhorbashREF) <= 500		GhorbashREF.SetDoingFavor()	ElseIf (GolldirRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(GolldirRef) <= 500		GolldirRef.SetDoingFavor()	ElseIf (HirelingBelrandRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(HirelingBelrandRef) <= 500		HirelingBelrandRef.SetDoingFavor()	ElseIf (HirelingEriktheSlayerref.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(HirelingEriktheSlayerref) <= 500		HirelingEriktheSlayerref.SetDoingFavor()	ElseIf (HirelingJenassaREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(HirelingJenassaREF) <= 500		HirelingJenassaREF.SetDoingFavor()	ElseIf (HirelingMarcurioRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(HirelingMarcurioRef) <= 500		HirelingMarcurioRef.SetDoingFavor()	ElseIf (HirelingStenvarRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(HirelingStenvarRef) <= 500		HirelingStenvarRef.SetDoingFavor()	ElseIf (HirelingVorstagRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(HirelingVorstagRef) <= 500		HirelingVorstagRef.SetDoingFavor()	ElseIf (HousecarlMarkarthRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(HousecarlMarkarthRef) <= 500		HousecarlMarkarthRef.SetDoingFavor()	ElseIf (HousecarlRiftenRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(HousecarlRiftenRef) <= 500		HousecarlRiftenRef.SetDoingFavor()	ElseIf (HousecarlSolitudeRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(HousecarlSolitudeRef) <= 500		HousecarlSolitudeRef.SetDoingFavor()	ElseIf (HousecarlWhiterunRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(HousecarlWhiterunRef) <= 500		HousecarlWhiterunRef.SetDoingFavor()	ElseIf (HousecarlWindhelmRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(HousecarlWindhelmRef) <= 500		HousecarlWindhelmRef.SetDoingFavor()	ElseIf (JzargoRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(JzargoRef) <= 500		JzargoRef.SetDoingFavor()	ElseIf (KharjoREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(KharjoREF) <= 500		KharjoREF.SetDoingFavor()	ElseIf (LobRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(LobRef) <= 500		LobRef.SetDoingFavor()	ElseIf (OgolRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(OgolRef) <= 500		OgolRef.SetDoingFavor()	ElseIf (RiaREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(RiaREF) <= 500		RiaREF.SetDoingFavor()	ElseIf (RoggiREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(RoggiREF) <= 500		RoggiREF.SetDoingFavor()	ElseIf (TorvarREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(TorvarREF) <= 500		TorvarREF.SetDoingFavor()	ElseIf (UgorRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(UgorRef) <= 500		UgorRef.SetDoingFavor()	ElseIf (AdelaisaREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(AdelaisaREF) <= 500		AdelaisaREF.SetDoingFavor()	ElseIf (AhtarREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(AhtarREF) <= 500		AhtarREF.SetDoingFavor()	ElseIf (CosnachREF.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(CosnachREF) <= 500		CosnachREF.SetDoingFavor()	ElseIf (MjollRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(MjollRef) <= 500		MjollRef.SetDoingFavor()	ElseIf (UthgerdRef.GetFactionRank(CurrentFollowerFaction) >= 0) && Game.GetPlayer().GetDistance(UthgerdRef) <= 500		UthgerdRef.SetDoingFavor()	EndIfEndFunction

Spoiler
Scriptname HM_HotkeyScript extends Quest Conditional{Hotkey Script for your pleasure}; This script has been developed by JustinOther and rongphale and Aenara and Ingenue and AmethystDeciver, oh crab the whole offcial forum took part in it, I'm just the [censored] uploading it!!!; Shall be improved and streamlined in future.; Chicken alias...yeah funny...took me a minute to understand what that was...it's early in the morning...:DLight Property Torch01 AutoReferenceAlias Property ChickenAlias AutoReferenceAlias Property PlayerAlias AutoHM_PlayerAliasScript Property PlayerAliasScript AutoMessage Property HM_ConfigureMenu AutoEvent OnInit()    ChickenAlias.GetActorReference().SetScale(0)    ChickenAlias.GetActorReference().EnableAI(False)    ChickenAlias.GetActorReference().Enable()    PlayerAlias.AddInventoryEventFilter(Torch01)    RegisterForUpdate(1)EndEventEvent OnUpdate()    DebugMessage()    If Game.GetPlayer()    Float fSKSE = SKSE.GetVersion() + SKSE.GetVersionMinor() * 0.01 + SKSE.GetVersionBeta() * 0.0001        If fSKSE >= 1.0502            PlayerAliasScript.Quickening()            If Input.IsKeyPressed(65)                UnregisterForUpdate()                Int iButton = HM_ConfigureMenu.Show()                If (iButton == 0)                    PlayerAliasScript.iTorchHotkey = 0                    Debug.Notification("Press and hold an unused key...")                    Utility.Wait(1)                    Int iDXScanCode = 0                    While !Input.IsKeyPressed(iDXScancode)                        iDXScancode += 1                        If iDXScancode == 265                            iDXScancode = 1                        EndIf                    EndWhile                    PlayerAliasScript.iTorchHotkey = iDXScancode                    Debug.MessageBox("New key selected(DXcode): " + PlayerAliasScript.iTorchHotkey)                ElseIf (iButton == 1)                    PlayerAliasScript.iToggleMenuHotkey = 0                    Debug.Notification("Press and hold an unused key...")                    Utility.Wait(1)                    Int iDXScanCode = 0                    While !Input.IsKeyPressed(iDXScancode)                        iDXScancode += 1                        If iDXScancode == 265                            iDXScancode = 1                        EndIf                    EndWhile                    PlayerAliasScript.iToggleMenuHotkey = iDXScancode                    Debug.MessageBox("New key selected(DXcode): " + PlayerAliasScript.iToggleMenuHotkey)                ElseIf (iButton == 2)                    PlayerAliasScript.iTradeHotkey = 0                    Debug.Notification("Press and hold an unused key...")                    Utility.Wait(1)                    Int iDXScanCode = 0                    While !Input.IsKeyPressed(iDXScancode)                        iDXScancode += 1                        If iDXScancode == 265                            iDXScancode = 1                        EndIf                    EndWhile                    PlayerAliasScript.iTradeHotkey = iDXScancode                    Debug.MessageBox("New key selected(DXcode): " + PlayerAliasScript.iTradeHotkey)                ElseIf (iButton == 3)                    PlayerAliasScript.iCommandHotkey = 0                    Debug.Notification("Press and hold an unused key...")                    Utility.Wait(1)                    Int iDXScanCode = 0                    While !Input.IsKeyPressed(iDXScancode)                        iDXScancode += 1                        If iDXScancode == 265                            iDXScancode = 1                        EndIf                    EndWhile                    PlayerAliasScript.iCommandHotkey = iDXScancode                    Debug.MessageBox("New key selected(DXcode): " + PlayerAliasScript.iCommandHotkey)                EndIf                RegisterForUpdate(1)            EndIf        Else            PlayerAlias.UnregisterForUpdate()            PlayerAliasScript.bQuickening = False            Debug.Notification("Hotkey Mod requires Skyrim Script Extender v1.5.2 or higher.")        EndIf    EndIfEndEventBool Function bGetGameLoaded()    If ChickenAlias.GetActorReference().GetActorValue("BrainCondition")        ChickenAlias.GetActorReference().SetActorValue("BrainCondition", 0)        Return True    Else        Return False    EndIfEndFunctionFunction DebugMessage()    If bGetGameLoaded()    Float fSKSE = SKSE.GetVersion() + SKSE.GetVersionMinor() * 0.01 + SKSE.GetVersionBeta() * 0.0001        If fSKSE >= 1.0502        Debug.Notification("Hotkey Mod Version 0.2 active!")        EndIf    EndIfEndFunction

Edit2: Fixed the freezing bug. I've put an fucntion directly after = instead of leaving one space free.
User avatar
Amy Siebenhaar
 
Posts: 3426
Joined: Fri Aug 10, 2007 1:51 am

Previous

Return to V - Skyrim