[BETA] Oblivion Script Extender (OBSE) v0018

Post » Fri May 27, 2011 4:56 am

Continuing from the http://www.gamesas.com/bgsforums/index.php?showtopic=1031323.


The Oblivion Script Extender, or OBSE for short, is a modder's resource that expands the scripting capabilities of Oblivion. It doesn't make any modifications to oblivion.exe, TESConstructionSet.exe, or any other files in your oblivion install, so don't worry about permanent side effects. As of v0017, OBSE requires the 1.2.0.416 version of Oblivion.

http://obse.silverlock.org/download/obse_0017b.zip - current stable version
http://obse.silverlock.org/beta/obse_0018_beta_4.zip - beta version, only use if you are interested in testing new functionality
http://obse.silverlock.org/
http://obse.silverlock.org/obse_command_doc.html

Please note: Due to changes in bytecode, scripts compiled using OBSE 0018 beta 2 or later will require the user to have 0018 beta 2 or later installed. Because beta 4 fixes several bugs, it is recommended that all testers upgrade to the most recent beta.

whatsnew:
0018 beta 4:
-GetRaceScale,
-GetCurrentPackage, GetCurrentEditorPackage
-GetWorldspaceParentWorldSpace
-QuestExists, GlobalVariableExists
-StringToActorValue
-Fix MapMarker bugs from b3
-Fix GetEquipmentSlot and GetequippedObject with the Torch/Light slot
-Fixes for OutputLocalMapPicturesOverride
-Fixes for Set/ModEquippedCurrentHealth
-Fix for errant problems with array access
-Fix for various expression parsing errors


v0018 New functions:
    Function    Call    SetFunctionValue    GetClassSkills    SetClassSkills    SetClassSpecialization    SetClassAttribute    SetClassAttributeC    GetCreatureModelPaths    GetUserTime    GetSkillGoverningAttribute    SetSkillGoverningAttribute    GetSkillGoverningAttributeC    SetSkillGoverningAttributeC    ActorValueToCode    GetPlayerBirthsign    GetBirthsignSpells    GetActorAlpha    RemoveBaseSpell    GetMapMenuMarkerName    GetMapMenuMarkerRef    GetWeatherClassification    ToNumber    GetActiveEffectCodes    GetActiveEffectCasters    GetCurrentRegions    SetPackageTarget    GetBaseAV2    GetBaseAV2C    GetSpecialAnims    ToggleSpecialAnim    GetLeveledSpells    GetDescription    sv_Split    ar_List    ar_Resize    ar_Insert    ar_InsertRange    GetGameDifficulty    SetGameDifficulty    SetCurrentCharge    ModCurrentCharge    SetDoorTeleport    GetDoorTeleportX    GetDoorTeleportY    GetDoorTeleportZ    GetDoorTeleportRot    GetCellDetachTime    GetCellResetHours    SetCellResetHours    PrintD    GetPCLastDroppedItem    GetPCLastDroppedItemRef    GetTelekinesisRef    GetActorPackages    GetOblivionDirectory    IsClassSkillC    IsClassAttributeC    SetPlayerBirthsign    GetPlayerSkillUseC    Get/Set Package Flags    Get/SetCombatStyleIgnoreAlliesInArea    Get/SetCombatStyleWillYield    Get/SetCombatStyleRejectsYields    Get/SetCombatStyleFleeingDisabled    Get/SetCombatStylePrefersRanged    Get/SetCombatStyleMeleeAlertOK    GetWaterShader    SetOLMPGrids    OutputLocalMapPicturesOverride    GetGridsToLoad    con_outputLocalMapPictures    GetRaceReaction    TriggerPlayerSkillUse    TriggerPlayerSkillUseC    SetCurrentHealth    ModPlayerSkillExp    ModPlayerSkillExpC    GetPlayerSkillAdvances    GetPlayerSkillAdvancesC    SetPlayerSkillAdvances    SetPlayerSkillAdvancesC    GetRaceScale    GetCurrentPackage    GetCurrentEditorPackage    GetWorldSpaceParentWorldSpace    QuestExists    GlobalVariableExists    StringToActorValue

