[BETA] Oblivion Script Extender (OBSE) v0020

Post » Sat Sep 04, 2010 8:17 am

if(r.IsOffLimits 7 == 0)


Want to replace that 7 with, to get rid of the magic number, but I can't get OBSE to accept the line.
User avatar
Céline Rémy
 
Posts: 3443
Joined: Sat Apr 07, 2007 12:45 am

Post » Sat Sep 04, 2010 6:46 am

Is it just me, or does this not work?

scn TestQref spellbegin GameMode    set spell to ErikTestSpell1    PrintToConsole "%p" spellend

Prints "NULL", and "show TestQ.spell" prints 0.0 also. The spell var should be set to the reference of ErikTestSpell1, but it's not. The same happens with other spell references (haven't tried other types of references).
User avatar
James Hate
 
Posts: 3531
Joined: Sun Jun 24, 2007 5:55 am

Post » Sat Sep 04, 2010 1:03 pm

Is it just me, or does this not work?

scn TestQref spellbegin GameMode    set spell to ErikTestSpell1    PrintToConsole "%p" spellend

Prints "NULL", and "show TestQ.spell" prints 0.0 also. The spell var should be set to the reference of ErikTestSpell1, but it's not. The same happens with other spell references (haven't tried other types of references).

Two separate issues here:
-show TestQ.spell will print 0.0 no matter what the actual contents of the variable are, because Show only works with numeric variables. Use SQV TestQ and the spell variable should show up in the list with the correct formID. Yes, it's annoying.
-"%p" isn't a valid format specifier. To print the name of an object, use %n. To print the formID, use %i. "%p?" prints a pronoun appropriate for the passed object where the "?" is replaced by a required character as follows:
%p - replaced with a pronoun based on the gender of the object parameter passed in a ref variable:%ps - subjective (he, she, it)%pp - possessive (his, her, its)%po - objective (him, her, it)

Docs could maybe be clearer on this (as usual).
if(r.IsOffLimits 7 == 0)


Want to replace that 7 with, to get rid of the magic number, but I can't get OBSE to accept the line.

I'm assuming you're using the compiler override, otherwise that should compile.
OBSE doesn't accept formIDs as arguments. Fortunately, it also doesn't have the vanilla compiler's annoying habit of treating "player" (the base NPC) as "playerRef" (the reference), unless "player" is on the left hand side of a dot where there's no ambiguity.
So this should be equivalent:
if eval (r.IsOffLimits player) == 0

User avatar
Sam Parker
 
Posts: 3358
Joined: Sat May 12, 2007 3:10 am

Post » Sat Sep 04, 2010 9:54 am

I'm assuming you're using the compiler override, otherwise that should compile.

Pretend I've been away from Oblivion for some time: What compiler Override?

OBSE doesn't accept formIDs as arguments. Fortunately, it also doesn't have the vanilla compiler's annoying habit of treating "player" (the base NPC) as "playerRef" (the reference), unless "player" is on the left hand side of a dot where there's no ambiguity.
So this should be equivalent:
if eval (r.IsOffLimits player) == 0

Copying that line gives me 'Invalid NPC for parameter npc.' and 'Could not parse this line'.
User avatar
Ludivine Dupuy
 
Posts: 3418
Joined: Tue Mar 27, 2007 6:51 pm

Post » Sat Sep 04, 2010 5:10 am

Pretend I've been away from Oblivion for some time: What compiler Override?

Copying that line gives me 'Invalid NPC for parameter npc.' and 'Could not parse this line'.

Gonna need to see the full script then.
User avatar
Nadia Nad
 
Posts: 3391
Joined: Thu Aug 31, 2006 3:17 pm

Post » Sat Sep 04, 2010 2:59 pm

Gonna need to see the full script then.

