[BETA] Oblivion Script Extender (OBSE) 0020

Post » Tue May 03, 2011 4:03 am

Hey guys! Got an idea about what the next big thing OBSE could do - How hard would it be to implement fully custom menus? Not the messagebox stuff, but creating an xml menu and then call it up through an OBSE script? It would probably be a good idea to additionally include a xml tag to the reader library too, so that it executes scripts written in the xml upon certain conditions.
As others have mentioned MenuQue offers the ability to create custom, generic menus. Although at the actual possibilities within a menu remain the same. I've also decoded much of the whole menu construction and updating.

Anyways, what you are asking is something I considered adding too. The only real problem is with how the menus work, they are basically a hude collection of linked lists (a trait has a list of expressions and a list of expressions that refer to that trait). This is used to update any derived trait when the game/engine changes something. Which means unless something changes the menu (code) does absolutely nothing. When introducing script functions into the mix you'll get the problem that the menu won't know when the result of said function will change. The only solution I could think of was to constantly check for a change (and thus constantly calling the function).

But this will get a bit offtopic for the OBSE thread so if you'd like to know more or have suggestions on new menu features drop by the MenuQue thread.

-kyoma
User avatar
dav
 
Posts: 3338
Joined: Mon Jul 30, 2007 3:46 pm

Post » Tue May 03, 2011 8:13 am

if you want to investigate a mod for hotkey issues, try mine, I get sporadic reports of it failing to work for ppl, and the code is probably the most simple you will find.

Thanks, I investigated the code a while back for a user who reported the same issue. I don't recall the details but it looked like the way the code is structured allows the IsHotKey variable to get stuck. My response appeared to resolve the issue for this user:
Looking at the mod's scripts it appears possible that the hotkey gets stuck "on", in which case pressing it again won't do anything.
Would you mind going into the game and waiting ~10 seconds in game mode to let the scripts initialize, then enter the console and type:
sqv aaaAdvancedMagecraftQST

This will list the quest variables. I'm particularly interested in the value of IsHotkeyPressed. If that variable is zero, try going into inventory menu, hovering the mouse over an item, and pressing spacebar. If no menu comes up, repeat the above and see if the value of IsHotkeyPressed has changed.

If IsHotkeyPressed is *not* zero, type set aaaAdvancedMagecraftQST.IsHotkeyPressed to 0 and try using the spacebar again.

Thanks.


GetObjectType type 70

Every object has a form type. No object has the type 69 or 70 - those are stand-ins for multiple form types, so they are only useful as parameters, never return values.
User avatar
Sebrina Johnstone
 
Posts: 3456
Joined: Sat Jun 24, 2006 12:58 pm

Post » Tue May 03, 2011 10:56 am

I have a request: A way to externally assign a value to a variable in an object script by specifying the variable name and the reference to which this script is attached. Basically the "Set" versions of:


  • GetVariable - returns the value of a numeric variable by name, either from the calling reference's script or the specified quest.
    (variableValue:float) reference.GetVariable varName:string questID:ref

  • GetRefVariable - returns the reference stored in a ref variable by name, either from the calling reference's script or the specified quest.
    (reference:ref) reference.GetRefVariable varName:string questID:ref

  • GetArrayVariable (GetArrayVar) - returns the value of an array variable by name, either from the calling reference's script or the specified quest.
    (array) reference.GetArrayVariable varName:string questID:ref



I especially need SetVariable and SetRefVariable badly.

Thanks!
User avatar
Andres Lechuga
 
Posts: 3406
Joined: Sun Aug 12, 2007 8:47 pm

Post » Mon May 02, 2011 9:04 pm

You can use use Ref.RunScriptLine "set intVar to ", 1 and Ref.RunScriptLine "set refVar to %q%i%q", , 1

For Quests the same, just with dot-syntax instead of the RunOnRef-flag (i.e. RunScriptLine "set Quest.intVar to ")

