Jump to content

Huillam

Premium Member
  • Posts

    15
  • Joined

  • Last visited

Posts posted by Huillam

  1. Thanks to you things make sense to me.

     

    There's still one last issue: the keys need to be deactivated in some occasion (mostly while menus are opened).

    I came with this (slightly altered piece of code from frostfall):

    Event OnKeyDown(int code)
    {The real work of making the hotkey work like the matching powers is very simple.}
    	if UI.IsMenuOpen("Console") || UI.IsMenuOpen("Book Menu") || UI.IsMenuOpen("BarterMenu") || UI.IsMenuOpen("ContainerMenu") || UI.IsMenuOpen("Crafting Menu") || UI.IsMenuOpen("Dialogue Menu") || UI.IsMenuOpen("FavoritesMenu") || UI.IsMenuOpen("InventoryMenu") || UI.IsMenuOpen("Journal Menu") || UI.IsMenuOpen("Lockpicking Menu") || UI.IsMenuOpen("MagicMenu") || UI.IsMenuOpen("MapMenu") || UI.IsMenuOpen("MessageBoxMenu") || UI.IsMenuOpen("Sleep/Wait Menu") || UI.IsMenuOpen("StatsMenu")
    		return
    	else
    		SitPower[SitKey.Find(code)].Cast(PlayerRef)	
    	endif
    EndEvent
    Is this correct? I'm asking because Chesko's code looks like this:

    Event OnKeyDown(int keyCode)
    	if UI.IsMenuOpen("Console") || UI.IsMenuOpen("Book Menu") || UI.IsMenuOpen("BarterMenu") || UI.IsMenuOpen("ContainerMenu") || UI.IsMenuOpen("Crafting Menu") || UI.IsMenuOpen("Dialogue Menu") || UI.IsMenuOpen("FavoritesMenu") || UI.IsMenuOpen("InventoryMenu") || UI.IsMenuOpen("Journal Menu") || UI.IsMenuOpen("Lockpicking Menu") || UI.IsMenuOpen("MagicMenu") || UI.IsMenuOpen("MapMenu") || UI.IsMenuOpen("MessageBoxMenu") || UI.IsMenuOpen("Sleep/Wait Menu") || UI.IsMenuOpen("StatsMenu")
    		return
    	endif
    	if keyCode == _Frost_HotkeyWeathersense.GetValueInt()
    		_Frost_Weathersense_Spell.Cast(PlayerRef)
    	endif
    EndEvent
    I've tried to stay as close as possible to his code (contrary to me he probably knows what he's doing) but using the same syntax ("if, endif, if, endif" instead of "if, else, endif") but then the script failed to compile. He uses int keycode instead of int code which may explain everything.
  2. That's probably some stupid questions (and assertions) but meh.

    Regarding the things that are supposed to be filled in the CK:

    ModName and PlayerRef were easy enough and should be ok.

    SitPower use the FormID of the spells from the mod.

     

    For SitKeyDefault I'm a bit puzzled: It follows the same order that than SitPower but is that enough for key X to be assigned by default to spell[0] and key Y to spell[1] or is there something I missed?

    Is GetModByName a property that I'm supposed to add to my script?

     

    Am I supposed to add that block of code to my script in addition to the properties? Obviously yes, as fillind the property and pasting all your code makes things work flawlessly but as I said: Stupid questions.

  3. Ok, understood. I need to call the MCMScript for the hotkey to be recognized. Makes sense.

    But I'm still unable to display the notification. I tried to save/reload, the hotkey is registered and other mods can display than kind of notification. I'm probably still missing something (something obvious that will make me feel like a moron later on I'm sure of it) in my second script.

  4. According to the wiki it's playable.

    First thing first you'll need to be certain that your helmet exists. Open the console and enter (with the quotes): help "deathlord helmet"

    If it's here then you have to add the recipe.

     

    In the CK duplicate RecipeArmorDaedricHelmet & TemperArmorDaedricHelmet.

    Change the IDs and in the dropbox labelled "Created Objet" change ArmorDaedricHelmet to DeathlordHelmet (or RainbowUnicorn or anything you used as the editorid of your helmet).

  5. Second script is attached to the same dummy quest. I probably failed to assign the property from the mcm. Except I'm not sure what you mean by that. Until now the most complex property I assigned was a name to the first script.

    And I messed something else because the second script fails to compile: SitAnywhere_KeyPress.psc(6,31): a property cannot be used directly on a type, it must be used on a variable. 6, 31 being SitCrossLegged_Key

     

     

    I've been able to write a non-working but at least able to compile version:

     

     

    Scriptname SitAnywhere_KeyPress extends Quest
    
    GlobalVariable Property SitCrossLegged_Key Auto
    
    Event OnConfigInit()
    	RegisterForKey(SitCrossLegged_Key.GetValueInt())
    EndEvent
    
    Event OnKeyDown(int KeyCode)
    	if KeyCode == SitCrossLegged_Key.GetValueInt()
    		Debug.Notification("Hello, World!")
    	endif
    EndEvent

     

     

     

    I understand that OnConfigInit is an overall better choice over OnInit but I'm unsure if it's the optimal choice here.

    I'm still stuck with the GlobalVariable. Trying to delete that line lead to more error messages :

    SitAnywhere_KeyPress.psc(4,16): variable SitCrossLegged_Key is undefined

    SitAnywhere_KeyPress.psc(4,35): none is not a known user-defined type

    SitAnywhere_KeyPress.psc(4,1): type mismatch on parameter 1 (did you forget a cast?)

    SitAnywhere_KeyPress.psc(8,15): variable SitCrossLegged_Key is undefined

    SitAnywhere_KeyPress.psc(8,34): none is not a known user-defined type

    SitAnywhere_KeyPress.psc(8,12): cannot compare a int to a none (cast missing or types unrelated)

  6. I've been trying to alter SitAnywhere to allow user defined hotkeys instead of relying on lesser power.

    Designing a MCM menu allowing to define hotkey had been easy but so far I've been enable to assign those hotkeys to anything.

     

    I've attached two scripts to a dummy quest:

     

    The first one appears to be working (it could probably be improved but at least it works).

     

     

    Scriptname SitAnywhere_MCM extends SKI_ConfigBase
    
    int SitCrossLegged_OID
    int Property SitCrossLegged_Key = 22 Auto Hidden
    
    
    Event OnConfigInit()
    
    	Pages =new string[1]
    	Pages[0] = "Config"
    
    EndEvent
    
    
    Event OnPageReset(string page)
    
    	If (page == "Config")
    
    		SetCursorFillMode(TOP_TO_BOTTOM)
    		AddHeaderOption("Powers")
    		AddToggleOption("Remove power", False)
    		AddHeaderOption("Hotkeys")
    		SitCrossLegged_OID 	= AddKeyMapOption("Sit cross-legged", SitCrossLegged_Key)
    
    	EndIf
    
    EndEvent
    
    
    event OnOptionKeyMapChange(int a_option, int KeyCode, string a_conflictControl, string a_conflictName)
    
    	if (a_option == SitCrossLegged_OID)
    
    		bool continue = true
    
    		if (a_conflictControl != "")
    			string msg
    
    			if (a_conflictName != "")
    				msg = "This key is already mapped to:\n'" + a_conflictControl + "'\n(" + a_conflictName + ")\n\nAre you sure you want to continue?"
    			else
    				msg = "This key is already mapped to:\n'" + a_conflictControl + "'\n\nAre you sure you want to continue?"
    			endIf
    
    			continue = ShowMessage(msg, true, "$Yes", "$No")
    		endIf
    
    		if (continue)
    			SitCrossLegged_Key = KeyCode
    			SetKeymapOptionValue(a_option, KeyCode)
    		endIf
    		
    	endIf
    endEvent
    
    Event OnConfigClose()
    	UnregisterForAllKeys()
    	RegisterForKey(SitCrossLegged_Key)
    EndEvent

     

     

     

    Right now I'm trying to display a simple debug message when pressing the hotkey (without any success):

     

     

    Scriptname SitAnywhere_KeyPress extends Quest 
    
    SitAnywhere_MCM Property MCMScript Auto
    
    Event OnKeyDown(int KeyCode)
    	if KeyCode == SitAnywhere_MCM.SitCrossLegged_Key
    		Debug.Notification("Hello, World!")
    	endif
    EndEvent

     

     

    And another version after looking at RND sources (not working either but simply having those files to compile has been a pain):

     

     

    Scriptname SitAnywhere_KeyPress extends ReferenceAlias
    
    GlobalVariable Property SitCrossLegged_Key Auto
    
    Actor Player
    
    Event OnInit()
    	Player = Game.GetPlayer()
    	RegisterForKey(SitCrossLegged_Key.GetValueInt())
    EndEvent
    
    Event OnKeyDown(int keycode)
    	if keycode == SitCrossLegged_Key
    		Debug.Notification("Hello, World!")
    	endif
    EndEvent

     

     

     

    I imagine that I need a way link those two scripts to each others for the second one to recognize SitCrossLegged_Key but I just can't understand how.

  7. Thanks to this article I've been able to modify names of vanilla, dawnguard and heartfire crafting list.

    And then came Alduin dragonborn:

     

    According to the default objects windows all keywords point to an ObjectID starting with DLC2.

    At the same time looking inside the gameplay -> settings windows I can only find four entries related to DLC2 all of them being about dragon mouting.

     

     

     

    Any clue maybe?

    Hardcoded names?

×
×
  • Create New...