[BETA] New Vegas Script Extender (NVSE) v1

Post » Mon Sep 27, 2010 9:23 am

@Langy - Get/SetWeight is working just fine for me - at least on weapons and clothing. Try from the console and see what it reports. Example: GetWeight 4335 should report 3.0 (Laser Pistol). SetWeight 5.0 4335 followed by GetWeight 4335 should now report 5.0. Alternately, drop something from Inventory whose weight you want to check. Look at it and go to the console. Click it in the console (the name should show up at the top) then type GetWeight and it should return the weight. Type SetWeight 570.0, then do GetWeight again and it should return 570.0. If this doesn't work, then we have a real problem.


DisableKey and Enable Key with mouse keys are also working fine. I tested:
  • 256 (Mouse 1)
  • 257 (Mouse 2)
  • 258 (Mouse 3)
  • 260 (Mouse 5)


This can also be done straight from the console. Doing mouse 1 is immediately obvious, as you can't get back to the game unless you mouse over continue and press Enter.

Can you tell me what you are doing? I'd like to figure out what is going wrong.
User avatar
Lucie H
 
Posts: 3276
Joined: Tue Mar 13, 2007 11:46 pm

Post » Mon Sep 27, 2010 4:28 am

Bug report:
I haven't tested any others, but at least the %n format specifier for functions using format strings doesn't work correctly. When I try to report an actor's formID and name with %i and %n via http://fose.silverlock.org/fose_command_doc.html#PrintToConsole, the formID displays correctly but the actor is incorrectly reported to have no name.

Cipscis
User avatar
Angus Poole
 
Posts: 3594
Joined: Fri Aug 03, 2007 9:04 pm

Post » Mon Sep 27, 2010 2:02 pm

Bug report, or I'm just incompetent: GetNumRefsInCell seems to always return 0 for me.

short sRaceCount;ref rWorkingRef;set sRaceCount to GetNumRefsInCell wwnRaces 200;PrintToConsole "%f" sRaceCount;if sRaceCount <= 1	set rWorkingRef to GetFirstRefInCell wwnRaces 200;	wwnBodyShopMannequinREF01.matchrace rWorkingRef;else	wwnBodyShopMannequinREF01.disable;endif[...]


Prints 0 to the console and the if statement does not run. If I remove the conditional however, GetFirstRefInCell (and GetNextRef) work fine, up to the number of refs I know I have in that cell (four).
User avatar
Amy Gibson
 
Posts: 3540
Joined: Wed Oct 04, 2006 2:11 pm

Post » Mon Sep 27, 2010 10:22 am

DisableKey does not work with 264 or 265 (the mouse wheel) either in the console or through a script, though IsKeyPressed works fine for them.

GetWeight and SetWeight work fine in the console. I was using Ref.GetWeight and Ref.SetWeight in my script - the script compiled fine, but perhaps the reference version is busted. I'm testing to see if the base form version will work.

Just tested and that's the problem. Using Ref.SetWeight causes the script to stop working (and the items weight does not change). Using SetWeight Weight Ref works fine. Same problem with Ref.GetWeight, except it just returns 0 and doesn't cause the script to never run again.

EDIT: %n works fine on items - not sure why it doesn't work on actors.
User avatar
Anthony Rand
 
Posts: 3439
Joined: Wed May 09, 2007 5:02 am

Post » Mon Sep 27, 2010 7:38 am

Bug report, or I'm just incompetent: GetNumRefsInCell seems to always return 0 for me.

short sRaceCount;ref rWorkingRef;set sRaceCount to GetNumRefsInCell wwnRaces 200;PrintToConsole "%f" sRaceCount;if sRaceCount <= 1	set rWorkingRef to GetFirstRefInCell wwnRaces 200;	wwnBodyShopMannequinREF01.matchrace rWorkingRef;else	wwnBodyShopMannequinREF01.disable;endif[...]


Prints 0 to the console and the if statement does not run. If I remove the conditional however, GetFirstRefInCell (and GetNextRef) work fine, up to the number of refs I know I have in that cell (four).