scriptname aaaDBBAMScriptref			bstring_var	BookNameref			BookScriptlong		BookTypeshort		BookWeHandleref			CrimeTokenshort		DefaultModifiedIsDefaultlong		DefaultModifier1long		DefaultModifier2short		DefaultShowSBMessagestring_var	DefaultUserSBMessageshort		DisabledUseref			DoInishort		DoOncefloat		fQuestDelayTimeref			InsertBookNameshort		ModKeyDownshort		ModifiedIsDefaultlong		Modifier1long		Modifier2long		NoSkillstring_var	Pluggyref			rref			ScriptTokenstring_var	SBMessagearray_var	SBMessagesshort		ShowSBMessagelong		Usestring_var	UserSBMessagelong		Valueshort		VersionBegin GameModeif(GetGameLoaded)	Let fQuestDelayTime := .001		if eval(!DoOnce)		Let Version := 143			Let DoOnce := 1	endif		SetDebugMode 1		Let BookType 					:= 21	Let DefaultModifiedIsDefault	:= 0	Let DefaultModifier1			:= 42 ; LShift	Let DefaultModifier2			:= 54 ; RShift	Let DefaultShowSBMessage 		:= 1	Let DefaultUserSBMessage		:= "No user-defined message"	Let DisabledUse					:= 0	Let DoIni						:= aaaDBBAMDoIniScript	Let InsertBookName				:= aaaDBBAMInsertBookNameScript	Let	NoSkill						:= -1	Let Pluggy						:= "OBSE_Elys_Pluggy"	Let Use 						:= 5			Print "About to check for pluggy"	if(IsPluginInstalled $Pluggy)		if((GetPluginVersion $Pluggy) >= 131)			PrintD "DBBAM: Processing ini"			Call DoIni		else			PrintD "DBBAM: Incorrect version of Pluggy found"		endif	else		PrintD "DBBAM: Pluggy not found"	endif		Let SBMessages := ar_Construct Array	Let SBMessages[0] := "" ; dummy	Let SBMessages[1] := "You feel you may learn something from %BOOKNAME%"	Let SBMessages[2] := "I feel I may learn something from %BOOKNAME%"	Let SBMessages[3] := UserSBMessage		if(ShowSBMessage < 0 || ShowSBMessage > 3)		Let ShowSBMessage := 1	endif		PrintC "DBBAM v1.43: Initialized"endifif(BookScript)	ScriptToken.activate player 1	player.removeitemNS aaaDBBAMScriptToken 1	Let BookScript := 0endifLet BookWeHandle := 0if(DisabledUse)	EnableControl Use	Let DisabledUse := 0endifLet r := GetCrosshairRefif(r)	if(r.GetObjectType == BookType && r.GetBookCantBeTaken == 0)		Let BookWeHandle := 1	endifendifif(BookWeHandle == 0)	returnendifif(IsKeyPressed3 Modifier1 || IsKeyPressed Modifier2)		Let ModKeyDown := 1else	Let ModKeyDown := 0endif	if((ModifiedIsDefault == 0 && ModKeyDown == 0) || (ModifiedIsDefault && ModKeyDown))	returnendifDisableControl UseLet DisabledUse := 1				if(OnControlDown Use)		Let b := r.GetBaseObject	if eval (r.IsOffLimits player) == 0		player.additemNS b 1	else		aaaDBBAMChestRef.additem b 1		Let Value := r.GetGoldValue		Let CrimeToken := aaaDBBAMChestRef.placeatme aaaDBBAMCrimeToken 1		CrimeToken.setgoldvalue Value		CrimeToken.activate player		player.removeitemNS aaaDBBAMCrimeToken 1		aaaDBBAMChestRef.removeallitems player 1	endif		aaaDBBAMShadowNPCRef.moveto player	aaaDBBAMShadowNPCRef.enable	r.activate aaaDBBAMShadowNPCRef	aaaDBBAMShadowNPCRef.disable	Let BookScript := GetScript b	if(BookScript)		Let ScriptToken := aaaDBBAMMarkerGood.placeatme aaaDBBAMScriptToken 1		ScriptToken.SetScript BookScript		ScriptToken.moveto player	endif		if eval(ShowSBMessage && GetBookSkillTaught b != NoSkill)		Let BookName := GetName b		Let SBMessage := Call InsertBookName SBMessages[ShowSBMessage] BookName		message $SBMessage	endifendif	End

User avatar
Big mike
 
