[BETA] Oblivion Script Extender (OBSE) 0018

Post » Fri May 27, 2011 6:06 am

OBSE already has it. http://obse.silverlock.org/obse_command_doc.html#TextInputFunctions

Ups, feel really silly that I missed it in documentation.. :banghead:

I'm pretty sure it's never triggered.

Ok, at least it means that using
begin MenuMode 1051
hardly makes sense.

Thanks for answers.
User avatar
xemmybx
 
Posts: 3372
Joined: Thu Jun 22, 2006 2:01 pm

Post » Fri May 27, 2011 4:59 am

I would like to request a function, SetKnockedState. We already have GetKnockedState, just need one that can set it![snip]
Use modAV2 fatigue/setUnconscious instead.

I'm pretty sure it's never triggered.
IIRC, it's the menu that shows up when you get to name a custom class.
User avatar
Avril Louise
 
Posts: 3408
Joined: Thu Jun 15, 2006 10:37 pm

Post » Fri May 27, 2011 8:46 am

C++ questions: When a class contains a structure, is the structure created when the class is constructed? If so, I'm a little confused on how to refer to it.

I'm trying to update the .dlx mini-OBSE file of Pluggy to v18b4 and need to update a few lines of code. Pluggy has its own GetName and SetName in the .dlx with special handling for MapMarkers. So, this line name = mapMarker->fullName; (both are pointers, ExtraMapMarker* mapMarker and TESFullName* fullName) worked when the ExtraMapMarker class was simply
class ExtraMapMarker : public BsixtraData{public:	ExtraMapMarker();	~ExtraMapMarker();	enum {		kFlag_Visible	= 1 << 0,		kFlag_CanTravel	= 1 << 1	};	enum {		kType_Unk0 = 0,		kType_Camp,		kType_Unk2,		kType_City,		//...		kType_Max	};	struct Data {		TESFullName	fullName;		UInt16		flags;		UInt16		type;	// possibly only 8 bits, haven't checked yet	};	Data	* data;	TESFullName* GetFullName();	const char* GetName();	bool IsVisible()	{	return (data->flags & kFlag_Visible) == kFlag_Visible;	}	bool CanTravelTo()	{	return (data->flags & kFlag_CanTravel) == kFlag_CanTravel;	}	void SetVisible(bool bVisible)	{		data->flags = (bVisible) ? (data->flags | kFlag_Visible) : (data->flags & ~kFlag_Visible);	}	void SetCanTravelTo(bool bCanTravel) {		data->flags = (bCanTravel) ? (data->flags | kFlag_CanTravel) : (data->flags & ~kFlag_CanTravel);	}};

(Note that fullName is no longer a pointer)

Any help is much appreciated :)
User avatar
Monique Cameron
 
Posts: 3430
Joined: Fri Jun 23, 2006 6:30 am

Post » Fri May 27, 2011 12:59 am

C++ questions: When a class contains a structure, is the structure created when the class is constructed? If so, I'm a little confused on how to refer to it.

If the class contains a variable of that structure type, then yes that structure variable is created when the class is constructed, just as any other class variable. But just declaring a struct within a class only means that the struct is hidden for other classes (if not public).

From within that class, you refer to the struct as normal. From outside you would refer to it as "ClassName::StructName" - provided it is visible.


I'm not fully sure what you're asking, but the class has a "Data * data;" variable, so I assume the constructor has a "data = http://forums.bethsoft.com/index.php?/topic/1047306-beta-oblivion-script-extender-obse-0018/new Data()" line to create the actual data content, just like it would have to with any other pointer. Since the constructor is a method for that class, the Data struct is visible, and refered just as normal. Same is true for the GetFullName() method, which will be :
TESFullName* ExtraMapMarker::GetFullName(){   return &(data->fullName);}

Note that it returns the address of the data->fullName variable, not the variable itself, since as you noted, fullName is no longer a pointer.

On another note: AFAIK, the only reason for those special Map Marker functions in Pluggy, was Elys Map Marker Be Done. And this mod + the Pluggy Map Marker functions has become pretty much outdated with OBSEv18's added map marker functionality and my Map Marker Overhaul. So you might consider removing this functionality from Pluggy.
User avatar
Brian LeHury
 
Posts: 3416
Joined: Tue May 22, 2007 6:54 am

Post » Fri May 27, 2011 1:06 pm

I'm not fully sure what you're asking, but the class has a "Data * data;" variable, so I assume the constructor has a "data = http://forums.bethsoft.com/index.php?/topic/1047306-beta-oblivion-script-extender-obse-0018/new Data()" line to create the actual data content, just like it would have to with any other pointer.

Ah, that's what I was missing - Data is a pointer. I tried to change the line to name = mapMarker->Data->fullName; and name = mapMarker->Data.fullName; and got errors for both. I also missed that there are simple GetName functions that return the pointer :embarrass: I'll just use those...

Wait, that didn't work either - throws a bunch of linker 2001 errors. From what I can tell, the functions are declared but never defined (much like the constructor, which I thought meant it used a "default" construction). So, is there a way to get the address of fullName directly? Nothing I do seem to compiles. OK, got the line name = &(mapMarker->data->fullName); to not throw an error (and it seems to mean what I want, though to me the syntax should be mapMarker->data->&fullName), but I get the same linker 2001 errors.

Is there an easy to update the... erm... web of included files? That is, Pluggy's main.cpp includes "GameObjects.h", GameObjects includes GameExtraData.h, and GameExtraData includes GameBsixtraData. The last one is the important one - it's been added since the old Pluggy .dlx so I needed to add it to the project (and that took care of the linker errors above :D). Is there no way to tell it to look in the \obse\ folder for these files? (My only formal training was with C, and IIRC all I had to do was drop it in the directory or get it a path... much easier).
On another note: AFAIK, the only reason for those special Map Marker functions in Pluggy, was Elys Map Marker Be Done. And this mod + the Pluggy Map Marker functions has become pretty much outdated with OBSEv18's added map marker functionality and my Map Marker Overhaul. So you might consider removing this functionality from Pluggy.

Unfortunately, removing functionality isn't a possibility - otherwise, EspIDs would be completely gone and I could save myself the headache of refactoring the ESP-manager.
User avatar
Mr.Broom30
 
Posts: 3433
Joined: Thu Nov 08, 2007 2:05 pm

Post » Fri May 27, 2011 10:14 am

I do not know if this is related or not but I have tried it with and without obse and get this error then crash to Desktop
http://i144.photobucket.com/albums/r189/raziel23x/Errors/CSErrormessage.png
User avatar
Charlie Sarson
 
Posts: 3445
Joined: Thu May 17, 2007 12:38 pm

Post » Fri May 27, 2011 5:39 am

Is there an easy to update the... erm... web of included files? That is, Pluggy's main.cpp includes "GameObjects.h", GameObjects includes GameExtraData.h, and GameExtraData includes GameBsixtraData. The last one is the important one - it's been added since the old Pluggy .dlx so I needed to add it to the project (and that took care of the linker errors above :D ). Is there no way to tell it to look in the \obse\ folder for these files? (My only formal training was with C, and IIRC all I had to do was drop it in the directory or get it a path... much easier).
Add an environment variable PATH ( or the directory directly ) to your Visual Studio env. Tools > Options > Projects and Solutions > VC++ Directories > Show Directories for : Include files.
User avatar
Charles Mckinna
 
Posts: 3511
Joined: Mon Nov 12, 2007 6:51 am

Post » Fri May 27, 2011 10:07 am

Add an environment variable PATH ( or the directory directly ) to your Visual Studio env. Tools > Options > Projects and Solutions > VC++ Directories > Show Directories for : Include files.

Thanks ShadeMe - that gave me some clues on where to look, but still no luck. Added the direct/absolute directories to the VC++ Directories. The directories are also included in the Project Properties [$(SolutionDir)\..\obse and $(SolutionDir)\..\obse\obse]. Still, I have to add the files to the project (by right-clicking the project and selection Add > Existing Item). Is there a global "Ignore Additional Directories" option I'm missing?
User avatar
ashleigh bryden
 
Posts: 3446
Joined: Thu Jun 29, 2006 5:43 am

Post » Fri May 27, 2011 2:04 pm

about c++ headers
some headers' INCLUDE macro gives local path and it should be set the path from where its call and not to where
ie. we have #include "obse\someheader.h" and we have someheader.h in D:\somepath\somedirupofobse\obse we should add to path the somedirupofobse, not straight to obse directory
User avatar
Ross Thomas
 
Posts: 3371
Joined: Sat Jul 21, 2007 12:06 am

Post » Fri May 27, 2011 8:48 am

What does GetModIndex return if the supplied mod does not exist?
User avatar
Claire
 
Posts: 3329
Joined: Tue Oct 24, 2006 4:01 pm

Post » Fri May 27, 2011 11:21 am

What does GetModIndex return if the supplied mod does not exist?
Highly likely it'll return -1 in such a case.
User avatar
Inol Wakhid
 
Posts: 3403
Joined: Wed Jun 27, 2007 5:47 am

Post » Fri May 27, 2011 3:58 pm

Highly likely it'll return -1 in such a case.

Indeed it does :)