Won't work with arrays (require let: doesn't work in console), not sure about string_var.
User avatar
Kim Kay
 
Posts: 3427
Joined: Fri Oct 13, 2006 10:45 am

Post » Tue May 03, 2011 9:52 am

Oh, never thought of that, thanks!

That will work, though those "set" functions would be slightly more efficient since RunScriptLine is called from the console and thus not compiled?
User avatar
Evaa
 
Posts: 3502
Joined: Mon Dec 18, 2006 9:11 am

Post » Tue May 03, 2011 12:53 am

Ugh, can't edit my last post for some reason.

I just tried your suggestion, and the numeric assignment works, but the reference assignment doesn't. Any ideas why?
User avatar
Amy Cooper
 
Posts: 3400
Joined: Thu Feb 01, 2007 2:38 am

Post » Mon May 02, 2011 8:42 pm

Maybe the FormID has to be wrapped in quotation marks. Try this: Ref.RunScriptLine "set refVar to %q%i%q", , 1
User avatar
sarah taylor
 
Posts: 3490
Joined: Thu Nov 16, 2006 3:36 pm

Post » Mon May 02, 2011 10:51 pm

Maybe the FormID has to be wrapped in quotation marks. Try this: Ref.RunScriptLine "set refVar to %q%i%q", , 1

That'll do it.

The difference in execution time between RunScriptLine vs. dedicated SetVariable commands would be tiny. On the other hand, since you *can* do it using RunScriptLine, we get to avoid officially supporting functionality that could be used to modify other mods' script variables. Not that I expect anyone would misuse a SetVariable command to wreak havoc with other people's mods or that I'm pretending somebody couldn't do that if they really wanted to anyway - but I think, based on previous discussions, that some modders would feel more comfortable if we didn't provide that kind of functionality directly.
User avatar
meg knight
 
Posts: 3463
Joined: Wed Nov 29, 2006 4:20 am

Post » Tue May 03, 2011 12:35 am

That sounds kinda illogical to me, but I'm content with the current method. Thanks for explaining!
User avatar
Amber Hubbard
 
Posts: 3537
Joined: Tue Dec 05, 2006 6:59 pm

Post » Tue May 03, 2011 3:27 am

Heh, don't even need OBSE for that: http://cs.elderscrolls.com/constwiki/index.php/HasMagicEffect is a default function.


Haha - right you are. That's what I needed all along. Thanks!
User avatar
Andrew Perry
 
Posts: 3505
Joined: Sat Jul 07, 2007 5:40 am

Post » Tue May 03, 2011 12:41 am

Umm, IsDigit requires that I use CharToASCII on string characters first, right?
IsDigit seems to be returning true no matter what ASCII code gets passed.

Here is the script:
Spoiler
Begin _Function {}	ForEach (char <- "gddf22v5")		let ASCIICode := CharToASCII char		print char  + " - " + $(ASCIICode)				if eval (IsDigit ASCIICode )			print "digit"		endif	loopEnd

And here is what the console spits out:
Spoiler
g - 103
digit
d - 100
digit
d - 100
digit
f - 102
digit
2 - 50
digit
2 - 50
digit
v - 118
digit
5 - 53
digit

Notice that its printing digit after each character - ASCII Code.
User avatar
Joie Perez
 
Posts: 3410
Joined: Fri Sep 15, 2006 3:25 pm

Post » Tue May 03, 2011 10:32 am

I have yet another request.

Functions and/or commands that address the Camera when in third person or in free camera mode, or just being able to use Get/SetPos and Get/SetAngle on a camera reference if something like that is possible. It should be quite useful to be able to create cut scenes if you want the player to be in the scene as well, or for example to make custom camera view positions, and to be able to detect where the player is looking when R is being held down.
User avatar
Jessie
 
Posts: 3343
Joined: Sat Oct 14, 2006 2:54 am

Post » Tue May 03, 2011 9:31 am