I'm surprised this wasn't reported with FOSE. The GetNumRefs code was ported straight over from OBSE where Actor was 69 and Inventory Object was 70. It has never worked with the values 200 and 201. But GetNextRef was updated properly. I've fixed it for beta 2. Good catch!
User avatar
Josh Sabatini
 
Posts: 3445
Joined: Wed Nov 14, 2007 9:47 pm

Post » Mon Sep 27, 2010 11:30 am

Bug report:
I haven't tested any others, but at least the %n format specifier for functions using format strings doesn't work correctly. When I try to report an actor's formID and name with %i and %n via http://fose.silverlock.org/fose_command_doc.html#PrintToConsole, the formID displays correctly but the actor is incorrectly reported to have no name.

Cipscis

Fixed for beta 2. Some code was commented out when I first brought things over as I didn't have info for the types in question. I have that info so things should work in the next beta.
User avatar
Juan Cerda
 
Posts: 3426
Joined: Thu Jul 12, 2007 8:49 pm

Post » Mon Sep 27, 2010 2:39 am

http://nvse.silverlock.org/beta/nvse_1_beta2.zip

New functionality:
  • SetArmorAR
  • UI Functions (Get/SetUIFloat, GetUIString)
  • GetCrosshairRef
  • GetGameRestarted/Loaded
  • con_ToggleMenus, con_ToggleFreeCamera, con_ToggleCollision
  • GetWeaponItemMod - format: optionalRef.GetWeaponItemMod int:whichMod (1-3) optionalForm
  • Mod functions (IsModLoaded, GetModIndex, GetNumLoadedMods, GetSourceModIndex)
  • GetDebugSelection
  • Get/SetArmorDT - gets/sets a float


@DarN: you should have everything you asked for (aside from string_vars) to get started.
User avatar
Laura Simmonds
 
Posts: 3435
Joined: Wed Aug 16, 2006 10:27 pm

Post » Mon Sep 27, 2010 3:37 am

Awesome. :)

GetWeaponItemMod sounds intriguing...
User avatar
Brian Newman
 
Posts: 3466
Joined: Tue Oct 16, 2007 3:36 pm

Post » Mon Sep 27, 2010 11:45 am

Hm, something has changed with how the interface data is refreshed.

Sample code:
Spoiler

XML snippet for HUDMainMenu
	<_debugTextVisible> 0 	<_debugTextNum> 0 			  				<_nam_0> Hello World 		<_nam_1> Bye World 				<_name>												 3 										


Test script
scn UITestScriptshort stateBegin GameModeif state == 0	set state to 1	PrintToConsole "Hello"	setUIFloat "HUDMainMenu\_debugTextVisible" 1	setUIFloat "HUDMainMenu\_debugTextNum" 0elseif state == 1	set state to 2	PrintToConsole "Bye"	setUIFloat "HUDMainMenu\_debugTextVisible" 1	setUIFloat "HUDMainMenu\_debugTextNum" 1else	set state to 0	PrintToConsole "Hide"	setUIFloat "HUDMainMenu\_debugTextVisible" 0	setUIFloat "HUDMainMenu\_debugTextNum" 0endifEnd




In Fallout 3, this would result in
Hidden -> Hello World -> Bye World -> Hidden -> ...

In New Vegas, its
Hidden -> Hello World -> Hello World -> Hidden -> ...

Just a little heads-up for anyone who runs into problems because of this. Hopefully there's some workaround to force a refresh...


Edit: Actually, forget what I wrote above :)

It seems rather that setUIFloat is broken:

Spoiler

XML snippet for HUDMainMenu
	<_debugTextValue> 0 				 3 										


Test script
scn UITestScriptshort statefloat fTempshort sTempBegin GameModeif state == 0	printToConsole "0: Float"	set fTemp to 1	setUIFloat "HUDMainMenu\_debugTextValue" fTemp	set state to 1elseif state == 1	printToConsole "1: Short"	set sTemp to 1	setUIFloat "HUDMainMenu\_debugTextValue" sTemp	set state to 2elseif state == 2	PrintToConsole "2: Direct "	setUIFloat "HUDMainMenu\_debugTextValue" 1	set state to 3else	PrintToConsole "3: Null"	setUIFloat "HUDMainMenu\_debugTextValue" 0	set state to 0endifEnd