Posts: 3423
Joined: Fri Sep 21, 2007 6:38 pm

Post » Sat Sep 04, 2010 1:50 pm

@Derek: Okay. The error about "invalid NPC" is the vanilla compiler helpfully translating "player" to "playerRef", which is why you were using "7" instead in the first place.
All of the following compile without error for me:
if(r.IsOffLimits 7 == 0)if eval (r.isofflimits 7) == 0if r.isofflimits 7 == 0; and so on

User avatar
Alexx Peace
 
Posts: 3432
Joined: Thu Jul 20, 2006 5:55 pm

Post » Sat Sep 04, 2010 1:11 am

@Derek: Okay. The error about "invalid NPC" is the vanilla compiler helpfully translating "player" to "playerRef", which is why you were using "7" instead in the first place.
All of the following compile without error for me:
if(r.IsOffLimits 7 == 0)if eval (r.isofflimits 7) == 0if r.isofflimits 7 == 0; and so on


Yes, but none of them have a word or words instead of the 7.
User avatar
djimi
 
Posts: 3519
Joined: Mon Oct 23, 2006 6:44 am

Post » Sat Sep 04, 2010 1:31 am

Yes, but none of them have a word or words instead of the 7.

Right.
If you try to use "player" here, you'll get the error about an "invalid NPC" for the reason above ("player" treated as "playerRef", which is a reference, not an NPC), which is why using "7" is necessary instead. This is an issue with the vanilla compiler, not OBSE.
If you want to omit the NPC argument altogether, causing the player to be used by default, then these compile:
if r.isofflimits == 0if (r.isofflimits == 0)if eval  (r.isofflimits) == 0; and so on

If this doesn't help you should probably post the actual code you were using when you made your initial post.
User avatar
Laura-Jayne Lee
 
Posts: 3474
Joined: Sun Jul 02, 2006 4:35 pm

Post » Sat Sep 04, 2010 2:20 pm

Right.
If you try to use "player" here, you'll get the error about an "invalid NPC" for the reason above ("player" treated as "playerRef", which is a reference, not an NPC), which is why using "7" is necessary instead. This is an issue with the vanilla compiler, not OBSE.
If you want to omit the NPC argument altogether, causing the player to be used by default, then these compile:
if r.isofflimits == 0if (r.isofflimits == 0)if eval  (r.isofflimits) == 0; and so on

If this doesn't help you should probably post the actual code you were using when you made your initial post.

if eval (!r.IsOffLimits (playerref.GetBaseObject))

Seems to work.
User avatar
Melung Chan
 
Posts: 3340
Joined: Sun Jun 24, 2007 4:15 am

Post » Sat Sep 04, 2010 2:05 pm

if eval (!r.IsOffLimits (playerref.GetBaseObject))

Seems to work.

It should. But if r.isofflimits == 0 ought to work too (and does here).
User avatar
Rob Smith
 
Posts: 3424
Joined: Wed Oct 03, 2007 5:30 pm

Post » Sat Sep 04, 2010 12:16 am

Two separate issues here:
-show TestQ.spell will print 0.0 no matter what the actual contents of the variable are, because Show only works with numeric variables. Use SQV TestQ and the spell variable should show up in the list with the correct formID. Yes, it's annoying.
-"%p" isn't a valid format specifier. To print the name of an object, use %n. To print the formID, use %i. "%p?" prints a pronoun appropriate for the passed object where the "?" is replaced by a required character as follows:
%p - replaced with a pronoun based on the gender of the object parameter passed in a ref variable:%ps - subjective (he, she, it)%pp - possessive (his, her, its)%po - objective (him, her, it)

Docs could maybe be clearer on this (as usual).

Oh so it is just me :P, thanks. I confused %p with %p in C. My real issue is actually something else but I'm close to solving it.
User avatar
Ronald
 
Posts: 3319
Joined: Sun Aug 05, 2007 12:16 am

Post » Sat Sep 04, 2010 2:01 pm

Well, we aim for backwards compatibility. I'll get in touch with StrategyMaster to find out what he thinks may be going on here and see about resolving it on our end.