I've had a few requests in regards to the Auto-Move feature. I can trap for the key command being pressed, and I can disable the command key, but what I would like to be able to do is trap for whether or not Auto-Move is currently engaged or not. I looked all over and couldn't find any standard or OBSE functions that could check for that.

I want to disable Auto-Move conditionally, when the player is sneaking. Although I can disable the auto-move key while the character is sneaking, it doesn't prevent the exploit of Auto-moving while walking, and then switching to sneak while Auto-moving.

It's a low priority feature, but it would be nice to have. Right now it's either all or nothing when it comes to the auto-move functionality, and I'd like to provided some flexibility. Hopefully that makes sense.

saebel
User avatar
Melung Chan
 
Posts: 3340
Joined: Sun Jun 24, 2007 4:15 am

Post » Mon May 02, 2011 11:15 pm

Saebel, what about this:


If Player.IsSneaking && Player.IsMovingForward && IsControlPressed 0 == 0
;if this returns true, player is sneaking and moving forward while the move-forward control is not being pressed
;which means that the auto-move must be toggled on
TapControl 12
;toggle off the auto-move
endif


I hope I understood you correctly, and that this may help.
User avatar
JD bernal
 
Posts: 3450
Joined: Sun Sep 02, 2007 8:10 am

Post » Tue May 03, 2011 6:15 am

I would like to request a command for swapping the first person skeleton. I won't expect that this will get done for obse 20. I think it would be able to solve the bug in http://tesnexus.com/downloads/file.php?id=36635, which adds a first person viewable body. The bug is where you can see behind your body when sneaking. Actually, I really want to do is set the 1st person camera pivot point. If you go into 3rd person and use the Show1stPerson command, you can see the first person skeleton rotates about this point. It appears that this point is initialized during the load of the 1st person skeleton and uses the position of the Camera01 node. Attempting to modify the Camera01 node using animations moves the camera but has no effect on the pivot point, and that's what causes the bug during sneaking. I expect that swapping the skeleton would reset the pivot point allowing me to fix the bug.

Also, would it be possible to create a version of PlayIdle that works on the player in 1st person? I was trying to move the pivot point using PickIdle but I noticed that it has a bug that prevents any more SpecialIdle animations from being played on the player. The bug can occur in both 1st and 3rd person and it will also be saved in the save game. It is possible to detect this bug using the player.sa (ShowAnim) console command. If you have the bug then there is a line that says "IdleAnim Queued: " with a blank line. The bug can be fixed if it happens in 3rd person by using Update3D or PlayIdle. But it's not possible to fix the bug in 1st person unless you make a clean save without the mod. Also, interestingly, it's only possible to get the bug in one point of view (either 1st or 3rd person), you can't have the bug in both at the same time. I created a script showing the known causes:

Spoiler
scn testPickIdleScriptfloat fQuestDelayTimeshort toggleAnimshort delayref animRefBegin GameModeif fQuestDelayTime != 0.001	message "test pickidle init"	set fQuestDelayTime to 0.001endif; Animation using PickIdle, doesn't work if you have the bugif OnKeyDown 47 ; V	printc "pickidle"	set toggleAnim to 1	player.PickIdleendif; Animation using PlayIdle, fixes bug in 3rd personif OnKeyDown 48 ; B	printc "playidle"	set animRef to TestAnim	player.PlayIdle animRef 1endif; Bug caused by Update3D to update the 3rd person skeleton.; Only causes the bug in 1st person. Fixes the bug in 3rd person.if OnKeyDown 49 ; N	printc "test update3d"	set toggleAnim to 1	player.PickIdle	if ( player.IsThirdPerson )		player.Update3D ; Doesn't occur in 3rd person	else		; Trick to update the 3rd person skeleton		; when in 1st person		ToggleFirstPerson 0		player.Update3D		ToggleFirstPerson 1	endifendif; Bug caused by opening character menu for both 1st and 3rd person one frame; before PickIdle. This can occur by opening the menu in-game as well.; I also tried a messagebox but it didn't cause the bug.if OnKeyDown 50 ; M	printc "test menu"	TapControl 15	set delay to 1elseif delay	set delay to delay - 1	if delay == 0		set toggleAnim to 1		player.PickIdle	endifendifif toggleAnim	set toggleAnim to 0endifEnd

