virginharvester Posted May 17, 2018 Share Posted May 17, 2018 hi, sorry for my bad english,yesterday i made some "hello world" script mod something like this : Scriptname HotKeyScript extends QuestEvent OnInit() RegisterForKey(161)endEventEvent OnKeyDown(Int KeyCode) If KeyCode == 161 Game.GivePlayerCaps(100) EndIfEndEvent and work without problem, every time i press right shift i got 100 caps,then i turn of my pc because i need to sleep, then a couple hours ago i edit it, but it not running,i even edit it, become : Scriptname HotKeyScript extends QuestEvent OnInit() Debug.Trace("Hello, World!") Debug.MessageBox("Hello, world!")endEvent but still the mod do not respond(the "Hello, world!" do not appear)i have some question about it!1. why it not working now but yesterday work?2. is debug need previous steps to make it work?3. how to detect is the mod ( in my case is the script) is running or no note : i put that script on new quest >>> start game enable, run once, priority 100, anything else is default,please help me Link to comment Share on other sites More sharing options...
Hoamaii Posted May 22, 2018 Share Posted May 22, 2018 OnInit() only runs the first time a script instance is called in the game. In your case, your quest started the first time you loaded your mod, onInit() ran then. Try to do the same thing with a spell instead of a quest - every time you cast your spell, you'll get a new instance of your script running, and so onInit() will run again. As to why you don't get onKeyDown to work the next day, that's possibly because quests automatically UnregisterForKey - though honestly I thought it only unregistered once the quest stage was done. Link to comment Share on other sites More sharing options...
dagobaking Posted May 22, 2018 Share Posted May 22, 2018 You can use this strategy: Event OnInit() Self.RegisterForRemoteEvent(PlayerRef, "OnPlayerLoadGame") EndEvent Event Actor.OnPlayerLoadGame(Actor akSender) Self.initialize() EndEvent Event OnKeyDown(Int KeyCode) If KeyCode == 161 Game.GivePlayerCaps(100) EndIf EndEvent Function initialize() RegisterForKey(161) EndEvent Link to comment Share on other sites More sharing options...
virginharvester Posted May 24, 2018 Author Share Posted May 24, 2018 (edited) every one thanks for reply,i dont know why but i just add "hidden" word after Scriptname HotKeyScript extends Questthen the mod work again(100 caps added in to player inventory),i dont know why if i put that "hidden" the mod "show up",but if i removed that "hidden" again the mod not "show up". anyway the Debug.Trace("Hello, World!") and Debug.MessageBox("Hello, world!") still dont appear!i even add :[Papyrus]bEnableLogging=1bEnableTrace=1bLoadDebugInformation=1bEnableProfiling=1sDefaultLogOverlay=Papyruson fallout ini(s) (i even add that setting to all of three ini{s})but the message do not show up, but the 100caps still appear(sound and messages),any clue of it? Edited May 24, 2018 by virginharvester Link to comment Share on other sites More sharing options...
Hoamaii Posted May 24, 2018 Share Posted May 24, 2018 My understanding is that "hidden" just hides the script from the editor - other than that, I have no idea why it should make a difference on how events are called. Have you tried Dogobaking's suggestion? Link to comment Share on other sites More sharing options...
virginharvester Posted May 24, 2018 Author Share Posted May 24, 2018 My understanding is that "hidden" just hides the script from the editor - other than that, I have no idea why it should make a difference on how events are called. Have you tried Dogobaking's suggestion?yes i have try it and run it, both of my and dagobaking work, anyway, thanks for reply. Link to comment Share on other sites More sharing options...
Hoamaii Posted May 24, 2018 Share Posted May 24, 2018 And you still do not get you debugs working? Not even the MessageBox? Link to comment Share on other sites More sharing options...
virginharvester Posted May 24, 2018 Author Share Posted May 24, 2018 And you still do not get you debugs working? Not even the MessageBox?the debug message do not show up, but the 100caps still appear(sound and messages), Link to comment Share on other sites More sharing options...
Hoamaii Posted May 24, 2018 Share Posted May 24, 2018 That is strange - you call your debugs in the same event where you call GivePlayerCaps(100), right? Unless, maybe, just a supposition on my part, unless the "hidden" flag means it's supposed to not display debugs in game either? You shouldn't need that "hidden" flag anyway for it all to work. Stupid question, but every time you make a change in the code, you reload you mod from a clean save, right? By "clean" I mean a save in which your mod was never ever loaded. Link to comment Share on other sites More sharing options...
virginharvester Posted May 24, 2018 Author Share Posted May 24, 2018 Stupid question, but every time you make a change in the code, you reload you mod from a clean save, right? By "clean" I mean a save in which your mod was never ever loaded.no, i running it from saved game running,i modified script like this : If KeyCode == 161 Game.GivePlayerCaps(100) Debug.Trace("Hello, World!") Debug.MessageBox("Hello, world!") EndIf then i change the caps to 200 or else,the caps in game is changed to 200 too (it come with notification text and sound too),but the both "debug messages" do not come out,anyway, thanks a lot for reply Link to comment Share on other sites More sharing options...
Recommended Posts