Wait a minute, got my types mixed up. It might return 255 (not sure how Oblivion handles it, if it returns the unsigned integer it's 255, if it typecasts everything into its usual signed Double, it'll be -1).
User avatar
x_JeNnY_x
 
Posts: 3493
Joined: Wed Jul 05, 2006 3:52 pm

Post » Fri May 27, 2011 3:17 am

Bug report : Expressions in eval conditions aren't evaluated at compile time. You could use a non-existent variable/ref and get away with it.
User avatar
Alexis Acevedo
 
Posts: 3330
Joined: Sat Oct 27, 2007 8:58 pm

Post » Fri May 27, 2011 1:43 pm

If a word in an expression does not translate to a valid FormID or a variable name, OBSE assumes it is a string

if eval ABC == XYZ . . . is the same as . . . if eval "ABC" == "XYZ" . . . if ABC and XYZ are not declared variables or a game object of any kind.

I personally love this feature, specially for stringmap array keys.

May this be what you are talking about?
User avatar
Gisela Amaya
 
Posts: 3424
Joined: Tue Oct 23, 2007 4:29 pm

Post » Fri May 27, 2011 3:59 pm

I personally love this feature, specially for stringmap array keys.

Keep in mind, though, that adding a variable later can break your script in unexpected ways, if the variable's name happened to be used as an unquoted string.
User avatar
Ebony Lawson
 