User avatar
Ross Thomas
 
Posts: 3371
Joined: Sat Jul 21, 2007 12:06 am

Post » Fri May 27, 2011 11:14 am

How should I detect a control and a modifier?

Why do I not see the message with this?
		if(OnControlDown 5 && OnKeyDown 42)			PrintC "Found Act + LShift"		endif

User avatar
Ella Loapaga
 
Posts: 3376
Joined: Fri Mar 09, 2007 2:45 pm

Post » Fri May 27, 2011 8:22 am

How should I detect a control and a modifier?

Why do I not see the message with this?
		if(OnControlDown 5 && OnKeyDown 42)			PrintC "Found Act + LShift"		endif
Because you'll never be able to press both keys at once, so it will always detect one key, then the next frame the other. Use IsKeyPressed3 for the modifier key instead. Although that way you'll need to press the modifier key before pressing the other key.

Question of my own, well more of a request. A way to redirect a messagebox to a specific script. As in, calling MessageBox(Ex) from one script but the game will think it came from another script, thus GetButtonPressed can be used from that script. Useful for MessageBoxes from result script but I can think of a few other uses aswell.

[edit]How are things going with the non-beta release? I assume the biggest holdup is the issue tejon brought up?[/edit]

-kyoma
User avatar
Naughty not Nice
 
Posts: 3527
Joined: Sat Nov 04, 2006 6:14 am

Post » Thu May 26, 2011 10:39 pm

It really is all my fault. :(
User avatar
Miss Hayley
 
Posts: 3414
Joined: Tue Jun 27, 2006 2:31 am

Post » Fri May 27, 2011 7:14 am

It really is all my fault. :(
Yes it is, yes it is..... :nono:
User avatar
Bee Baby
 
Posts: 3450
Joined: Sun Jun 18, 2006 4:47 am

Post » Fri May 27, 2011 1:22 am

Because you'll never be able to press both keys at once, so it will always detect one key, then the next frame the other. Use IsKeyPressed3 for the modifier key instead. Although that way you'll need to press the modifier key before pressing the other key.

Thanks.

Why do I see the message now, but still get the default activation?
Let r := GetCrosshairRefif(r)	if(r.GetObjectType == TypeWeWant)		DisableControl 5		if(OnControlDown 5 && IsKeyPressed3 42)			PrintC "Found Act + LShift"		else			EnableControl 5		endif	endifendif

User avatar
Daniel Brown
 
Posts: 3463
Joined: Fri May 04, 2007 11:21 am

Post » Fri May 27, 2011 4:44 am

Thanks.

Why do I see the message now, but still get the default activation?
Let r := GetCrosshairRefif(r)	if(r.GetObjectType == TypeWeWant)		DisableControl 5		if(OnControlDown 5 && IsKeyPressed3 42)			PrintC "Found Act + LShift"		else			EnableControl 5		endif	endifendif
OnControlDown probably detects disabled controls just like its sibling OnKeyDown detects disabled keys.
User avatar
Karen anwyn Green
 
Posts: 3448
Joined: Thu Jun 15, 2006 4:26 pm

Post » Fri May 27, 2011 1:30 pm

OnControlDown probably detects disabled controls just like its sibling OnKeyDown detects disabled keys.

It does, which is how I handle map marker clicking in Map Marker Overhaul. So when you disable the control key, you can set a variable, i.e. "let activation_disabled := 1", and then check for that value when deciding what to do.
User avatar
Bad News Rogers
 
Posts: 3356
Joined: Fri Sep 08, 2006 8:37 am

Post » Fri May 27, 2011 11:51 am

OnControlDown probably detects disabled controls just like its sibling OnKeyDown detects disabled keys.

Sorry, perhaps I wasn't clear. I'm asking why I get the default activation behaviour despite disabling the use control?
User avatar
Melly Angelic
 
Posts: 3461
Joined: Wed Aug 15, 2007 7:58 am

Post » Fri May 27, 2011 9:50 am

Sorry, perhaps I wasn't clear. I'm asking why I get the default activation behaviour despite disabling the use control?
Oh no, you were clear. I was looking with the other set of eyes. :facepalm: Um not sure why it would still activate normally. Could be another mod that re-enables the activate control after it did something.
User avatar
vanuza
 
Posts: 3522
Joined: Fri Sep 22, 2006 11:14 pm

Post » Fri May 27, 2011 1:35 am

I'm trying to get the magnitude of a magic effect from enchantments. I'm using this code, but it somehow doesn't reports correct value.

set gauntlets to player.getequippedobject 4set enchantment to getenchantment gauntletsif ( enchantment != 0)	if ( magicitemhaseffect FISH enchantment )     ;;fire shield		set count to magicitemhaseffectcount FISH enchantment		set magfireshield to getntheimagnitude enchantment count	endifendif


Did I do something wrong?
User avatar
marie breen
 
Posts: 3388
Joined: Thu Aug 03, 2006 4:50 am

Post » Fri May 27, 2011 12:05 am

I'm trying to get the magnitude of a magic effect from enchantments. I'm using this code, but it somehow doesn't reports correct value.

Did I do something wrong?
Incorrect function usage - magicitemhaseffectcount doesn't return the index of the effect item. You'll need to walkthough the magic item's effect items and do your checks on each.
User avatar
jasminε
 
Posts: 3511
Joined: Mon Jan 29, 2007 4:12 am

Post » Fri May 27, 2011 1:03 pm

Wrong function usage - magicitemhaseffectcount doesn't return the index of the effect item. You'll need to walkthough the magic item's effect items and do you comparisons on each.


Aha! Thank you!? :) Back to the while-loop then...
User avatar
luke trodden
 
Posts: 3445
Joined: Sun Jun 24, 2007 12:48 am

Post » Thu May 26, 2011 11:39 pm

[edit]How are things going with the non-beta release? I assume the biggest holdup is the issue tejon brought up?[/edit]

Pretty much. :)
Stephen tracked down the cause of the problem last evening. We need to relocate our LoadGame hook. IIRC there were a few minor outstanding issues as well. I am still trying to get back into the swing of things.
Thanks.