Fo3: 0 -> 1 -> 1 -> 1 -> 0 -> ...
FoNV: 0 -> X [large value] -> X -> X -> 0 -> ...
User avatar
Jeffrey Lawson
 
Posts: 3485
Joined: Tue Oct 16, 2007 5:36 pm

Post » Mon Sep 27, 2010 4:02 pm

Very cool.

Any way you can implement a function to determine what kind of item you are crafting (even better: the exact references of the items that were svcked up/spit out by the crafting system)?
User avatar
Anthony Diaz
 
Posts: 3474
Joined: Thu Aug 09, 2007 11:24 pm

Post » Mon Sep 27, 2010 1:56 pm

Input functions (http://fose.silverlock.org/fose_command_doc.html#IsKeyPressed via script and http://fose.silverlock.org/fose_command_doc.html#TapKey via console tested) are no longer working for me with the new beta.

Cipscis

EDIT:

This only seems to be a problem when using the new -skiplauncher parameter in both cases.

Cipscis
User avatar
Isaac Saetern
 
Posts: 3432
Joined: Mon Jun 25, 2007 6:46 pm

Post » Mon Sep 27, 2010 11:10 am

Awesome. :)

GetWeaponItemMod sounds intriguing...

Looking in the GECK this will return the items listed in the Item Mods area at the bottom of the Mod Info tab. Not sure exactly what folks will do with this currently, other than check to see which mods are on a weapon. The ItemMod returned has a Name, Weight, Value, Script which are all accessible using the appropriate functions. Like most other inventory objects it also has a texture swap, an icon, a description, a message icon, a destructible form and pickup and putdown sounds. But currently there is not much you can do with these items.

As always - lots of possible future functions to implement here.

Hm, something has changed with how the interface data is refreshed.

Sample code:
Spoiler

XML snippet for HUDMainMenu
	<_debugTextVisible> 0 	<_debugTextNum> 0 			  				<_nam_0> Hello World 		<_nam_1> Bye World 				<_name>												 3 										


Test script
scn UITestScriptshort stateBegin GameModeif state == 0	set state to 1	PrintToConsole "Hello"	setUIFloat "HUDMainMenu\_debugTextVisible" 1	setUIFloat "HUDMainMenu\_debugTextNum" 0elseif state == 1	set state to 2	PrintToConsole "Bye"	setUIFloat "HUDMainMenu\_debugTextVisible" 1	setUIFloat "HUDMainMenu\_debugTextNum" 1else	set state to 0	PrintToConsole "Hide"	setUIFloat "HUDMainMenu\_debugTextVisible" 0	setUIFloat "HUDMainMenu\_debugTextNum" 0endifEnd




In Fallout 3, this would result in
Hidden -> Hello World -> Bye World -> Hidden -> ...

In New Vegas, its
Hidden -> Hello World -> Hello World -> Hidden -> ...

Just a little heads-up for anyone who runs into problems because of this. Hopefully there's some workaround to force a refresh...


Edit: Actually, forget what I wrote above :)

It seems rather that setUIFloat is broken:

Spoiler

XML snippet for HUDMainMenu
	<_debugTextValue> 0 				 3 										


Test script
scn UITestScriptshort statefloat fTempshort sTempBegin GameModeif state == 0	printToConsole "0: Float"	set fTemp to 1	setUIFloat "HUDMainMenu\_debugTextValue" fTemp	set state to 1elseif state == 1	printToConsole "1: Short"	set sTemp to 1	setUIFloat "HUDMainMenu\_debugTextValue" sTemp	set state to 2elseif state == 2	PrintToConsole "2: Direct "	setUIFloat "HUDMainMenu\_debugTextValue" 1	set state to 3else	PrintToConsole "3: Null"	setUIFloat "HUDMainMenu\_debugTextValue" 0	set state to 0endifEnd




Fo3: 0 -> 1 -> 1 -> 1 -> 0 -> ...
FoNV: 0 -> X [large value] -> X -> X -> 0 -> ...