Following up on this: it turns out to be a threading issue - I failed to update the code that manages foreach/while loops back when we discovered that token scripts can run concurrently. Fix is in and will be included in the next beta, thanks for the helpful reports.
User avatar
Spooky Angel
 
Posts: 3500
Joined: Thu Aug 10, 2006 5:41 pm

Post » Sat Sep 04, 2010 4:50 am

Great! Did this sneak in with OBSE 19 then?

Edit: Saw your post in SM's thread - looks like it snuck in in OBSE 18. Funny that these errors just started to crop up now though... Anyway, glad it's sorted!
User avatar
Talitha Kukk
 
Posts: 3477
Joined: Sun Oct 08, 2006 1:14 am

Post » Sat Sep 04, 2010 1:50 pm

Token scripts can run concurrently?
User avatar
i grind hard
 
Posts: 3463
Joined: Sat Aug 18, 2007 2:58 am

Post » Sat Sep 04, 2010 7:10 am

Token scripts can run concurrently?

Yeah, annoyingly and probably unintentionally on Beth's part since their code isn't actually designed for it (induces crashes caused by token scripts when quick-loading among other things).
You'll see it most frequently when the game does background loading while transitioning between exterior cells.
Great! Did this sneak in with OBSE 19 then?

Edit: Saw your post in SM's thread - looks like it snuck in in OBSE 18. Funny that these errors just started to crop up now though... Anyway, glad it's sorted!

The potential has been there since loops were introduced but until 0019 we had code in place to prevent script execution during background loading (see above) for other reasons, which incidentally prevented loops from ever executing in parallel. That code's now gone because it breaks an obscure scripting technique used in at least one older mod, so it was only a matter of time before this issue became visible.
User avatar
Shianne Donato
 
Posts: 3422
Joined: Sat Aug 11, 2007 5:55 am

Post » Sat Sep 04, 2010 9:20 am

Hrm. Any guidelines for token scripts then to avoid concurrency issues? Things like avoiding setting shared variables? Functions to avoid that aren't thread-safe?

Or is it pretty much just a matter of luck as to whether a token script has the potential to cause problems?
User avatar
josie treuberg
 
Posts: 3572
Joined: Wed Feb 07, 2007 7:56 am

Post » Sat Sep 04, 2010 3:09 am

I don't know. I seem to recall reading somewhere that scripts compiled using OBSE v18 or 19 (and I assume 20) will require that version of OBSE even if no OBSE commands were used.

Scruggs: this sounds wrong to me, but I also remember something sort of like that - could you explain what the exact issue is/was?
User avatar
Trevi
 
Posts: 3404
Joined: Fri Apr 06, 2007 8:26 pm

Post » Sat Sep 04, 2010 1:04 pm

Scruggs: this sounds wrong to me, but I also remember something sort of like that - could you explain what the exact issue is/was?

General rule: If you don't use any OBSE features, your users don't need OBSE. If you do use OBSE commands, recommend your users use the same version of OBSE you compiled with (or newer).

More technically: If you use OBSE expressions, expect your users to use the same version or newer.

Specifically: 0019 modified the bytecode representation used when compiling assignment of strings to string variables and array elements. If your code does this kind of assignment and is compiled with 0019, your users will need to use 0019 (or later) as well. Similar changes may occur in future releases. These will always be backward-compatible, but not necessarily forward-compatible. The more general rules above will prevent you having to worry about the technical details.
User avatar
Margarita Diaz
 
Posts: 3511
Joined: Sun Aug 12, 2007 2:01 pm

Post » Sat Sep 04, 2010 5:16 am

I'm assuming you're using the compiler override, otherwise that should compile.

Again, what 'compiler override'?
User avatar
(G-yen)
 
Posts: 3385
Joined: Thu Oct 11, 2007 11:10 pm

Post » Sat Sep 04, 2010 4:11 am

I've had two corrupt Streamsaves after updating from 18 to 19b. I also had issues with Realistic Fatigue after updating, which was fixed by making a clean save. Not sure what caused the corrupt Streamsaves, but I'll delete the Streamsaves and start over with a clean save with Streamline as well. My question is if it's generally recommended to make clean saves with OBSE-dependent mods when updating OBSE? Or is it generally safe to just update OBSE and continue?