Why do I see the message now, but still get the default activation?
Let r := GetCrosshairRefif(r)	if(r.GetObjectType == TypeWeWant)		DisableControl 5		if(OnControlDown 5 && IsKeyPressed3 42)			PrintC "Found Act + LShift"		else			EnableControl 5		endif	endifendif

I/O doesn't work like that in scripts. In order for this code to have any effect the user would have to press your key combination at a precise moment between lines 4 and 8 above.
If you are using key #42 as a sort of modifier key for activation to do some alternate activation I suggest disabling control 5 whenever key #42 is held down and re-enabling it when released.
User avatar
meg knight
 
Posts: 3463
Joined: Wed Nov 29, 2006 4:20 am

Post » Fri May 27, 2011 5:42 am

Thanks scruggsy.
User avatar
Camden Unglesbee
 
Posts: 3467
Joined: Wed Aug 15, 2007 8:30 am

Post » Fri May 27, 2011 12:33 am

Quick question: What would happen if I called DeleteReference on an object to which the object script was attached to, like:

scn ANRLVarlaStoneLightScriptBegin OnActivate playerdisableDeleteReferenceplayer.AddItem VarlaStone 1End


Since I've just removed what the script is running on, will the player.additem line not run, or will the script terminate on completion?
User avatar
Monika
 
Posts: 3469
Joined: Wed Jan 10, 2007 7:50 pm

Post » Fri May 27, 2011 1:26 pm

Did some testing on optional arguments - Didn't see any screw ups. The local variable that stores the argument remains uninitialized and the function doesn't have any issues with that. In essence, un-passed (leading) arguments practically pass 0 to the function.

Any chance of proper support in 18 Final ?
User avatar
stephanie eastwood
 
Posts: 3526
Joined: Thu Jun 08, 2006 1:25 pm

Post » Fri May 27, 2011 8:50 am