User avatar
Brentleah Jeffs
 
Posts: 3341
Joined: Tue Feb 13, 2007 12:21 am

Post » Mon May 02, 2011 10:46 pm

Scruggsy, there might be an issue with GetMenuFloatValue, and generic menu 1011, I'm having an issue where I can get the value I desire from the console, however, the same code, doesn't work via a script.. (I also tried RunScriptLine, as a work around, and it didnt work, but, I may have used it wrong..)

I have Kyoma looking into it, and he hasn't responded in some time, so either he's just not messing with it, or I found something, or, perhaps, I did something so stupid that he's in shock and still can't respond.. :P

The very last post on this page, contains related info..
http://www.gamesas.com/index.php?/topic/1097119-relz-obse-plugin-menuque/page__st__140__gopid__17280631#entry17280631


----

Edit: Okay, so it turns out my GameMode block wasn't firing in MenuMode, so it just wasn't being updated... Now, I know MenuMode is generally for Menu stuff, however, I've always been able to use the GameMode block in the past, ever since the Morrowind days..

ie,.

Begin GameMode
if (MenuMode == 1)
DoSomething...
endif
End

What's up with that?
User avatar
flora
 
Posts: 3479
Joined: Fri Jun 23, 2006 1:48 am

Post » Tue May 03, 2011 3:22 am

Hi,

I had suggested new OBSE syntaxes, are they accepted?

GetTerrainSlope (or GetTerrainNormal) - return the slop (normal) of the terrain mesh at the specified x and y coordinates within the current exterior worldspace, for a distance d and a direction z
(height:float) GetTerrainSlope x:float y:float d:float z:float

ar_EraseAll - Erase all elements of all arrays of the current script

GetDimension - returns the object's current dimension in the specified axis.
(dimension:float) reference.GetDimension axis:axis

Thank you
User avatar
Lisa Robb
 
Posts: 3542
Joined: Mon Nov 27, 2006 9:13 pm

Post » Tue May 03, 2011 4:56 am

Edit: Okay, so it turns out my GameMode block wasn't firing in MenuMode, so it just wasn't being updated... Now, I know MenuMode is generally for Menu stuff, however, I've always been able to use the GameMode block in the past, ever since the Morrowind days..

ie,.

Begin GameMode
if (MenuMode == 1)
DoSomething...
endif
End

What's up with that?

Umm, MenuMode as you have it, will not work as expected in GameMode, because you're in GameMode, not MenuMode, MenuMode is only useful in the MenuMode block. You can however tell if you may be entering MenuMode mid-script run, but it's not 100%, such as invoking a menu in your script in GameMode, then the rest of the script will play out until the end of the block and will stop until you're out of MenuMode. Oblivion has limitations on the use of MenuMode and it's function unless the engine is currently in MenuMode (even if the GameMode script is still going).

The engine starts a block depending on what mode it's in Game or Menu. You can enter MenuMode mid-block on GameMode, which is why sometimes MenuMode in GameMode will return a value, but once the block finishes for that run, it will stop running until you re-enter GameMode. To avoid any cross-contamination with MenuMode, usually test MenuMode while in GameMode and do a return as such below, to avoid any code that could cause grief with your menu code.
  if (MenuMode)    return  endif


GuruSR.
User avatar
Chris Ellis
 
Posts: 3447
Joined: Thu Jul 26, 2007 10:00 am

Post » Mon May 02, 2011 8:42 pm

GetTerrainSlope (or GetTerrainNormal) - return the slop (normal) of the terrain mesh at the specified x and y coordinates within the current exterior worldspace, for a distance d and a direction z
(height:float) GetTerrainSlope x:float y:float d:float z:float


