Jump to content

where i must input this => IsKeyPressed


virginharvester

Recommended Posts

hi, sorry for my bad english,

i like to put this script on new vegas,

i get it from my skyrim mod,

and this is code:

Scriptname HotkeyScript Extends Quest

Event OnInit()
  RegiserForKey(42)
EndEvent

Event OnKeyDown(Int KeyCode)
  If KeyCode == 42
    Debug.Notification("Hey, you pressed the key with a DXScanCode value of "+KeyCode)
  EndIf
EndEvent

i open the geck, open data, create new quest, and then when the quest window opened, the script tab is gone, how i suppose to input the script?,

can someone help me please!,

 

note : the code is work in skyrim, if new vegas code =/= skyrim code, can you fix it please!

 

and thanks for reading

Link to comment
Share on other sites

Skyrim uses a completely different scripting system than FNV. (It's more like Oblivion as they use the same engine.) You are going to need to re-write that code completely. First of all you are going to need to implement it using "New Vegas Script Extender (NVSE)" added functions. Don't let that bother you, as virtually everyone already uses it.

 

Please see the 'Tip: EventHandler-HotKey' entry under the "Scripting" section of the wiki "Getting started creating mods using GECK" article. That is how you are going to detect that the key in question has been pressed and have it process the script for that key with the minimum impact upon other processing.

 

Other NVSE functions of interest are: "IsKeyPressed", "GetKeyPress", and "GetKeyName". Check the bottom of each function's page for related functions as well.

 

-Dubious-

Link to comment
Share on other sites

Skyrim uses a completely different scripting system than FNV. (It's more like Oblivion as they use the same engine.) You are going to need to re-write that code completely. First of all you are going to need to implement it using "New Vegas Script Extender (NVSE)" added functions. Don't let that bother you, as virtually everyone already uses it.

 

Please see the 'Tip: EventHandler-HotKey' entry under the "Scripting" section of the wiki "Getting started creating mods using GECK" article. That is how you are going to detect that the key in question has been pressed and have it process the script for that key with the minimum impact upon other processing.

 

Other NVSE functions of interest are: "IsKeyPressed", "GetKeyPress", and "GetKeyName". Check the bottom of each function's page for related functions as well.

 

-Dubious-

thanks for the reply,

i have latest NVSE installed,

i have look the script, it look so complicated,

i dont even know where i must put the script,

i think i just need to give up about this one,

thanks for the info, i really appreciate it

Link to comment
Share on other sites

Anything that "looks complicated" generally just means you have to spend a little time learning how to break it down into smaller, simpler steps. Up to you, but don't be so quick to give up on it.

 

An "Eventhandler" is it's own script (similar to the way a "quest" script is it's own) which defines what the game engine is supposed to do when that "event" occurs. Until that event happens, it just sits idle, waiting. (Read the linked material in that "Tip" and 'TIP: Don't overlook EventHandlers.'. Also see 'TIP: Pre-load Scripts' as well. This is a powerful technique and well worth the time to learn.) This "waiting in the background" is one of it's major advantages. When the "event" occurs, the handler kicks in automatically and calls a "user defined function (UDF)" (meaning one you created for the purpose) which is a separate script in itself. Like any function, a UDF is designed to take "inputs" as "parameters", and return a single "output" as a "result variable". That "result" can be nothing more than an indicator of success or failure, or more complex but it has to be passed back as a single variable, which the "Eventhandler" script then can act upon. What it does in between depends upon your purpose, but "Events" are "single frame processing" blocks (see 'Tip: Assigning & Testing variables'), so the UDF script needs to be able to do it's thing in one pass as well.

 

This is really very similar to what your original Skyrim script was doing, which has two separate script sections as well: "Event OnInit" is roughly analogous to the "EventHandler" script; and "Event OnKeyDown" is roughly the "UDF". For an example of how this can be implemented, see the "* Employing an EventHandler:" sub-section under the 'TIP: Passing a 'Note' to the player' in "Scripting".

 

-Dubious-

Link to comment
Share on other sites

Anything that "looks complicated" generally just means you have to spend a little time learning how to break it down into smaller, simpler steps. Up to you, but don't be so quick to give up on it.

 

An "Eventhandler" is it's own script (similar to the way a "quest" script is it's own) which defines what the game engine is supposed to do when that "event" occurs. Until that event happens, it just sits idle, waiting. (Read the linked material in that "Tip" and 'TIP: Don't overlook EventHandlers.'. Also see 'TIP: Pre-load Scripts' as well. This is a powerful technique and well worth the time to learn.) This "waiting in the background" is one of it's major advantages. When the "event" occurs, the handler kicks in automatically and calls a "user defined function (UDF)" (meaning one you created for the purpose) which is a separate script in itself. Like any function, a UDF is designed to take "inputs" as "parameters", and return a single "output" as a "result variable". That "result" can be nothing more than an indicator of success or failure, or more complex but it has to be passed back as a single variable, which the "Eventhandler" script then can act upon. What it does in between depends upon your purpose, but "Events" are "single frame processing" blocks (see 'Tip: Assigning & Testing variables'), so the UDF script needs to be able to do it's thing in one pass as well.

 

This is really very similar to what your original Skyrim script was doing, which has two separate script sections as well: "Event OnInit" is roughly analogous to the "EventHandler" script; and "Event OnKeyDown" is roughly the "UDF". For an example of how this can be implemented, see the "* Employing an EventHandler:" sub-section under the 'TIP: Passing a 'Note' to the player' in "Scripting".

 

-Dubious-

thanks for the reply,

i will be honest to you,

i am too stupid to understand what do you said,

i am just want to create hot key script to craft without require firecamp,

this is the code :

Scriptname HotkeyScript Extends Quest

Event OnInit()
  RegiserForKey(42)
EndEvent

Event OnKeyDown(Int KeyCode)
  If KeyCode == 42
	if (Game.GetPlayer().getItemCount(BigHornerMeat) >=1)
		Count = (Math.Floor( Game.GetPlayer().getItemCount(BigHornerMeat) / 1))	
		Game.GetPlayer().removeItem(BigHornerMeat,1 * Count , TRUE)	
		Game.GetPlayer().addItem(BighornerSteak,1 * Count , TRUE)	
	endif	
  EndIf
EndEvent

but after i study the links for 1 hour, i cant event create a "warning" of "hello word",

i think, wise to me to give up to create this mod, the firecamp not that rare either,

thanks for your attention, i really appreciate it,

Link to comment
Share on other sites

  • Recently Browsing   0 members

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