Hmm. Interesting. Ian implemented this function the same way we did in FOSE and OBSE and directly calls internal functions of the game. Perhaps he got the positioning of the function wrong, although he did test. Another possibility is that the Extraction code isn't working quite as expected.

One thing to try - this value is a float, not an integer. Can you try passing 1.0 rather than 1 and see what happens? The hex value for 1 in float is actually 0x3F800000 (or 1065353216). So a value of 1 (0x00000001) might end up looking like -1401298545 for example.

Any way you can implement a function to determine what kind of item you are crafting (even better: the exact references of the items that were svcked up/spit out by the crafting system)?

Probably. I would have to examine the worktable data (might be a container of some sort) and see. Alternately the interface class might have that list on it as well - not sure where NV would put it. I can look, but I wouldn't count on it being available for v1.

Input functions (http://fose.silverlock.org/fose_command_doc.html#IsKeyPressed via script and http://fose.silverlock.org/fose_command_doc.html#TapKey via console tested) are no longer working for me with the new beta.

Cipscis

EDIT:

This only seems to be a problem when using the new -skiplauncher parameter in both cases.

Cipscis

I haven't tested that at all. Do the other NVSE functions look like they are working?

Finally - we're expecting a patch to New Vegas sometime this week. With luck that will be the patch we release NVSE on. Unless we have serious bugs to fix we'll likely hold off on beta 3 until post-patch. Or perhaps not. In any case, v1 will not be released until post-patch.
User avatar
Alyna
 
Posts: 3412
Joined: Wed Aug 30, 2006 4:54 am

Post » Mon Sep 27, 2010 5:02 am

Various console tests work, although when I use http://fose.silverlock.org/fose_command_doc.html#TapKey in a bat it doesn't work (it does work if I load without bypassing the launcher). http://fose.silverlock.org/fose_command_doc.html#PrintToConsole, at least, still works in a script when bypassing the launcher.

Cipscis
User avatar
Monika
 
Posts: 3469
Joined: Wed Jan 10, 2007 7:50 pm

Post » Mon Sep 27, 2010 1:26 am

Another possibility is that the Extraction code isn't working quite as expected.

Adding
bExtracted = ExtractArgs(EXTRACT_ARGS, &component, &newFloat);Console_Print("New Float >> %.4f", newFloat); //Debug

prints 0.0000 and 1.0000 to console after a setUIFloat call, so up to this point it works (at least if thats how its supposed to work :)).

One thing to try - this value is a float, not an integer. Can you try passing 1.0 rather than 1 and see what happens? The hex value for 1 in float is actually 0x3F800000 (or 1065353216). So a value of 1 (0x00000001) might end up looking like -1401298545 for example.

1.0 or 1, makes no difference. The value thats shown instead of 1 is indeed 1065353216.
User avatar
No Name
 
Posts: 3456
Joined: Mon Dec 03, 2007 2:30 am

Post » Mon Sep 27, 2010 2:16 pm

Thanks for the update. I think I'll find something very usefull inside.
User avatar
Steve Bates
 
Posts: 3447
Joined: Sun Aug 26, 2007 2:51 pm

Post » Mon Sep 27, 2010 4:01 pm

Various console tests work, although when I use http://fose.silverlock.org/fose_command_doc.html#TapKey in a bat it doesn't work (it does work if I load without bypassing the launcher). http://fose.silverlock.org/fose_command_doc.html#PrintToConsole, at least, still works in a script when bypassing the launcher.

Cipscis

We'll have to test with this option and see what is up. I haven't tried anything with the skip launcher at all.

Adding
bExtracted = ExtractArgs(EXTRACT_ARGS, &component, &newFloat);Console_Print("New Float >> %.4f", newFloat); //Debug

prints 0.0000 and 1.0000 to console after a setUIFloat call, so up to this point it works (at least if thats how its supposed to work :)).


1.0 or 1, makes no difference. The value thats shown instead of 1 is indeed 1065353216.

Okay - so we are getting the correct number in place (0x38F00000) which as a float is 0. Hmm. I wonder if they aren't using floats for some reason, but instead interpreting things as integers. That might be a change.