GetDimension - returns the object's current dimension in the specified axis.
(dimension:float) reference.GetDimension axis:axis


I support these two requests, especially the latter.
User avatar
Emma Louise Adams
 
Posts: 3527
Joined: Wed Jun 28, 2006 4:15 pm

Post » Mon May 02, 2011 8:54 pm

I support these two requests, especially the latter.
GetBoundingBox should help with that.
User avatar
Richard Dixon
 
Posts: 3461
Joined: Thu Jun 07, 2007 1:29 pm

Post » Mon May 02, 2011 10:46 pm

Saebel, what about this:


If Player.IsSneaking && Player.IsMovingForward && IsControlPressed 0 == 0
;if this returns true, player is sneaking and moving forward while the move-forward control is not being pressed
;which means that the auto-move must be toggled on
TapControl 12
;toggle off the auto-move
endif


I hope I understood you correctly, and that this may help.


Hi Maegraer,

Nice! It totally worked. Great outside the box thinking! I'm including it in the next release. :foodndrink:
User avatar
Laurenn Doylee
 
Posts: 3427
Joined: Sun Dec 03, 2006 11:48 am

Post » Tue May 03, 2011 3:51 am

I support these two requests, especially the latter.

Thank you.

A hope for :
ar_EraseAll - Erase all elements of all arrays of the current script?
User avatar
Eoh
 
Posts: 3378
Joined: Sun Mar 18, 2007 6:03 pm

Post » Tue May 03, 2011 5:23 am

http://www.obse.silverlock.org/obse_command_doc.html#ar_Erase provides this possibility (newly added in v20) by just leaving out the index/slice-parameter.


Edit: oh, sorry.
User avatar
Sammygirl500
 
Posts: 3511
Joined: Wed Jun 14, 2006 4:46 pm

Post » Tue May 03, 2011 4:56 am

http://www.obse.silverlock.org/obse_command_doc.html#ar_Erase provides this possibility (newly added in v20) by just leaving out the index/slice-parameter.

Docs says:
Users of OBSE 0020 or later may omit the second argument; doing so will erase all elements of the array.

But I specified:
ar_EraseAll - Erase all elements of all arrays of the current script
User avatar
suzan
 
Posts: 3329
Joined: Mon Jul 17, 2006 5:32 pm

Post » Mon May 02, 2011 7:44 pm

ok...this one has me grinding my teeth.

I have a token script (token on the NPC that is being shot at).
Once the arrow is fired by the player the arrow ref is loged as ARROWREF and a float called OldSkillLevel is set by "set OldSkillLevel to IncrementPlayerSkillUse marksman".

I use some defensive scripting to be sure the arrowref is good as the arrow shoots from the player to the npc and if the arrowref reference is no longer valid or is disabled or what ever I change arrowref to 0.

Then:

if Arrowref != 0    if IncrementPlayerSkillUse > OldSkillLevel       messagebox"Arrow hit NPC"         set Arrowref to 0    endifendif


Now this works every time! But it should not work. I erroneously thought that "IncrementPlayerSkillUse" was a way to detect when marksman skill went up from landing a shot. The OBSE docs was not clear to me or I misunderstood the description. Then I found more descriptions on the Wiki that made me realize I was in error. I read I should be using (GetPlayerSkillUse marksman) instead. HOWEVER when I change the line to "set OldSkillLevel to GetPlayerSkillUse marksman" and "If (GetPlayerSkillUse marksman) > OldSkillLevel" the script no longer worked! I changed it back to "IncrementPlayerSkillUse" and it works.

What the heck is going on? Am I still confused as to what exactly these functions are suppose to be doing?
User avatar
Matt Bee
 
Posts: 3441
Joined: Tue Jul 10, 2007 5:32 am

PreviousNext

Return to IV - Oblivion