Jump to content

how do i know if the mod is running?


Recommended Posts

hi, sorry for my bad english,

yesterday i made some "hello world" script mod

 

something like this :

 

Scriptname HotKeyScript extends Quest

Event OnInit()
RegisterForKey(161)
endEvent

Event OnKeyDown(Int KeyCode)
If KeyCode == 161
Game.GivePlayerCaps(100)
EndIf
EndEvent

 

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 Quest

Event 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

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

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

every one thanks for reply,

i dont know why but i just add "hidden" word after Scriptname HotKeyScript extends Quest

then 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=1
bEnableTrace=1
bLoadDebugInformation=1
bEnableProfiling=1
sDefaultLogOverlay=Papyrus

on 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 by virginharvester
Link to comment
Share on other sites

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

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

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

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

  • Recently Browsing   0 members

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