Oh - I think I have a possibility. We've noticed that there is less compiler optimization in NV than in FO3. We've seen quite a few more or less duplicated functions. Perhaps they've got multiple version of the functions - one that expects a float and one that expects an integer. Perhaps we've hooked up to the wrong one? That would explain why the float we are passing might get stored as an Int. I'll need to talk to Ian about it. We'll try and sort this out with a patch as soon as we can.
User avatar
Richard Thompson
 
Posts: 3302
Joined: Mon Jun 04, 2007 3:49 am

Post » Mon Sep 27, 2010 4:03 am

Another bug report: GetWeight returns 0 when used on ammunition, even in hardcoe mode.
User avatar
Vivien
 
Posts: 3530
Joined: Fri Apr 13, 2007 2:47 pm

Post » Mon Sep 27, 2010 5:26 pm

Another bug report: GetWeight returns 0 when used on ammunition, even in hardcoe mode.

Thanks, I'll have to do some more decoding. The TESAmmo class doesn't have a TESWeightForm member - probably because ammo doesn't always have a weight. That means we'll have to special case TESAmmo and find where they are storing the data. Good catch!
User avatar
Sophh
 
Posts: 3381
Joined: Tue Aug 08, 2006 11:58 pm

Post » Mon Sep 27, 2010 3:34 am

Is it possible to implement a getHasAchievement function? I know there is an addAchievemnt (or at least was in Fo3), so maybe can start out from there. Not really a high priority, as I think I may be the only one who'd use such a thing.

Keep up the good work!
User avatar
Melissa De Thomasis
 
Posts: 3412
Joined: Tue Feb 27, 2007 6:52 pm

Post » Mon Sep 27, 2010 6:12 pm

I don't see this in your list of requested functions for v1, so I'm not sure if it's planned or not. Could you port over SetHotkeyItem from OBSE? Would be very useful for various things from remembering different hotkeys even when someone steels your items (see the casinos) to having alternate hotkeys available.

Also: At the moment I really doubt it's possible, but could you see if there's any way to re-implement a proper Hotkey for key 2? You know, it'd change the little picture and everything. I can make a 'fake' hotkey for 2 easy enough right now, but I don't want to. I'm guessing it's not going to be easy, maybe not possible with the script extender, especially since Control 18 has been repurposed from Hotkey 2 to Ammo Swap.
User avatar
lauraa
 
Posts: 3362
Joined: Tue Aug 22, 2006 2:20 pm

Post » Mon Sep 27, 2010 8:43 am

Ok, so I tried to make that little usefull console command mod, with "limited" results. Please have patience as this is my first real script I've ever created. I assume it should work but it simply doesn't.
What I'm trying to achieve is binding F1 key to enable "ToggleFreeCamera" and "ToggleMenu" mode. And binding F2 key to enable "ToggleCollision". Here's what I did:

1. Made a global variable "short, FSToggleCameraKey, 59 = F1key"
2. Made a quest "FSToggleCommandsQuest" and use it to attach the script to
3. Made the questscript which is like followed

scn FSEasyConsoleCommandScriptShort KeyPressedBegin GameMode	If IsKeyPressed FSToggleCameraKey == 1 && KeyPressed == 0		Set KeyPressed to 1		Enable con_ToggleMenus		Enable con_ToggleFreeCamera	ElseIf IsKeyPressed FSToggleCameraKey == 0		Set KeyPressed to 0	EndIfEndBegin MenuMode	If IsKeyPressed FSToggleCameraKey == 1 && KeyPressed == 0		Set KeyPressed to 1		Enable con_ToggleMenus		Enable con_ToggleFreeCamera	ElseIf IsKeyPressed FSToggleCameraKey == 0		Set KeyPressed to 0	EndIfEnd


I've tried to replace "enable" with "set", but that hasn't an effect either. Please help me I'm stuck.
User avatar
Facebook me
 
Posts: 3442
Joined: Wed Nov 08, 2006 8:05 am

Post » Mon Sep 27, 2010 2:07 pm