Posts: 3504
Joined: Fri Feb 16, 2007 11:00 am

Post » Fri May 27, 2011 10:42 am

Yes, this is a concern.
Another potential pitfall is assigning values to array elements, when, like in eval, there is no type checking at compile time.
Any mistyping on a variable name or reference name will turn the mistyped word into an unquoted string, leading to spending some time debugging the code, sooner or later.

What I do to counter this risk is prefixing all intended unquoted string with a "z". This makes it really easy to spot most typing mistakes while coding (btw, I am giving http://en.wikipedia.org/wiki/Hungarian_notation a try and it has helped a lot in this area).

Imho, the benefits on code readability and typing speed are much greater than the mentioned disadvantages of this feature.
User avatar
Lynne Hinton
 
Posts: 3388
Joined: Wed Nov 15, 2006 4:24 am

Post » Fri May 27, 2011 4:42 pm

Yes, this is a concern.
Another potential pitfall is assigning values to array elements, when, like in eval, there is no type checking at compile time.
Any mistyping on a variable name or reference name will turn the mistyped word into an unquoted string, leading to spending some time debugging the code, sooner or later.

What I do to counter this risk is prefixing all intended unquoted string with a "z". This makes it really easy to spot most typing mistakes while coding (btw, I am giving http://en.wikipedia.org/wiki/Hungarian_notation a try and it has helped a lot in this area).

Imho, the benefits on code readability and typing speed are much greater than the mentioned disadvantages of this feature.

For Oblivion, you might want to read this http://www.joelonsoftware.com/articles/Wrong.html instead of the wiki - he shifts the focus from type (which, except for this case, is always Double in Oblivion) to purpose (which is mighty handy :)).
User avatar
remi lasisi
 
Posts: 3307
Joined: Sun Jul 02, 2006 2:26 pm

Post » Fri May 27, 2011 1:00 pm

Yes, that was the article that called my attention to Hungarian Notation when it was mentioned (by you?) here in the forums a few months back. This article and the http://msdn.microsoft.com/en-us/library/aa260976(VS.60).aspx completely 'sold' me the concept of focusing on the purpose of the variable. I am using it extensively on the mod I am working on and I think I got the hang of it (in my amateuristic way, of course).

An example for those not familiar with the concept: Reference type variables may store FormIDs of many kinds of 'objects', so, instead of indiscriminately naming them refXXX, I name them based on what they are supposed to store: refXXX (regular references), basXXX (base objects), pacXXX (AI package FormIDs), funXXX (User function formIDs), etc.

Also, if they are stored in stringmap arrays, I name the array keys using the same notation, prefixing it with a "z", as I said before. E.g MyArray[zrefXXX], MyArray[zbasXXX], MyArray[zpacXXX], MyArray[zfunXXX], etc.

This way, as intended by the notation, a line like "player.additem refXXX 1" or "Let MyArray[zbasXXX] := refXXX" smells trouble the moment you write it.

I am getting very fond of it.
User avatar
Maria Leon
 
Posts: 3413
Joined: Tue Aug 14, 2007 12:39 am

Post » Fri May 27, 2011 1:19 am

I don't suppose there's any way to access an NPCs ongoing detection calculations, is there?

Or even a reliable way to determine how much sound the player is making?
User avatar
Steve Bates
 
Posts: 3447
Joined: Sun Aug 26, 2007 2:51 pm

Post » Fri May 27, 2011 11:32 am

I have a hypothesis I'd like confirmed on the topic of script-using mods. As I've had some weird behaviour with a few OBSE using mods and know that Deadly Reflex can get very pissed off if not loaded late enough, is it correct to assume that script using mods are more likely to crash the game due to that nature?

I've been flapping all over the place for loads of potential fixing when it comes to crashing, and the latest example was The March Rider smithy in Cheydinhal practically ALWAYS crashing. This has been going on for quite some time until my latest update of Better Cities (and its support for B&M & City Life). However there's still random crashes tied to cell-change and now I'm pondering if it can be related to weather mods. Thoughts?

This production is one of the biggest cogs in the Oblivion clockwork and I'd like to say great thanks for enabling the kind of modding OBSE offers.

Edit*: No problems confirmed and now I've went for another clean install. Will see what happens.
User avatar
Kelli Wolfe
 
Posts: 3440
Joined: Thu Aug 23, 2007 7:09 am

Post » Fri May 27, 2011 3:13 pm

Is there any support in OBSE for changing a weapon damage type in game?

For example, using a single weapon, but alternating back and forth between dealing blade or blunt damage at the touch of a hotkey? And, supposing such a trick would work, the weapon in whatever state it was in, would raise the corresponding skill?

Pressing still further, I assume this effect could be limited to certain weapons?

Thanks ahead of time.
User avatar
Nomee
 
Posts: 3382
Joined: Thu May 24, 2007 5:18 pm

Post » Fri May 27, 2011 3:00 am

Just use http://cs.elderscrolls.com/constwiki/index.php/SetWeaponType.
User avatar
Klaire
 
Posts: 3405
Joined: Wed Sep 27, 2006 7:56 am

Post » Fri May 27, 2011 7:27 am

Can't get sv_Replace to work.

Test case:
scriptname aaaDBTestScriptBegin GameModeif(GetGameLoaded)	string_var Base	string_var Find	string_var Insert		Let Base := "Test REPLACETHIS Test"	Let Find := "REPLACETHIS"	Let Insert := "Inserted this"		Let Find := Find + "|" + Insert	Print Base		sv_Replace Find Base		Print Base	endifEnd

Base is the same before and after sv_Replace.
User avatar
Tarka
 
Posts: 3430
Joined: Sun Jun 10, 2007 9:22 pm

Post » Fri May 27, 2011 10:39 am

Can't get sv_Replace to work.

Test case:
...
Base is the same before and after sv_Replace.
I think you need to use $Find or "%z" Find cause sv_Replace uses a formatString
User avatar
Felix Walde
 
Posts: 3333
Joined: Sat Jun 02, 2007 4:50 pm

Post » Fri May 27, 2011 1:29 am

I think you need to use $Find or "%z" Find cause sv_Replace uses a formatString

Indeed so. Thank you.
User avatar
Georgia Fullalove
 
Posts: 3390
Joined: Mon Nov 06, 2006 11:48 pm

PreviousNext

Return to IV - Oblivion