EDIT: Hm, I still have issues with Streamsaves even after a clean save and deleting the previous streamsaves. The very first Streamsave CTDd the game. They have always been very stable for me so I wonder what it might be. :( But seems more appropriate for a post in the Streamline thread perhaps - I'll post there instead.
User avatar
SiLa
 
Posts: 3447
Joined: Tue Jun 13, 2006 7:52 am

Post » Sat Sep 04, 2010 9:19 am

I have had http://www.gamesas.com/index.php?/topic/1119708-relz-enhanced-hotkeys/page__view__findpost__p__16906707 of problems with Enhanced Hotkeys when upgrading OBSE to 20. I tested myself, but didn't notice the problem myself. Enhanced Hotkey has a heavy use of GetKeyPress and IsKeyPressed2, and it seems that the problem lays there somewhere. I seem to recall that there was another report of issue with IsKeyPressed2 and OBSE 20 - is there any change there or something I could look for?
User avatar
Stephy Beck
 
Posts: 3492
Joined: Mon Apr 16, 2007 12:33 pm

Post » Sat Sep 04, 2010 11:48 am

Again, what 'compiler override'?

Description and sample code http://obse.silverlock.org/obse_command_doc.html#Compiler_Override. Basically it lets you be more flexible/concise when passing arguments to commands.
I've had two corrupt Streamsaves after updating from 18 to 19b. I also had issues with Realistic Fatigue after updating, which was fixed by making a clean save. Not sure what caused the corrupt Streamsaves, but I'll delete the Streamsaves and start over with a clean save with Streamline as well. My question is if it's generally recommended to make clean saves with OBSE-dependent mods when updating OBSE? Or is it generally safe to just update OBSE and continue?

PM'ed my email address if you want to send the affected saves.
I have had http://www.gamesas.com/index.php?/topic/1119708-relz-enhanced-hotkeys/page__view__findpost__p__16906707 of problems with Enhanced Hotkeys when upgrading OBSE to 20. I tested myself, but didn't notice the problem myself. Enhanced Hotkey has a heavy use of GetKeyPress and IsKeyPressed2, and it seems that the problem lays there somewhere. I seem to recall that there was another report of issue with IsKeyPressed2 and OBSE 20 - is there any change there or something I could look for?

Should be resolved in the next beta (i.e. shortly).
User avatar
sarah taylor
 
Posts: 3490
Joined: Thu Nov 16, 2006 3:36 pm

Post » Sat Sep 04, 2010 11:08 am

Description and sample code http://obse.silverlock.org/obse_command_doc.html#Compiler_Override. Basically it lets you be more flexible/concise when passing arguments to commands.

Cool. Thanks.
User avatar
patricia kris
 
Posts: 3348
Joined: Tue Feb 13, 2007 5:49 am

Post » Sat Sep 04, 2010 3:07 pm

Hi! I'm having some really strange issues getting the Construction Set + OBSE to run.
First off, I find myself unable to have more than a certain arbitrary number of OBSE plugins in the folder before the CS crashes on start! That number is currently eleven.
In addition, there are some plugins that cause it to crash instantly when used together! Here's a (hopefully) explanatory list.
    These ones seem to work fine;
    weOCPS.dll
    sr_Oblivion_Stutter_Remover.dll
    SoundCommands.dll
    OBSE_Kyoma_MenuQue.dll
    OBSE_Elys_Pluggy_HUD.dll
    OblivionEAX.dll
    INIZer.dll
    FastExit2.dll
    Elys_USV.dll
    Construction Set Extender.dll
    These ones crash it when used together (but not separately);
    ConScribe.dll
    refstuff_plugin.dll
    OBGEv2.dll
    This one crashes it no matter what!
    EnhancedMusicControl.dll

Unfortunately, I don't really know anything else that could be said about the problem - but help would be appreciated.
User avatar
Jonny
 
Posts: 3508
Joined: Wed Jul 18, 2007 9:04 am

PreviousNext

Return to IV - Oblivion