http://geck.gamesas.com/index.php/Enable is used to enable disabled references, and "set" is used to change the values stored in variables. You don't want to use either of these - just call the functions on their own:
scn FSEasyConsoleCommandScriptShort KeyPressedBegin GameMode	If IsKeyPressed FSToggleCameraKey == 1 && KeyPressed == 0		Set KeyPressed to 1		con_ToggleMenus		con_ToggleFreeCamera	ElseIf IsKeyPressed FSToggleCameraKey == 0		Set KeyPressed to 0	EndIfEndBegin MenuMode	If IsKeyPressed FSToggleCameraKey == 1 && KeyPressed == 0		Set KeyPressed to 1		con_ToggleMenus		con_ToggleFreeCamera	ElseIf IsKeyPressed FSToggleCameraKey == 0		Set KeyPressed to 0	EndIfEnd

Cipscis
User avatar
gandalf
 
Posts: 3400
Joined: Wed Feb 21, 2007 6:57 pm

Post » Mon Sep 27, 2010 3:14 pm

http://geck.gamesas.com/index.php/Enable is used to enable disabled references, and "set" is used to change the values stored in variables. You don't want to use either of these - just call the functions on their own:
scn FSEasyConsoleCommandScriptShort KeyPressedBegin GameMode	If IsKeyPressed FSToggleCameraKey == 1 && KeyPressed == 0		Set KeyPressed to 1		con_ToggleMenus		con_ToggleFreeCamera	ElseIf IsKeyPressed FSToggleCameraKey == 0		Set KeyPressed to 0	EndIfEndBegin MenuMode	If IsKeyPressed FSToggleCameraKey == 1 && KeyPressed == 0		Set KeyPressed to 1		con_ToggleMenus		con_ToggleFreeCamera	ElseIf IsKeyPressed FSToggleCameraKey == 0		Set KeyPressed to 0	EndIfEnd

Cipscis


Thanks for your help friend, but that didn'T work either, the script doesn't even save. Could you tell me by chance if this script is ok, or do you recognize any failures. As I said I'm new to scripting.
User avatar
Jonathan Braz
 
Posts: 3459
Joined: Wed Aug 22, 2007 10:29 pm

Post » Mon Sep 27, 2010 5:45 pm

You might also have a problem with it being a quest script - in other words, it won't run every frame. Put it in an object script, make that object non-playable (you can only do that with weapons/armor/ammo), and then use the quest script to add that object to your character and then quit the quest.

EDIT: Did you use the NVSE_Loader.exe to load the GECK? You need to run it with the -editor argument or else it won't be able to accept NVSE script functions.
User avatar
FirDaus LOVe farhana
 
Posts: 3369
Joined: Thu Sep 13, 2007 3:42 am

Post » Mon Sep 27, 2010 2:24 am

Is it possible to implement a getHasAchievement function? I know there is an addAchievemnt (or at least was in Fo3), so maybe can start out from there. Not really a high priority, as I think I may be the only one who'd use such a thing.

Keep up the good work!

I can look at this. I can probably look at AddAchievement and see what it is doing. It may be in the steam code, however, which might make things a bit more difficult.

I don't see this in your list of requested functions for v1, so I'm not sure if it's planned or not. Could you port over SetHotkeyItem from OBSE? Would be very useful for various things from remembering different hotkeys even when someone steels your items (see the casinos) to having alternate hotkeys available.

Also: At the moment I really doubt it's possible, but could you see if there's any way to re-implement a proper Hotkey for key 2? You know, it'd change the little picture and everything. I can make a 'fake' hotkey for 2 easy enough right now, but I don't want to. I'm guessing it's not going to be easy, maybe not possible with the script extender, especially since Control 18 has been repurposed from Hotkey 2 to Ammo Swap.

I can look at Hotkeys as well. I simply ported over GetHotkeyItem from FOSE (which never got SetHotkeyItem). I'll take a look at it today and see what I can find. As for a Real hotkey for Control 18, I am not sure. I'll have to look and see what it is doing.
User avatar
sam westover
 
Posts: 3420
Joined: Sun Jun 10, 2007 2:00 pm

PreviousNext

Return to Fallout: New Vegas