I didn't see that this got answered in the last thread so I'll repost:
If I wanted to make the HUD slowly disappear until it's invisible in 5 seconds, would the script be something like this:
float alphaOLDfloat alphachangeshort donebegin gamemodeif done == 0	 set alphaOLD to Getmenufloatvalue "HUDxmlfilestuff/alpha" 1004; I presume its just called alpha	 set done to 1endifif done == 1 	 set alphachange to 100 - (100/5) * GetSecondsPassed	 setMenuFloatvalue to "HUDxmlfilestuff/alpha" 1004 alphachange	 if alphachange == 0		  set done to 2	 endifendifend

[/quote]
User avatar
-__^
 
Posts: 3420
Joined: Mon Nov 20, 2006 4:48 pm

Post » Thu May 26, 2011 10:50 pm

Can anyone shed some light on why this doesn't work?

scn ANRLSkydomeScriptref Dome;Monitors day/night to toggle the animation state of the skydome object.Begin GameMode	if( player.IsInInterior == 0 )		return	endif	set Dome to Player.GetFirstRef 28	while (Dome)message "in loop"		if( Dome.ModelPathIncludes "skydome" )message "found skydome"			if( gamehour >= 6 || gamehour < 20 )				Dome.playgroup Stagger 1message "stagger"			else				Dome.playgroup Unequip 1message "unequip"			endif		endif		set Dome to Player.GetNextRef	loopEnd


All I ever see for testing are the "in loop" message. No message that the dome was found and of course nothing else processes either.
User avatar
Batricia Alele
 
Posts: 3360
Joined: Mon Jan 22, 2007 8:12 am

Post » Thu May 26, 2011 10:47 pm

That would imply that it's not finding the Dome. Maybe have an Else line that reports the name of each object found? That way you can see if it's ever finding the appropriate object (use a doOnce though to prevent re-iteration, or you'll have a very long list).

ConScribe will make your life much easier.
User avatar
Soph
 
Posts: 3499
Joined: Fri Oct 13, 2006 8:24 am

Post » Fri May 27, 2011 7:17 am

Is Player.GetFirstRef correct? Compared to: set Dome to GetFirstRef 28.
User avatar
Louise Lowe
 
Posts: 3262
Joined: Fri Jul 28, 2006 9:08 am

Post » Fri May 27, 2011 12:24 am

Er. No. Time for *facepalm*. It was because I used || instead of && in the gamehour check. Oops. Everything else worked fine except that :P
User avatar
Lynette Wilson
 
Posts: 3424
Joined: Fri Jul 14, 2006 4:20 pm

Post » Fri May 27, 2011 4:27 am

GetBookSkillTaught can only be used with base objects, despite what the docs claim?

Let b := r.GetBaseObjectPrint "Skill: " + $GetBookSkillTaught b

is fine, but this isn't :

Print "Skill: " + $r.GetBookSkillTaught

EDIT:
From the Command Doc:
GetBookSkillTaught - returns the skill taught by the book. If no skill is taught, returns 255.

I'm only seeing the correct result in an if eval with -1.
User avatar
Rebecca Clare Smith
 
Posts: 3508
Joined: Fri Aug 04, 2006 4:13 pm

Post » Fri May 27, 2011 3:37 am

Is it possible to convert between OBSE strings and Pluggy strings?
User avatar
Jason Wolf
 
Posts: 3390
Joined: Sun Jun 17, 2007 7:30 am

Post » Fri May 27, 2011 1:51 pm

Is it possible to convert between OBSE strings and Pluggy strings?

Yes, with the latest functions in http://tesnexus.com/downloads/file.php?id=23979
FromOBSE (STILL IN DEV PHASE !!!) (alt: FromOBSEString)Imports an OBSE string to a Pluggy string.Note that this is preferable to "SetString PluggyStringID $OBSEStringVar", as that method has a 256 character limit.		   FromOBSE <PluggyStringID:long> <OBSEString:long> <Global:long>

ToOBSE (STILL IN DEV PHASE !!!) (alt: ToOBSEString)Exports a Pluggy string to an OBSE string.Note that you must use Set instead of Let - i.e., "Set sOBSEvar to ToOBSE PluggyStringID".		   (OBSEStringID:short) ToOBSE <StringID:long>

User avatar
Dylan Markese
 
Posts: 3513
Joined: Sat Dec 01, 2007 11:58 am

Next

Return to IV - Oblivion